r351597 - [ASTDump] Mark variadic declarations with a tag instead of child node
Stephen Kelly via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 18 13:38:30 PST 2019
Author: steveire
Date: Fri Jan 18 13:38:30 2019
New Revision: 351597
URL: http://llvm.org/viewvc/llvm-project?rev=351597&view=rev
Log:
[ASTDump] Mark variadic declarations with a tag instead of child node
Summary:
This makes it easier to separate traversal of the AST from output
generation.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D56751
Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp
cfe/trunk/test/AST/ast-dump-decl.m
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351597&r1=351596&r2=351597&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Jan 18 13:38:30 2019
@@ -164,8 +164,6 @@ namespace {
VisitFunctionType(T);
for (QualType PT : T->getParamTypes())
dumpTypeAsChild(PT);
- if (T->getExtProtoInfo().Variadic)
- dumpChild([=] { OS << "..."; });
}
void VisitTypeOfExprType(const TypeOfExprType *T) {
dumpStmt(T->getUnderlyingExpr());
@@ -1236,6 +1234,9 @@ void ASTDumper::VisitObjCMethodDecl(cons
NodeDumper.dumpName(D);
NodeDumper.dumpType(D->getReturnType());
+ if (D->isVariadic())
+ OS << " variadic";
+
if (D->isThisDeclarationADefinition()) {
dumpDeclContext(D);
} else {
@@ -1243,9 +1244,6 @@ void ASTDumper::VisitObjCMethodDecl(cons
dumpDecl(Parameter);
}
- if (D->isVariadic())
- dumpChild([=] { OS << "..."; });
-
if (D->hasBody())
dumpStmt(D->getBody());
}
@@ -1378,12 +1376,12 @@ void ASTDumper::Visit(const BlockDecl::C
}
void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
+ if (D->isVariadic())
+ OS << " variadic";
+
for (auto I : D->parameters())
dumpDecl(I);
- if (D->isVariadic())
- dumpChild([=]{ OS << "..."; });
-
if (D->capturesCXXThis())
dumpChild([=]{ OS << "capture this"; });
Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=351597&r1=351596&r2=351597&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Fri Jan 18 13:38:30 2019
@@ -1096,6 +1096,8 @@ void TextNodeDumper::VisitFunctionProtoT
OS << " volatile";
if (T->isRestrict())
OS << " restrict";
+ if (T->getExtProtoInfo().Variadic)
+ OS << " variadic";
switch (EPI.RefQualifier) {
case RQ_None:
break;
Modified: cfe/trunk/test/AST/ast-dump-decl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-decl.m?rev=351597&r1=351596&r2=351597&view=diff
==============================================================================
--- cfe/trunk/test/AST/ast-dump-decl.m (original)
+++ cfe/trunk/test/AST/ast-dump-decl.m Fri Jan 18 13:38:30 2019
@@ -28,20 +28,18 @@
@interface testObjCMethodDecl : A {
}
- (int) TestObjCMethodDecl: (int)i, ...;
-// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
+// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int' variadic
// CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
-// CHECK-NEXT: ...
@end
@implementation testObjCMethodDecl
- (int) TestObjCMethodDecl: (int)i, ... {
return 0;
}
-// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
+// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int' variadic
// CHECK-NEXT: ImplicitParamDecl{{.*}} self
// CHECK-NEXT: ImplicitParamDecl{{.*}} _cmd
// CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
-// CHECK-NEXT: ...
// CHECK-NEXT: CompoundStmt
@end
@@ -137,9 +135,8 @@ void TestBlockDecl(int x) {
^(int y, ...){ x; };
}
// CHECK: FunctionDecl{{.*}}TestBlockDecl
-// CHECK: BlockDecl
+// CHECK: BlockDecl {{.+}} <col:3, col:21> col:3 variadic
// CHECK-NEXT: ParmVarDecl{{.*}} y 'int'
-// CHECK-NEXT: ...
// CHECK-NEXT: capture ParmVar{{.*}} 'x' 'int'
// CHECK-NEXT: CompoundStmt
More information about the cfe-commits
mailing list