Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

llvm-svn: 169229
diff --git a/clang/unittests/Lex/PreprocessingRecordTest.cpp b/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
similarity index 75%
rename from clang/unittests/Lex/PreprocessingRecordTest.cpp
rename to clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
index 2bf0048..21271f9 100644
--- a/clang/unittests/Lex/PreprocessingRecordTest.cpp
+++ b/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
@@ -1,4 +1,4 @@
-//===- unittests/Lex/PreprocessingRecordTest.cpp - PreprocessingRecord tests =//
+//===- unittests/Lex/PPConditionalDirectiveRecordTest.cpp-PP directive tests =//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -19,7 +19,7 @@
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
-#include "clang/Lex/PreprocessingRecord.h"
+#include "clang/Lex/PPConditionalDirectiveRecord.h"
 #include "llvm/Config/config.h"
 
 #include "gtest/gtest.h"
@@ -30,9 +30,9 @@
 namespace {
 
 // The test fixture.
-class PreprocessingRecordTest : public ::testing::Test {
+class PPConditionalDirectiveRecordTest : public ::testing::Test {
 protected:
-  PreprocessingRecordTest()
+  PPConditionalDirectiveRecordTest()
     : FileMgr(FileMgrOpts),
       DiagID(new DiagnosticIDs()),
       Diags(DiagID, new DiagnosticOptions, new IgnoringDiagConsumer()),
@@ -62,7 +62,7 @@
   }
 };
 
-TEST_F(PreprocessingRecordTest, PPRecAPI) {
+TEST_F(PPConditionalDirectiveRecordTest, PPRecAPI) {
   const char *source =
       "0 1\n"
       "#if 1\n"
@@ -93,7 +93,9 @@
                   /*IILookup =*/ 0,
                   /*OwnsHeaderSearch =*/false,
                   /*DelayInitialization =*/ false);
-  PP.createPreprocessingRecord(true);
+  PPConditionalDirectiveRecord *
+    PPRec = new PPConditionalDirectiveRecord(SourceMgr);
+  PP.addPPCallbacks(PPRec);
   PP.EnterMainSourceFile();
 
   std::vector<Token> toks;
@@ -108,37 +110,36 @@
   // Make sure we got the tokens that we expected.
   ASSERT_EQ(10U, toks.size());
   
-  PreprocessingRecord &PPRec = *PP.getPreprocessingRecord();
-  EXPECT_FALSE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_FALSE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[0].getLocation(), toks[1].getLocation())));
-  EXPECT_TRUE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_TRUE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[0].getLocation(), toks[2].getLocation())));
-  EXPECT_FALSE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_FALSE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[3].getLocation(), toks[4].getLocation())));
-  EXPECT_TRUE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_TRUE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[1].getLocation(), toks[5].getLocation())));
-  EXPECT_TRUE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_TRUE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[2].getLocation(), toks[6].getLocation())));
-  EXPECT_FALSE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_FALSE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[2].getLocation(), toks[5].getLocation())));
-  EXPECT_FALSE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_FALSE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[0].getLocation(), toks[6].getLocation())));
-  EXPECT_TRUE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_TRUE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[2].getLocation(), toks[8].getLocation())));
-  EXPECT_FALSE(PPRec.rangeIntersectsConditionalDirective(
+  EXPECT_FALSE(PPRec->rangeIntersectsConditionalDirective(
                     SourceRange(toks[0].getLocation(), toks[9].getLocation())));
 
-  EXPECT_TRUE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_TRUE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[0].getLocation(), toks[2].getLocation()));
-  EXPECT_FALSE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_FALSE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[3].getLocation(), toks[4].getLocation()));
-  EXPECT_TRUE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_TRUE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[1].getLocation(), toks[5].getLocation()));
-  EXPECT_TRUE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_TRUE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[2].getLocation(), toks[0].getLocation()));
-  EXPECT_FALSE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_FALSE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[4].getLocation(), toks[3].getLocation()));
-  EXPECT_TRUE(PPRec.areInDifferentConditionalDirectiveRegion(
+  EXPECT_TRUE(PPRec->areInDifferentConditionalDirectiveRegion(
                     toks[5].getLocation(), toks[1].getLocation()));
 }