• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
9 //
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
19 //
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)
24 //
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
29 // CHECK-LIST-NEXT: x
30 //
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:     BinaryOperator
36 //
37 // RUN: clang-check -ast-dump -ast-dump-filter test_namespace::AfterNullNode "%s" -- 2>&1 | FileCheck -check-prefix CHECK-AFTER-NULL %s
38 // CHECK-AFTER-NULL: class AfterNullNode
39 
40 namespace test_namespace {
41 
42 class TheClass {
43 public:
theMethod(int x)44   int theMethod(int x) {
45     return x + x;
46   }
47   int n __attribute__((aligned(1+1)));
48 };
49 
50 // Used to fail with -ast-dump-filter X
51 template<template<typename T> class C> class Z {};
52 
53 // Check that traversal continues after the previous construct.
54 class AfterNullNode {};
55 
56 }
57