From: Aaron Ballman Date: Fri, 30 Nov 2018 15:11:16 +0000 (+0000) Subject: Adding tests for -ast-dump; NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f22971bc88b420abac0b116eff1bc17f5f19bd3;p=clang Adding tests for -ast-dump; NFC. This adds tests for DeclStmt and demonstrates that we don't create such an AST node for global declarations currently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347996 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Misc/ast-dump-decl-stmts.cpp b/test/Misc/ast-dump-decl-stmts.cpp new file mode 100644 index 0000000000..3705bc5785 --- /dev/null +++ b/test/Misc/ast-dump-decl-stmts.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s + +void test_func() { + int a, b, c; + // CHECK: DeclStmt 0x{{[^ ]*}} + // CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:7 a 'int' + // CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:10 b 'int' + // CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:13 c 'int' + void d(), e(int); + // CHECK: DeclStmt 0x{{[^ ]*}} + // CHECK-NEXT: FunctionDecl 0x{{[^ ]*}} parent 0x{{[^ ]*}} col:8 d 'void ()' + // CHECK-NEXT: FunctionDecl 0x{{[^ ]*}} parent 0x{{[^ ]*}} col:13 e 'void (int)' + // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:18 'int' + int f; + // CHECK: DeclStmt 0x{{[^ ]*}} + // CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:7 f 'int' +} + +// FIXME: These currently do not show up as a DeclStmt. +int a, b, c; +// CHECK: VarDecl 0x{{[^ ]*}} col:5 a 'int' +// CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:8 b 'int' +// CHECK-NEXT: VarDecl 0x{{[^ ]*}} col:11 c 'int' +void d(), e(int); +// CHECK: FunctionDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} col:6 d 'void ()' +// CHECK-NEXT: FunctionDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} col:11 e 'void (int)' +// CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:16 'int' +int f; +// CHECK: VarDecl 0x{{[^ ]*}} col:5 f 'int' +