[libclang] When indexing an AST file, only deserialize the preprocessing record
entities of the current primary module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index f6314b9..8c19aeb 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -455,21 +455,10 @@
   if (!PP.getPreprocessingRecord())
     return;
 
-  PreprocessingRecord &PPRec = *PP.getPreprocessingRecord();
-
   // FIXME: Only deserialize inclusion directives.
-  // FIXME: Only deserialize stuff from the last chained PCH, not the PCH/Module
-  // that it depends on.
 
-  bool OnlyLocal = !Unit.isMainFileAST() && Unit.getOnlyLocalDecls();
   PreprocessingRecord::iterator I, E;
-  if (OnlyLocal) {
-    I = PPRec.local_begin();
-    E = PPRec.local_end();
-  } else {
-    I = PPRec.begin();
-    E = PPRec.end();
-  }
+  llvm::tie(I, E) = Unit.getLocalPreprocessingEntities();
 
   for (; I != E; ++I) {
     PreprocessedEntity *PPE = *I;