================ @@ -158,6 +159,42 @@ TEST(StdLibTests, EndToEnd) { UnorderedElementsAre(StdlibSymbol("list"), StdlibSymbol("vector"))); } +TEST(StdLibTests, StdLibDocComments) { + Config Cfg; + Cfg.Index.StandardLibrary = true; + WithContextValue Enabled(Config::Key, std::move(Cfg)); + + MockFS FS; + FS.Files["stdlib/vector"] = R"cpp( + namespace std { + struct vector { + /**doc comment*/ + struct inner {}; + }; + } + )cpp"; + MockCompilationDatabase CDB; + CDB.ExtraClangFlags.push_back("-isystem" + testPath("stdlib")); + ClangdServer::Options Opts = ClangdServer::optsForTest(); + Opts.BuildDynamicSymbolIndex = true; // also used for stdlib index + ClangdServer Server(CDB, FS, Opts); + + // Open an empty file. <vector> will not be part of the preamble index, + // but it will be part of the stdlib index. + Server.addDocument(testPath("foo.cc"), ""); + + // Wait for the stdlib index to be built. + ASSERT_TRUE(Server.blockUntilIdleForTest()); + + // Check that the index contains the doc comment. + FuzzyFindRequest Req; + Req.Query = "inner"; + Req.Scopes = {"std::vector::"}; + SymbolSlab Result = runFuzzyFind(*Server.getIndexForTest(), Req); ---------------- HighCommander4 wrote:
Done, thanks for the suggestion! 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