================ @@ -158,6 +158,43 @@ 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 { + template <typename T> + class vector { + public: + /**doc comment*/ + unsigned int size() const; + }; + } + )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); + + Annotations A(R"cpp( + #include <vector> + void foo() { + std::vector<int> v; + v.si^ze(); + } + )cpp"); + + Server.addDocument(testPath("foo.cc"), A.code()); + ASSERT_TRUE(Server.blockUntilIdleForTest()); ---------------- kadircet wrote:
IIUC we're testing preamble vs stdlib index depending on which one finishes first here. I think we can try with a vector implementation like: ```cpp struct vector { // This shouldn't be indexed for code-completion, hence static-idx wouldn't have any docs for it. struct inner {}; }; ``` afterwards we can add an empty file to clangd, to make sure we only index `vector` through stdlib-index and not preabmle. afterwards we run a workspace symbol query for `vector::inner` and ensure it has docs. WDYT? 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