[PATCH] D105177: [clangd] Implemented indexing of standard library
Christian Kühnel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 09:16:47 PDT 2021
kuhnel added inline comments.
================
Comment at: clang-tools-extra/clangd/index/StdLib.cpp:72
+ Inputs.TFS = &TFS;
+ // TODO: can we get a real compile command from somewhere?
+ Inputs.CompileCommand.Directory = virtualRoot().str();
----------------
nridge wrote:
> sammccall wrote:
> > I'm not sure what this means, I don't think there's anything better to do here.
> One could imagine picking a source file from the project's CDB, and using its flags to parse the standard library.
>
> That could be relevant for macros that affect the way standard library headers are parsed (like `_GLIBCXX_DEBUG` perhaps?)
Yes, my question was: can we get the real compile command form the file in which we're querying the standard library index and then extract the (relevant) compiler argument from that.
That might also help in guessing the current language variant.
================
Comment at: clang-tools-extra/clangd/unittests/StdLibIndexTests.cpp:51
+ Req.AnyScope = true;
+ EXPECT_THAT(match(*Index, Req),
+ UnorderedElementsAre(llvm::StringRef("myfunc"),
----------------
@sammccall I seem to be running into a use-after-free problem here. Debugging the whole thing shows that `Index` is pointing to an invalid address. So the problem is somewhere between returning the `unique_ptr` from `indexUmbrellaHeaders(...)` and assigning it to the `Index` variable.
Can you please take a look and give me a hint how to fix this?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105177/new/
https://reviews.llvm.org/D105177
More information about the cfe-commits
mailing list