diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
| commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
| tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/Import | |
| parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) | |
Notes
Diffstat (limited to 'test/Import')
23 files changed, 128 insertions, 1 deletions
diff --git a/test/Import/extern-c-function/Inputs/F.cpp b/test/Import/extern-c-function/Inputs/F.cpp new file mode 100644 index 0000000000000..c417d56302606 --- /dev/null +++ b/test/Import/extern-c-function/Inputs/F.cpp @@ -0,0 +1,3 @@ +extern "C" { + void f(int arg); +} diff --git a/test/Import/extern-c-function/test.cpp b/test/Import/extern-c-function/test.cpp new file mode 100644 index 0000000000000..50227cdf9c2b0 --- /dev/null +++ b/test/Import/extern-c-function/test.cpp @@ -0,0 +1,4 @@ +// RUN: clang-import-test -import %S/Inputs/F.cpp -expression %s +void expr() { + f(2); +}
\ No newline at end of file diff --git a/test/Import/forward-declared-objc-class/Inputs/S1.m b/test/Import/forward-declared-objc-class/Inputs/S1.m new file mode 100644 index 0000000000000..b9305d7e89f15 --- /dev/null +++ b/test/Import/forward-declared-objc-class/Inputs/S1.m @@ -0,0 +1 @@ +@class MyClass;
\ No newline at end of file diff --git a/test/Import/forward-declared-objc-class/Inputs/S2.m b/test/Import/forward-declared-objc-class/Inputs/S2.m new file mode 100644 index 0000000000000..69d067a3bdbb4 --- /dev/null +++ b/test/Import/forward-declared-objc-class/Inputs/S2.m @@ -0,0 +1,6 @@ +@interface MyClass { + int j; +}; ++(MyClass*)fromInteger:(int)_j; +-(int)getInteger; +@end
\ No newline at end of file diff --git a/test/Import/forward-declared-objc-class/Inputs/S3.m b/test/Import/forward-declared-objc-class/Inputs/S3.m new file mode 100644 index 0000000000000..b9305d7e89f15 --- /dev/null +++ b/test/Import/forward-declared-objc-class/Inputs/S3.m @@ -0,0 +1 @@ +@class MyClass;
\ No newline at end of file diff --git a/test/Import/forward-declared-objc-class/test.m b/test/Import/forward-declared-objc-class/test.m new file mode 100644 index 0000000000000..098818be3cb0d --- /dev/null +++ b/test/Import/forward-declared-objc-class/test.m @@ -0,0 +1,6 @@ +// RUN: clang-import-test -x objective-c++ -import %S/Inputs/S1.m --import %S/Inputs/S2.m --import %S/Inputs/S3.m -expression %s +void expr() { + MyClass *c = [MyClass fromInteger:3]; + const int i = [c getInteger]; + const int j = c->j; +} diff --git a/test/Import/forward-declared-struct/Inputs/S3.c b/test/Import/forward-declared-struct/Inputs/S3.c new file mode 100644 index 0000000000000..28377c2760ba8 --- /dev/null +++ b/test/Import/forward-declared-struct/Inputs/S3.c @@ -0,0 +1 @@ +struct S; diff --git a/test/Import/forward-declared-struct/test.c b/test/Import/forward-declared-struct/test.c index 7ccdcf9e97d08..8199aa267d54a 100644 --- a/test/Import/forward-declared-struct/test.c +++ b/test/Import/forward-declared-struct/test.c @@ -1,4 +1,4 @@ -// RUN: clang-import-test -import %S/Inputs/S1.c --import %S/Inputs/S2.c -expression %s +// RUN: clang-import-test -import %S/Inputs/S1.c --import %S/Inputs/S2.c --import %S/Inputs/S3.c -expression %s void expr() { struct S MyS; MyS.a = 3; diff --git a/test/Import/local-struct-use-origins/Inputs/Callee.cpp b/test/Import/local-struct-use-origins/Inputs/Callee.cpp new file mode 100644 index 0000000000000..96cd2f22e4934 --- /dev/null +++ b/test/Import/local-struct-use-origins/Inputs/Callee.cpp @@ -0,0 +1,12 @@ +struct Bar { + void bar(int _a, bool _b) { + { + struct S { int a; }; + S s = { _a }; + } + { + struct S { bool b; }; + S t = { _b }; + } + }; +}; diff --git a/test/Import/local-struct-use-origins/test.cpp b/test/Import/local-struct-use-origins/test.cpp new file mode 100644 index 0000000000000..abbdbd16d022f --- /dev/null +++ b/test/Import/local-struct-use-origins/test.cpp @@ -0,0 +1,7 @@ +// RUN: clang-import-test -dump-ir -use-origins -import %S/Inputs/Callee.cpp -expression %s | FileCheck %s +// CHECK: %struct.S = type { i +// CHECK: %struct.S.0 = type { i + +void foo() { + return Bar().bar(3, true); +} diff --git a/test/Import/local-struct/Inputs/Callee.cpp b/test/Import/local-struct/Inputs/Callee.cpp new file mode 100644 index 0000000000000..96cd2f22e4934 --- /dev/null +++ b/test/Import/local-struct/Inputs/Callee.cpp @@ -0,0 +1,12 @@ +struct Bar { + void bar(int _a, bool _b) { + { + struct S { int a; }; + S s = { _a }; + } + { + struct S { bool b; }; + S t = { _b }; + } + }; +}; diff --git a/test/Import/local-struct/test.cpp b/test/Import/local-struct/test.cpp new file mode 100644 index 0000000000000..1e838477a0072 --- /dev/null +++ b/test/Import/local-struct/test.cpp @@ -0,0 +1,7 @@ +// RUN: clang-import-test -dump-ir -import %S/Inputs/Callee.cpp -expression %s | FileCheck %s +// CHECK: %struct.S = type { i +// CHECK: %struct.S.0 = type { i + +void foo() { + return Bar().bar(3, true); +} diff --git a/test/Import/objc-definitions-in-expression/Inputs/S.m b/test/Import/objc-definitions-in-expression/Inputs/S.m new file mode 100644 index 0000000000000..cf8ffaa602a89 --- /dev/null +++ b/test/Import/objc-definitions-in-expression/Inputs/S.m @@ -0,0 +1,4 @@ +@interface C { +} +-(int)m; +@end diff --git a/test/Import/objc-definitions-in-expression/test.m b/test/Import/objc-definitions-in-expression/test.m new file mode 100644 index 0000000000000..0c9984731d199 --- /dev/null +++ b/test/Import/objc-definitions-in-expression/test.m @@ -0,0 +1,21 @@ +// RUN: clang-import-test -x objective-c++ -import %S/Inputs/S.m -expression %s +@class D; + +@interface B { + int x; + int y; +} +@end + +@interface D : B { + int z; +} +-(int)n; +@end + +void expr() { + C *c; + int i = [c m]; + D *d; + int j = [d n] + d->x; +} diff --git a/test/Import/objc-method/Inputs/S.m b/test/Import/objc-method/Inputs/S.m new file mode 100644 index 0000000000000..cf8ffaa602a89 --- /dev/null +++ b/test/Import/objc-method/Inputs/S.m @@ -0,0 +1,4 @@ +@interface C { +} +-(int)m; +@end diff --git a/test/Import/objc-method/test.m b/test/Import/objc-method/test.m new file mode 100644 index 0000000000000..7707110d82495 --- /dev/null +++ b/test/Import/objc-method/test.m @@ -0,0 +1,5 @@ +// RUN: clang-import-test -x objective-c++ -import %S/Inputs/S.m -expression %s +void expr() { + C *c; + int i = [c m]; +} diff --git a/test/Import/struct-and-var/Inputs/S1.cpp b/test/Import/struct-and-var/Inputs/S1.cpp new file mode 100644 index 0000000000000..9678b94102eed --- /dev/null +++ b/test/Import/struct-and-var/Inputs/S1.cpp @@ -0,0 +1 @@ +int F; diff --git a/test/Import/struct-and-var/Inputs/S2.cpp b/test/Import/struct-and-var/Inputs/S2.cpp new file mode 100644 index 0000000000000..3f0ad8e16024d --- /dev/null +++ b/test/Import/struct-and-var/Inputs/S2.cpp @@ -0,0 +1,3 @@ +struct F { + int a; +}; diff --git a/test/Import/struct-and-var/test.cpp b/test/Import/struct-and-var/test.cpp new file mode 100644 index 0000000000000..76f539e41f9fa --- /dev/null +++ b/test/Import/struct-and-var/test.cpp @@ -0,0 +1,5 @@ +// RUN: clang-import-test --import %S/Inputs/S1.cpp --import %S/Inputs/S2.cpp -expression %s +void expr() { + struct F f; + int x = f.a; +} diff --git a/test/Import/struct-layout/Inputs/Callee.cpp b/test/Import/struct-layout/Inputs/Callee.cpp new file mode 100644 index 0000000000000..62422af6c2dea --- /dev/null +++ b/test/Import/struct-layout/Inputs/Callee.cpp @@ -0,0 +1,9 @@ +struct S { + int a; +}; + +struct Bar { + void bar(int _a) { + S s = { _a }; + }; +}; diff --git a/test/Import/struct-layout/test.cpp b/test/Import/struct-layout/test.cpp new file mode 100644 index 0000000000000..698d0609fa052 --- /dev/null +++ b/test/Import/struct-layout/test.cpp @@ -0,0 +1,6 @@ +// RUN: clang-import-test -dump-ir -import %S/Inputs/Callee.cpp -expression %s | FileCheck %s +// CHECK: %struct.S = type { i + +void foo() { + return Bar().bar(3); +} diff --git a/test/Import/template/Inputs/T.cpp b/test/Import/template/Inputs/T.cpp new file mode 100644 index 0000000000000..2499936788a47 --- /dev/null +++ b/test/Import/template/Inputs/T.cpp @@ -0,0 +1,5 @@ +template <typename T> struct A { + struct B { + T f; + }; +}; diff --git a/test/Import/template/test.cpp b/test/Import/template/test.cpp new file mode 100644 index 0000000000000..89cbda8b92fb2 --- /dev/null +++ b/test/Import/template/test.cpp @@ -0,0 +1,4 @@ +// RUN: clang-import-test -import %S/Inputs/T.cpp -expression %s +void expr() { + A<int>::B b; +} |
