Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 1 | // RUN: clang-check -ast-dump "%s" -- 2>&1 | FileCheck %s |
Richard Trieu | e8d4119 | 2013-01-31 01:44:26 +0000 | [diff] [blame] | 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 |
Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 9 | // |
| 10 | // RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::theMethod "%s" -- 2>&1 | FileCheck -check-prefix CHECK-FILTER %s |
Alexander Kornienko | d538ed9 | 2012-12-20 02:09:13 +0000 | [diff] [blame] | 11 | // CHECK-FILTER-NOT: NamespaceDecl |
| 12 | // CHECK-FILTER-NOT: CXXRecordDecl |
Dmitri Gribenko | 0061fe4 | 2012-11-21 10:54:55 +0000 | [diff] [blame] | 13 | // CHECK-FILTER: {{^}}Dumping test_namespace::TheClass::theMethod |
Richard Trieu | e8d4119 | 2013-01-31 01:44:26 +0000 | [diff] [blame] | 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 |
Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 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 |
Richard Smith | 0dae729 | 2012-08-16 02:43:29 +0000 | [diff] [blame] | 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 |
Richard Trieu | e8d4119 | 2013-01-31 01:44:26 +0000 | [diff] [blame] | 33 | // CHECK-ATTR-NEXT: FieldDecl{{.*}}n |
| 34 | // CHECK-ATTR-NEXT: AlignedAttr |
| 35 | // CHECK-ATTR-NEXT: BinaryOperator |
Alexander Kornienko | 3028038 | 2012-10-31 18:46:31 +0000 | [diff] [blame] | 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 |
Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 39 | |
| 40 | namespace test_namespace { |
| 41 | |
| 42 | class TheClass { |
| 43 | public: |
| 44 | int theMethod(int x) { |
| 45 | return x + x; |
| 46 | } |
Richard Smith | 0dae729 | 2012-08-16 02:43:29 +0000 | [diff] [blame] | 47 | int n __attribute__((aligned(1+1))); |
Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
Alexander Kornienko | a7612ae | 2012-08-17 17:38:39 +0000 | [diff] [blame] | 50 | // Used to fail with -ast-dump-filter X |
| 51 | template<template<typename T> class C> class Z {}; |
| 52 | |
Alexander Kornienko | 3028038 | 2012-10-31 18:46:31 +0000 | [diff] [blame] | 53 | // Check that traversal continues after the previous construct. |
| 54 | class AfterNullNode {}; |
| 55 | |
Alexander Kornienko | 4846470 | 2012-08-13 10:50:08 +0000 | [diff] [blame] | 56 | } |