[PATCH] D91868: [clangd] Mention when CXXThis is implicit in exposed AST.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 20 14:09:01 PST 2020


kadircet added a comment.

This looks like an improvement to me as well, thanks!



================
Comment at: clang-tools-extra/clangd/DumpAST.cpp:233
       return CCO->getConstructor()->getNameAsString();
+    if (const auto *CTE = dyn_cast<CXXThisExpr>(S)) {
+      bool Const = CTE->getType()->getPointeeType().isLocalConstQualified();
----------------
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);
}
```


================
Comment at: clang-tools-extra/clangd/unittests/DumpASTTests.cpp:79
       {R"cpp(
-template <typename T> int root() {
-  (void)root<unsigned>();
+namespace root {
+template <typename T> int tmpl() {
----------------
is this change intentional ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91868/new/

https://reviews.llvm.org/D91868



More information about the cfe-commits mailing list