From c19f3d94438efaf519a6c41d3928b47d8ad56e6a Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Wed, 16 Jan 2019 16:12:30 +0000 Subject: Added test cases for dumping variadic-like functions; NFC. --- clang/test/AST/ast-dump-decl.c | 3 +++ clang/test/AST/ast-dump-expr.cpp | 18 ++++++++++++++++++ clang/test/AST/ast-dump-funcs.cpp | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/clang/test/AST/ast-dump-decl.c b/clang/test/AST/ast-dump-decl.c index e0a8b56f70a..b58f9bce2b9 100644 --- a/clang/test/AST/ast-dump-decl.c +++ b/clang/test/AST/ast-dump-decl.c @@ -128,6 +128,9 @@ int TestFunctionDeclProto(int x); // CHECK: FunctionDecl{{.*}} TestFunctionDeclProto 'int (int)' // CHECK-NEXT: ParmVarDecl{{.*}} x +void TestFunctionDeclNoProto(); +// CHECK: FunctionDecl{{.*}} TestFunctionDeclNoProto 'void ()' + extern int TestFunctionDeclSC(); // CHECK: FunctionDecl{{.*}} TestFunctionDeclSC 'int ()' extern diff --git a/clang/test/AST/ast-dump-expr.cpp b/clang/test/AST/ast-dump-expr.cpp index 5d668aad4ae..915a14bc563 100644 --- a/clang/test/AST/ast-dump-expr.cpp +++ b/clang/test/AST/ast-dump-expr.cpp @@ -294,6 +294,24 @@ void PrimaryExpressions(Ts... a) { // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto ()' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} + [](int a, ...){}; + // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' + // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition + // CHECK-NEXT: DefinitionData lambda + // CHECK-NEXT: DefaultConstructor + // CHECK-NEXT: CopyConstructor + // CHECK-NEXT: MoveConstructor + // CHECK-NEXT: CopyAssignment + // CHECK-NEXT: MoveAssignment + // CHECK-NEXT: Destructor + // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto (int, ...) const' inline + // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:10 a 'int' + // CHECK-NEXT: CompoundStmt + // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)(int, ...) 'auto (*() const)(int, ...)' inline + // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto (int, ...)' static inline + // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:10 a 'int' + // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} + [a...]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition diff --git a/clang/test/AST/ast-dump-funcs.cpp b/clang/test/AST/ast-dump-funcs.cpp index 62ae9648dde..62afcc61fc5 100644 --- a/clang/test/AST/ast-dump-funcs.cpp +++ b/clang/test/AST/ast-dump-funcs.cpp @@ -118,6 +118,11 @@ void m(int) {} // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:11 'int' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} +void n(int, ...) {} +// CHECK: FunctionDecl 0x{{[^ ]*}} col:6 n 'void (int, ...)' +// CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:11 'int' +// CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} + int main() { // CHECK: FunctionDecl 0x{{[^ ]*}} line:[[@LINE-1]]:5 main 'int ()' a1(); // Causes this to be marked 'used' -- cgit v1.2.3