From: Bruno Ricci Date: Sun, 3 Feb 2019 18:20:27 +0000 (+0000) Subject: [ASTDump] Add a flag indicating whether a CXXThisExpr is implicit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52422ef96e9821d7608f58add4e458a005836429;p=clang [ASTDump] Add a flag indicating whether a CXXThisExpr is implicit There is currently no way to distinguish implicit from explicit CXXThisExpr in the AST dump output. Differential Revision: https://reviews.llvm.org/D57649 Reviewed By: steveire git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353003 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/TextNodeDumper.cpp b/lib/AST/TextNodeDumper.cpp index 6e6700c747..9e6f7216e5 100644 --- a/lib/AST/TextNodeDumper.cpp +++ b/lib/AST/TextNodeDumper.cpp @@ -854,6 +854,8 @@ void TextNodeDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) { } void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) { + if (Node->isImplicit()) + OS << " implicit"; OS << " this"; } diff --git a/test/AST/ast-dump-expr.cpp b/test/AST/ast-dump-expr.cpp index 0c85e2eea2..96d3df34cb 100644 --- a/test/AST/ast-dump-expr.cpp +++ b/test/AST/ast-dump-expr.cpp @@ -255,7 +255,7 @@ void PrimaryExpressions(Ts... a) { // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:8 implicit 'V *' // CHECK-NEXT: CXXMethodDecl // CHECK-NEXT: CompoundStmt - // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' this + // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' implicit this [*this]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} @@ -272,7 +272,7 @@ void PrimaryExpressions(Ts... a) { // CHECK-NEXT: CompoundStmt // CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} 'NULL TYPE' // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} '' prefix '*' cannot overflow - // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' this + // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' implicit this } }; diff --git a/test/AST/dump.cpp b/test/AST/dump.cpp index d9ddca6672..f92c3e84df 100644 --- a/test/AST/dump.cpp +++ b/test/AST/dump.cpp @@ -56,7 +56,7 @@ struct S { // CHECK-NEXT: | | `-DeclRefExpr {{.+}} 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &' // CHECK-NEXT: | |-OMPSharedClause {{.+}} // CHECK-NEXT: | | `-MemberExpr {{.+}} 'int' lvalue ->b -// CHECK-NEXT: | | `-CXXThisExpr {{.+}} 'S *' this +// CHECK-NEXT: | | `-CXXThisExpr {{.+}} 'S *' implicit this // CHECK-NEXT: | |-OMPScheduleClause {{.+}} // CHECK-NEXT: | | `-ImplicitCastExpr {{.+}} 'int' // CHECK-NEXT: | | `-DeclRefExpr {{.+}} 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int' diff --git a/test/AST/float16.cpp b/test/AST/float16.cpp index 2f428e7085..1704d35a77 100644 --- a/test/AST/float16.cpp +++ b/test/AST/float16.cpp @@ -132,7 +132,7 @@ public: //CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '+' //CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' //CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}} -//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' this +//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' implicit this //CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16' //CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static