diff options
Diffstat (limited to 'clang/test')
18 files changed, 86 insertions, 3 deletions
diff --git a/clang/test/Import/extern-c-function/Inputs/F.cpp b/clang/test/Import/extern-c-function/Inputs/F.cpp new file mode 100644 index 00000000000..c417d563026 --- /dev/null +++ b/clang/test/Import/extern-c-function/Inputs/F.cpp @@ -0,0 +1,3 @@ +extern "C" { + void f(int arg); +} diff --git a/clang/test/Import/extern-c-function/test.cpp b/clang/test/Import/extern-c-function/test.cpp new file mode 100644 index 00000000000..50227cdf9c2 --- /dev/null +++ b/clang/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/clang/test/Import/forward-declared-objc-class/Inputs/S1.m b/clang/test/Import/forward-declared-objc-class/Inputs/S1.m new file mode 100644 index 00000000000..b9305d7e89f --- /dev/null +++ b/clang/test/Import/forward-declared-objc-class/Inputs/S1.m @@ -0,0 +1 @@ +@class MyClass;
\ No newline at end of file diff --git a/clang/test/Import/forward-declared-objc-class/Inputs/S2.m b/clang/test/Import/forward-declared-objc-class/Inputs/S2.m new file mode 100644 index 00000000000..69d067a3bdb --- /dev/null +++ b/clang/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/clang/test/Import/forward-declared-objc-class/Inputs/S3.m b/clang/test/Import/forward-declared-objc-class/Inputs/S3.m new file mode 100644 index 00000000000..b9305d7e89f --- /dev/null +++ b/clang/test/Import/forward-declared-objc-class/Inputs/S3.m @@ -0,0 +1 @@ +@class MyClass;
\ No newline at end of file diff --git a/clang/test/Import/forward-declared-objc-class/test.m b/clang/test/Import/forward-declared-objc-class/test.m new file mode 100644 index 00000000000..098818be3cb --- /dev/null +++ b/clang/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/clang/test/Import/forward-declared-struct/Inputs/S3.c b/clang/test/Import/forward-declared-struct/Inputs/S3.c new file mode 100644 index 00000000000..28377c2760b --- /dev/null +++ b/clang/test/Import/forward-declared-struct/Inputs/S3.c @@ -0,0 +1 @@ +struct S; diff --git a/clang/test/Import/forward-declared-struct/test.c b/clang/test/Import/forward-declared-struct/test.c index 7ccdcf9e97d..8199aa267d5 100644 --- a/clang/test/Import/forward-declared-struct/test.c +++ b/clang/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/clang/test/Import/local-struct-use-origins/Inputs/Callee.cpp b/clang/test/Import/local-struct-use-origins/Inputs/Callee.cpp new file mode 100644 index 00000000000..96cd2f22e49 --- /dev/null +++ b/clang/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/clang/test/Import/local-struct-use-origins/test.cpp b/clang/test/Import/local-struct-use-origins/test.cpp new file mode 100644 index 00000000000..abbdbd16d02 --- /dev/null +++ b/clang/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/clang/test/Import/local-struct/test.cpp b/clang/test/Import/local-struct/test.cpp index 8f6e38138f2..1e838477a00 100644 --- a/clang/test/Import/local-struct/test.cpp +++ b/clang/test/Import/local-struct/test.cpp @@ -1,7 +1,6 @@ // RUN: clang-import-test -dump-ir -import %S/Inputs/Callee.cpp -expression %s | FileCheck %s -// XFAIL: * // CHECK: %struct.S = type { i -// CHECK: %struct.S.0 = type { i1 } +// CHECK: %struct.S.0 = type { i void foo() { return Bar().bar(3, true); diff --git a/clang/test/Import/objc-definitions-in-expression/Inputs/S.m b/clang/test/Import/objc-definitions-in-expression/Inputs/S.m new file mode 100644 index 00000000000..cf8ffaa602a --- /dev/null +++ b/clang/test/Import/objc-definitions-in-expression/Inputs/S.m @@ -0,0 +1,4 @@ +@interface C { +} +-(int)m; +@end diff --git a/clang/test/Import/objc-definitions-in-expression/test.m b/clang/test/Import/objc-definitions-in-expression/test.m new file mode 100644 index 00000000000..0c9984731d1 --- /dev/null +++ b/clang/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/clang/test/Import/struct-and-var/Inputs/S1.cpp b/clang/test/Import/struct-and-var/Inputs/S1.cpp new file mode 100644 index 00000000000..9678b94102e --- /dev/null +++ b/clang/test/Import/struct-and-var/Inputs/S1.cpp @@ -0,0 +1 @@ +int F; diff --git a/clang/test/Import/struct-and-var/Inputs/S2.cpp b/clang/test/Import/struct-and-var/Inputs/S2.cpp new file mode 100644 index 00000000000..3f0ad8e1602 --- /dev/null +++ b/clang/test/Import/struct-and-var/Inputs/S2.cpp @@ -0,0 +1,3 @@ +struct F { + int a; +}; diff --git a/clang/test/Import/struct-and-var/test.cpp b/clang/test/Import/struct-and-var/test.cpp new file mode 100644 index 00000000000..76f539e41f9 --- /dev/null +++ b/clang/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/clang/test/Import/template/Inputs/T.cpp b/clang/test/Import/template/Inputs/T.cpp new file mode 100644 index 00000000000..2499936788a --- /dev/null +++ b/clang/test/Import/template/Inputs/T.cpp @@ -0,0 +1,5 @@ +template <typename T> struct A { + struct B { + T f; + }; +}; diff --git a/clang/test/Import/template/test.cpp b/clang/test/Import/template/test.cpp new file mode 100644 index 00000000000..89cbda8b92f --- /dev/null +++ b/clang/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; +} |