From 7213cd14f59c5a9f474cb1a379905192b2d1ea7b Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 30 Nov 2018 15:11:16 +0000 Subject: [PATCH] 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. llvm-svn: 347996 --- clang/test/Misc/ast-dump-decl-stmts.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 clang/test/Misc/ast-dump-decl-stmts.cpp diff --git a/clang/test/Misc/ast-dump-decl-stmts.cpp b/clang/test/Misc/ast-dump-decl-stmts.cpp new file mode 100644 index 0000000..3705bc5 --- /dev/null +++ b/clang/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' + -- 2.7.4