Put a symbols value information which is deduced from initializer
expression into HoverInfo struct.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 33789 Build 33788: arc lint + arc unit
Event Timeline
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
722 | do we want the initializer both here and in Definition? I suspect we'd like to turn off one or the other when both are present. Looking at the examples, I think it's clearer to keep a non-evaluated initializer as part of the Definition (which is mostly as-written), and only include Value if it's evaluated. | |
733 | why not print the non-evaluated init if it's dependent? | |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
917 | constexpr may not be required here, I think? | |
953 | Hmm, actually I'm not sure whether this is TypeLoc vs Decl here. Rather this should be a DeclRefExpr to the VarDecl (result) in the *expanded* CXXRecordDecl. This suggests that maybe the isValueDependent check isn't quite right - the initializer expression is value dependent as spelled, but in the instantiation it's resolved. Not sure if this is fixable. What happens if you comment out the check? | |
978 | whoa, that's... weird. But fine, I think. (It would be nice to elide the &[] if the index is zero, or maybe print as "1234" + 2 etc) |
- Address comments
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
733 | not-necessary anymore, since we only generate value if it can be evaluated. | |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
953 | yes, and the problem lies in the IndexingAPI, inside handleDeclOccurence implicit instantiations are resolved into templated decls. therefore we lose the template params :/ we can't call expression evaluator on value dependent expressions, there is an assertion in the beginning of EvaluateAsRvalue. | |
978 | do you think it is worth changing that in printpretty (either the defaults or via some PrintingPolicy option)? |
Implementation LG though please do check that the new test results look useful and not too duplicative
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
723 | Maybe add a FIXME about doing this for arbitrary expressions (like sizeof and function calls), not just VarDecl? | |
clang-tools-extra/clangd/XRefs.h | ||
106 | if exists -> if available? | |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
673 | are these actually still emitted, or tests not updated? Some of them (e.g. the lambda below!) don't seem useful | |
953 | OK, let's leave this to later. Can you change the FIXME comment? I think it's misleading as it stands | |
978 | Let's leave it for now and see if it actually proves annoying. |
if exists -> if available?