r353003 - [ASTDump] Add a flag indicating whether a CXXThisExpr is implicit

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 3 10:20:27 PST 2019


Author: brunoricci
Date: Sun Feb  3 10:20:27 2019
New Revision: 353003

URL: http://llvm.org/viewvc/llvm-project?rev=353003&view=rev
Log:
[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


Modified:
    cfe/trunk/lib/AST/TextNodeDumper.cpp
    cfe/trunk/test/AST/ast-dump-expr.cpp
    cfe/trunk/test/AST/dump.cpp
    cfe/trunk/test/AST/float16.cpp

Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=353003&r1=353002&r2=353003&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Sun Feb  3 10:20:27 2019
@@ -854,6 +854,8 @@ void TextNodeDumper::VisitCXXBoolLiteral
 }
 
 void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
+  if (Node->isImplicit())
+    OS << " implicit";
   OS << " this";
 }
 

Modified: cfe/trunk/test/AST/ast-dump-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-expr.cpp?rev=353003&r1=353002&r2=353003&view=diff
==============================================================================
--- cfe/trunk/test/AST/ast-dump-expr.cpp (original)
+++ cfe/trunk/test/AST/ast-dump-expr.cpp Sun Feb  3 10:20:27 2019
@@ -255,7 +255,7 @@ void PrimaryExpressions(Ts... a) {
       // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <col:8> col:8 implicit 'V *'
       // CHECK-NEXT: CXXMethodDecl
       // CHECK-NEXT: CompoundStmt
-      // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' this
+      // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' implicit this
 
       [*this]{};
       // CHECK: LambdaExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:7, col:15>
@@ -272,7 +272,7 @@ void PrimaryExpressions(Ts... a) {
       // CHECK-NEXT: CompoundStmt
       // CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} <col:8> 'NULL TYPE'
       // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:8> '<dependent type>' prefix '*' cannot overflow
-      // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' this
+      // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' implicit this
     }
   };
 

Modified: cfe/trunk/test/AST/dump.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=353003&r1=353002&r2=353003&view=diff
==============================================================================
--- cfe/trunk/test/AST/dump.cpp (original)
+++ cfe/trunk/test/AST/dump.cpp Sun Feb  3 10:20:27 2019
@@ -56,7 +56,7 @@ struct S {
 // CHECK-NEXT: |       | `-DeclRefExpr {{.+}} <col:48> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
 // CHECK-NEXT: |       |-OMPSharedClause {{.+}} <col:51, col:59>
 // CHECK-NEXT: |       | `-MemberExpr {{.+}} <col:58> 'int' lvalue ->b
-// CHECK-NEXT: |       |   `-CXXThisExpr {{.+}} <col:58> 'S *' this
+// CHECK-NEXT: |       |   `-CXXThisExpr {{.+}} <col:58> 'S *' implicit this
 // CHECK-NEXT: |       |-OMPScheduleClause {{.+}} <col:61, col:79>
 // CHECK-NEXT: |       | `-ImplicitCastExpr {{.+}} <col:78> 'int' <LValueToRValue>
 // CHECK-NEXT: |       |   `-DeclRefExpr {{.+}} <col:78> 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'

Modified: cfe/trunk/test/AST/float16.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/float16.cpp?rev=353003&r1=353002&r2=353003&view=diff
==============================================================================
--- cfe/trunk/test/AST/float16.cpp (original)
+++ cfe/trunk/test/AST/float16.cpp Sun Feb  3 10:20:27 2019
@@ -132,7 +132,7 @@ public:
 //CHECK-NEXT: | |     `-BinaryOperator {{.*}} '_Float16' '+'
 //CHECK-NEXT: | |       |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
 //CHECK-NEXT: | |       | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}
-//CHECK-NEXT: | |       |   `-CXXThisExpr {{.*}} 'C1 *' this
+//CHECK-NEXT: | |       |   `-CXXThisExpr {{.*}} 'C1 *' implicit this
 //CHECK-NEXT: | |       `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
 //CHECK-NEXT: | |         `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
 //CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static




More information about the cfe-commits mailing list