[PATCH] D86699: [SyntaxTree] Ignore implicit non-leaf `CXXConstructExpr`

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 10:36:16 PDT 2020


eduucaldas added a reviewer: gribozavr2.
eduucaldas added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:48-58
+static Expr *IgnoreImplicitCXXConstructExpr(Expr *E) {
+  if (auto *C = dyn_cast<CXXConstructExpr>(E)) {
+    auto NumArgs = C->getNumArgs();
+    if (NumArgs == 1 || (NumArgs > 1 && isa<CXXDefaultArgExpr>(C->getArg(1)))) {
+      auto *A = C->getArg(0);
+      if (A->getSourceRange() == E->getSourceRange())
+        return A;
----------------
Should this go into `IgnoreExpr` as well?

If yes, should we unify this with the lambda inside `IgnoreUnlessSpelledInSource`, thus removing the lambda and using this free function instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86699



More information about the cfe-commits mailing list