1 // RUN: clang-check -ast-dump "%s" -- 2>&1 | FileCheck %s
2 // CHECK: NamespaceDecl{{.*}}test_namespace
3 // CHECK-NEXT: CXXRecordDecl{{.*}}TheClass
4 // CHECK: CXXMethodDecl{{.*}}theMethod
5 // CHECK-NEXT: ParmVarDecl{{.*}}x
6 // CHECK-NEXT: CompoundStmt
7 // CHECK-NEXT: ReturnStmt
8 // CHECK-NEXT: BinaryOperator
10 // RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::theMethod "%s" -- 2>&1 | FileCheck -check-prefix CHECK-FILTER %s
11 // CHECK-FILTER-NOT: NamespaceDecl
12 // CHECK-FILTER-NOT: CXXRecordDecl
13 // CHECK-FILTER: {{^}}Dumping test_namespace::TheClass::theMethod
14 // CHECK-FILTER-NEXT: {{^}}CXXMethodDecl{{.*}}theMethod
15 // CHECK-FILTER-NEXT: ParmVarDecl{{.*}}x
16 // CHECK-FILTER-NEXT: CompoundStmt
17 // CHECK-FILTER-NEXT: ReturnStmt
18 // CHECK-FILTER-NEXT: BinaryOperator
20 // RUN: clang-check -ast-print "%s" -- 2>&1 | FileCheck -check-prefix CHECK-PRINT %s
21 // CHECK-PRINT: namespace test_namespace
22 // CHECK-PRINT: class TheClass
23 // CHECK-PRINT: int theMethod(int x)
25 // RUN: clang-check -ast-list "%s" -- 2>&1 | FileCheck -check-prefix CHECK-LIST %s
26 // CHECK-LIST: test_namespace
27 // CHECK-LIST-NEXT: test_namespace::TheClass
28 // CHECK-LIST-NEXT: test_namespace::TheClass::theMethod
31 // RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::n "%s" -- 2>&1 | FileCheck -check-prefix CHECK-ATTR %s
32 // CHECK-ATTR: test_namespace
33 // CHECK-ATTR-NEXT: FieldDecl{{.*}}n
34 // CHECK-ATTR-NEXT: AlignedAttr
35 // CHECK-ATTR-NEXT: ConstantExpr
36 // CHECK-ATTR-NEXT: value: Int 2
37 // CHECK-ATTR-NEXT: BinaryOperator
39 // RUN: clang-check -ast-dump -ast-dump-filter test_namespace::AfterNullNode "%s" -- 2>&1 | FileCheck -check-prefix CHECK-AFTER-NULL %s
40 // CHECK-AFTER-NULL: class AfterNullNode
42 namespace test_namespace
{
46 int theMethod(int x
) {
49 int n
__attribute__((aligned(1+1)));
52 // Used to fail with -ast-dump-filter X
53 template<template<typename T
> class C
> class Z
{};
55 // Check that traversal continues after the previous construct.
56 class AfterNullNode
{};