]> granicus.if.org Git - clang/commitdiff
[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit
authorBruno Ricci <riccibrun@gmail.com>
Sun, 3 Feb 2019 18:20:27 +0000 (18:20 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Sun, 3 Feb 2019 18:20:27 +0000 (18:20 +0000)
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

lib/AST/TextNodeDumper.cpp
test/AST/ast-dump-expr.cpp
test/AST/dump.cpp
test/AST/float16.cpp

index 6e6700c7470f02187696eb3eb124df3ad183274c..9e6f7216e5f72a7361f09068081a69f35a1a242e 100644 (file)
@@ -854,6 +854,8 @@ void TextNodeDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
 }
 
 void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
+  if (Node->isImplicit())
+    OS << " implicit";
   OS << " this";
 }
 
index 0c85e2eea2df7fa7ac3980ff846a253c687731f3..96d3df34cb47f8459c6adaf5055a3b4ea323e7a0 100644 (file)
@@ -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
     }
   };
 
index d9ddca66722045f28a86520bc651178df5b8c6dc..f92c3e84dfd5810d9ec093e628bd4260c6a4c867 100644 (file)
@@ -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'
index 2f428e7085ff1ebf663091e08348c10afba0002e..1704d35a771862ff271ac8553e3d9c9cc3e770fc 100644 (file)
@@ -132,7 +132,7 @@ public:
 //CHECK-NEXT: | |     `-BinaryOperator {{.*}} '_Float16' '+'\r
 //CHECK-NEXT: | |       |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>\r
 //CHECK-NEXT: | |       | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}\r
-//CHECK-NEXT: | |       |   `-CXXThisExpr {{.*}} 'C1 *' this\r
+//CHECK-NEXT: | |       |   `-CXXThisExpr {{.*}} 'C1 *' implicit this\r
 //CHECK-NEXT: | |       `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>\r
 //CHECK-NEXT: | |         `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'\r
 //CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static\r