[libclang] When indexing an AST file, only deserialize the file level

declarations of the current primary module.

llvm-svn: 165046
This commit is contained in:
Argyrios Kyrtzidis
2012-10-02 21:09:13 +00:00
parent 7768299b98
commit 10e7846abf
8 changed files with 117 additions and 26 deletions

View File

@@ -2792,6 +2792,30 @@ ASTUnit::getLocalPreprocessingEntities() const {
PreprocessingRecord::iterator());
}
bool ASTUnit::applyOnLocalTopLevelDecls(void *context, DeclReceiverFn Fn) {
if (isMainFileAST()) {
serialization::ModuleFile &
Mod = Reader->getModuleManager().getPrimaryModule();
ASTReader::ModuleDeclIterator MDI, MDE;
llvm::tie(MDI, MDE) = Reader->getModuleFileLevelDecls(Mod);
for (; MDI != MDE; ++MDI) {
if (!Fn(context, *MDI))
return false;
}
return true;
}
for (ASTUnit::top_level_iterator TL = top_level_begin(),
TLEnd = top_level_end();
TL != TLEnd; ++TL) {
if (!Fn(context, *TL))
return false;
}
return true;
}
void ASTUnit::PreambleData::countLines() const {
NumLines = 0;
if (empty())