diff options
author | Eduardo Caldas <ecaldas@google.com> | 2020-08-27 09:44:09 +0000 |
---|---|---|
committer | Eduardo Caldas <ecaldas@google.com> | 2020-09-08 09:44:23 +0000 |
commit | 46f4439dc9bf9b8cfee0001b6752c3d074c83b00 (patch) | |
tree | 71eef98c753fdc70c6e7e47274df958f19d8de04 /clang/lib/Tooling/Syntax/BuildTree.cpp | |
parent | 2325d6b42f096bf93d2ab0bed7096759e5c96ce8 (diff) | |
download | llvm-46f4439dc9bf9b8cfee0001b6752c3d074c83b00.zip llvm-46f4439dc9bf9b8cfee0001b6752c3d074c83b00.tar.gz llvm-46f4439dc9bf9b8cfee0001b6752c3d074c83b00.tar.bz2 |
[SyntaxTree] Ignore implicit leaf `CXXConstructExpr`
Differential Revision: https://reviews.llvm.org/D86700
Diffstat (limited to 'clang/lib/Tooling/Syntax/BuildTree.cpp')
-rw-r--r-- | clang/lib/Tooling/Syntax/BuildTree.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Tooling/Syntax/BuildTree.cpp b/clang/lib/Tooling/Syntax/BuildTree.cpp index e5389ae..72083ee 100644 --- a/clang/lib/Tooling/Syntax/BuildTree.cpp +++ b/clang/lib/Tooling/Syntax/BuildTree.cpp @@ -1132,6 +1132,14 @@ public: return true; } + bool WalkUpFromCXXConstructExpr(CXXConstructExpr *S) { + // Ignore the implicit calls to default constructors. + if ((S->getNumArgs() == 0 || isa<CXXDefaultArgExpr>(S->getArg(0))) && + S->getParenOrBraceRange().isInvalid()) + return true; + return RecursiveASTVisitor::WalkUpFromCXXConstructExpr(S); + } + bool TraverseCXXOperatorCallExpr(CXXOperatorCallExpr *S) { // To construct a syntax tree of the same shape for calls to built-in and // user-defined operators, ignore the `DeclRefExpr` that refers to the |