================ @@ -223,33 +226,26 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources, return Symbols; } - SymbolCollector::Options IndexOpts; - IndexOpts.Origin = SymbolOrigin::StdLib; - IndexOpts.CollectMainFileSymbols = false; - IndexOpts.CollectMainFileRefs = false; - IndexOpts.CollectMacro = true; - IndexOpts.StoreAllDocumentation = true; - // Sadly we can't use IndexOpts.FileFilter to restrict indexing scope. - // Files from outside the StdLibLocation may define true std symbols anyway. - // We end up "blessing" such headers, and can only do that by indexing - // everything first. - - // Refs, relations, include graph in the stdlib mostly aren't useful. - auto Action = createStaticIndexingAction( - IndexOpts, [&](SymbolSlab S) { Symbols = std::move(S); }, nullptr, - nullptr, nullptr); - - if (!Action->BeginSourceFile(*Clang, Input)) { + SyntaxOnlyAction Action; + + if (!Action.BeginSourceFile(*Clang, Input)) { elog("Standard Library Index: BeginSourceFile() failed"); return Symbols; } - if (llvm::Error Err = Action->Execute()) { + if (llvm::Error Err = Action.Execute()) { elog("Standard Library Index: Execute failed: {0}", std::move(Err)); return Symbols; } - Action->EndSourceFile(); + // We don't care about include graph for stdlib headers, so provide a no-op + // PI. + include_cleaner::PragmaIncludes PI; + auto Slabs = + indexHeaderSymbols("", Clang->getASTContext(), Clang->getPreprocessor(), + PI, SymbolOrigin::StdLib); + Symbols = std::move(std::get<0>(Slabs)); + Action.EndSourceFile(); ---------------- kadircet wrote:
can you also add a comment here to mention we shouldn't run `EndSourceFile` beofre indexing to make sure AST/PP state is "alive"? https://github.com/llvm/llvm-project/pull/133681 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits