diff options
Diffstat (limited to 'test/Import')
| -rw-r--r-- | test/Import/attr/Inputs/S.cpp | 13 | ||||
| -rw-r--r-- | test/Import/attr/test.cpp | 26 | ||||
| -rw-r--r-- | test/Import/inherited-ctor-init-expr/Inputs/A.cpp | 11 | ||||
| -rw-r--r-- | test/Import/inherited-ctor-init-expr/test.cpp | 6 | ||||
| -rw-r--r-- | test/Import/template-specialization/Inputs/T.cpp | 4 | ||||
| -rw-r--r-- | test/Import/template-specialization/test.cpp | 5 |
6 files changed, 64 insertions, 1 deletions
diff --git a/test/Import/attr/Inputs/S.cpp b/test/Import/attr/Inputs/S.cpp new file mode 100644 index 000000000000..28d70c544a7c --- /dev/null +++ b/test/Import/attr/Inputs/S.cpp @@ -0,0 +1,13 @@ +extern void f() __attribute__((const)); + +struct S { + struct { + int a __attribute__((packed)); + }; +}; + +void stmt() { +#pragma unroll + for (;;) + ; +} diff --git a/test/Import/attr/test.cpp b/test/Import/attr/test.cpp new file mode 100644 index 000000000000..c9b2d6ed3433 --- /dev/null +++ b/test/Import/attr/test.cpp @@ -0,0 +1,26 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: FunctionDecl +// CHECK-SAME: S.cpp:1:1, col:38 +// CHECK-NEXT: ConstAttr +// CHECK-SAME: col:32 + +// CHECK: IndirectFieldDecl +// CHECK-NEXT: Field +// CHECK-NEXT: Field +// CHECK-NEXT: PackedAttr +// CHECK-SAME: col:26 + +// CHECK: AttributedStmt +// CHECK-NEXT: LoopHintAttr +// CHECK-SAME: line:10:9 + +extern void f() __attribute__((const)); + +struct S; + +void stmt(); + +void expr() { + f(); + struct S s; +} diff --git a/test/Import/inherited-ctor-init-expr/Inputs/A.cpp b/test/Import/inherited-ctor-init-expr/Inputs/A.cpp new file mode 100644 index 000000000000..27134333242f --- /dev/null +++ b/test/Import/inherited-ctor-init-expr/Inputs/A.cpp @@ -0,0 +1,11 @@ +class A { +public: + A(int a) : a(a) {} + int a; +}; +class B : public A { + using A::A; +}; +class C : public B { + C() : B(1) {} +}; diff --git a/test/Import/inherited-ctor-init-expr/test.cpp b/test/Import/inherited-ctor-init-expr/test.cpp new file mode 100644 index 000000000000..9e15e382edc1 --- /dev/null +++ b/test/Import/inherited-ctor-init-expr/test.cpp @@ -0,0 +1,6 @@ +// RUN: clang-import-test -dump-ast -expression=%s -import=%S/Inputs/A.cpp | FileCheck %s +// CHECK: | | | `-CXXInheritedCtorInitExpr + +void foo() { + C c; +} diff --git a/test/Import/template-specialization/Inputs/T.cpp b/test/Import/template-specialization/Inputs/T.cpp index b31e2439efeb..7eea95829048 100644 --- a/test/Import/template-specialization/Inputs/T.cpp +++ b/test/Import/template-specialization/Inputs/T.cpp @@ -12,3 +12,7 @@ template <> struct A<bool> { int g; }; }; + + +template <typename T> constexpr int f() { return 0; } +template <> constexpr int f<int>() { return 4; } diff --git a/test/Import/template-specialization/test.cpp b/test/Import/template-specialization/test.cpp index 43996c53a77e..30df8187602d 100644 --- a/test/Import/template-specialization/test.cpp +++ b/test/Import/template-specialization/test.cpp @@ -1,7 +1,10 @@ // RUN: clang-import-test -import %S/Inputs/T.cpp -expression %s -// XFAIL: * + void expr() { A<int>::B b1; A<bool>::B b2; b1.f + b2.g; } + +static_assert(f<char>() == 0, ""); +static_assert(f<int>() == 4, ""); |
