Seeing an implicit this in the AST is pretty confusing I think.
While here, also mention when this is const.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This looks like an improvement to me as well, thanks!
clang-tools-extra/clangd/DumpAST.cpp | ||
---|---|---|
237 | should we ensure we always return within the branch (as we do within the rest of the branches to make sure we don't accumulate details by mistake)? e.g: if(CXXThisExpr) { details = {} if (const) details += "const"; if (implicit) details += "implicit"; return join(",", details); } | |
clang-tools-extra/clangd/unittests/DumpASTTests.cpp | ||
79–81 | is this change intentional ? |
clang-tools-extra/clangd/DumpAST.cpp | ||
---|---|---|
237 | Actually I was trying to *avoid* returning "" in several places. Can change it if you think it's important though. | |
clang-tools-extra/clangd/unittests/DumpASTTests.cpp | ||
79–81 | Yeah, the problem is that I wanted the root in the new test to be a member function, so I needed to switch from findDecl("root") to findUnqualifiedDecl("root"). But that fails if there are two decls with that name, as there were here: the primary template root<T> and the specialization root<unsigned>. Thus the change to wrap the whole thing in a root namespace. Maybe there's a neater way to solve this, I'm not sure it matters much. |
clang-tools-extra/clangd/DumpAST.cpp | ||
---|---|---|
237 |
I agree that this is bad, but it feels acceptable when the code doesn't read that way directly :P
I was afraid of entering other branches, before falling off the end (not applicable here, but assume one day we have a children of CXXThisExpr, this code will prefer the children when thisexpr is neither const nor implicit, which might be surprising).
As mentioned not an immediate threat, but might become surprising in the future and require some digging. So would be nice if you can. | |
clang-tools-extra/clangd/unittests/DumpASTTests.cpp | ||
79–81 | ah makes sense. sorry i missed the change from finddecl to unqualifieddecl within the test body. |
should we ensure we always return within the branch (as we do within the rest of the branches to make sure we don't accumulate details by mistake)? e.g: