Skip to content

Commit

Permalink
[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
riccibruno committed Feb 3, 2019
1 parent f1314b6 commit 64bebe9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions clang/lib/AST/TextNodeDumper.cpp
Expand Up @@ -854,6 +854,8 @@ void TextNodeDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
}

void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
if (Node->isImplicit())
OS << " implicit";
OS << " this";
}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/AST/ast-dump-expr.cpp
Expand Up @@ -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>
Expand All @@ -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
}
};

Expand Down
2 changes: 1 addition & 1 deletion clang/test/AST/dump.cpp
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion clang/test/AST/float16.cpp
Expand Up @@ -132,7 +132,7 @@ class C1 {
//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
Expand Down

0 comments on commit 64bebe9

Please sign in to comment.