static void indexPreprocessingRecord(ASTUnit &Unit, IndexingContext &IdxCtx) { Preprocessor &PP = Unit.getPreprocessor(); if (!PP.getPreprocessingRecord()) return; // FIXME: Only deserialize inclusion directives. PreprocessingRecord::iterator I, E; std::tie(I, E) = Unit.getLocalPreprocessingEntities(); bool isModuleFile = Unit.isModuleFile(); for (; I != E; ++I) { PreprocessedEntity *PPE = *I; if (InclusionDirective *ID = dyn_cast<InclusionDirective>(PPE)) { SourceLocation Loc = ID->getSourceRange().getBegin(); // Modules have synthetic main files as input, give an invalid location // if the location points to such a file. if (isModuleFile && Unit.isInMainFileID(Loc)) Loc = SourceLocation(); IdxCtx.ppIncludedFile(Loc, ID->getFileName(), ID->getFile(), ID->getKind() == InclusionDirective::Import, !ID->wasInQuotes(), ID->importedModule()); } } }
static void indexPreprocessingRecord(ASTUnit &Unit, IndexingContext &IdxCtx) { Preprocessor &PP = Unit.getPreprocessor(); if (!PP.getPreprocessingRecord()) return; // FIXME: Only deserialize inclusion directives. PreprocessingRecord::iterator I, E; llvm::tie(I, E) = Unit.getLocalPreprocessingEntities(); for (; I != E; ++I) { PreprocessedEntity *PPE = *I; if (InclusionDirective *ID = dyn_cast<InclusionDirective>(PPE)) { if (!ID->importedModule()) IdxCtx.ppIncludedFile(ID->getSourceRange().getBegin(),ID->getFileName(), ID->getFile(), ID->getKind() == InclusionDirective::Import, !ID->wasInQuotes()); } } }