Skip to content

Commit 64bebe9

Browse files
committed
[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 llvm-svn: 353003
1 parent f1314b6 commit 64bebe9

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,8 @@ void TextNodeDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
854854
}
855855

856856
void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
857+
if (Node->isImplicit())
858+
OS << " implicit";
857859
OS << " this";
858860
}
859861

clang/test/AST/ast-dump-expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void PrimaryExpressions(Ts... a) {
255255
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <col:8> col:8 implicit 'V *'
256256
// CHECK-NEXT: CXXMethodDecl
257257
// CHECK-NEXT: CompoundStmt
258-
// CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' this
258+
// CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' implicit this
259259

260260
[*this]{};
261261
// CHECK: LambdaExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:7, col:15>
@@ -272,7 +272,7 @@ void PrimaryExpressions(Ts... a) {
272272
// CHECK-NEXT: CompoundStmt
273273
// CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} <col:8> 'NULL TYPE'
274274
// CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:8> '<dependent type>' prefix '*' cannot overflow
275-
// CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' this
275+
// CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} <col:8> 'V *' implicit this
276276
}
277277
};
278278

clang/test/AST/dump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct S {
5656
// CHECK-NEXT: | | `-DeclRefExpr {{.+}} <col:48> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
5757
// CHECK-NEXT: | |-OMPSharedClause {{.+}} <col:51, col:59>
5858
// CHECK-NEXT: | | `-MemberExpr {{.+}} <col:58> 'int' lvalue ->b
59-
// CHECK-NEXT: | | `-CXXThisExpr {{.+}} <col:58> 'S *' this
59+
// CHECK-NEXT: | | `-CXXThisExpr {{.+}} <col:58> 'S *' implicit this
6060
// CHECK-NEXT: | |-OMPScheduleClause {{.+}} <col:61, col:79>
6161
// CHECK-NEXT: | | `-ImplicitCastExpr {{.+}} <col:78> 'int' <LValueToRValue>
6262
// CHECK-NEXT: | | `-DeclRefExpr {{.+}} <col:78> 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'

clang/test/AST/float16.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class C1 {
132132
//CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '+'
133133
//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
134134
//CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}
135-
//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' this
135+
//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' implicit this
136136
//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
137137
//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
138138
//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static

0 commit comments

Comments
 (0)