static void indexTranslationUnit(ASTUnit &Unit, IndexingContext &IdxCtx) { // FIXME: Only deserialize stuff from the last chained PCH, not the PCH/Module // that it depends on. bool OnlyLocal = !Unit.isMainFileAST() && Unit.getOnlyLocalDecls(); if (OnlyLocal) { for (ASTUnit::top_level_iterator TL = Unit.top_level_begin(), TLEnd = Unit.top_level_end(); TL != TLEnd; ++TL) { IdxCtx.indexTopLevelDecl(*TL); if (IdxCtx.shouldAbort()) return; } } else { TranslationUnitDecl *TUDecl = Unit.getASTContext().getTranslationUnitDecl(); for (TranslationUnitDecl::decl_iterator I = TUDecl->decls_begin(), E = TUDecl->decls_end(); I != E; ++I) { IdxCtx.indexTopLevelDecl(*I); if (IdxCtx.shouldAbort()) return; } } }