diff options
| author | Sean Callanan <scallanan@apple.com> | 2017-08-07 22:27:30 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2017-08-07 22:27:30 +0000 |
| commit | 2b3a54bafc38fd096986e401eedd49b88c9cf576 (patch) | |
| tree | 45031a0815220008d961187136fb86a50cdd27f2 /clang/test/Import | |
| parent | 8c1167df5c2d6aba3298489956fc4c4dc4de3793 (diff) | |
| download | bcm5719-llvm-2b3a54bafc38fd096986e401eedd49b88c9cf576.tar.gz bcm5719-llvm-2b3a54bafc38fd096986e401eedd49b88c9cf576.zip | |
This adds the argument --dump-ir to clang-import-test, which allows
viewing of the final IR. This is useful for confirming that
structure layout was correct.
I've added two tests:
- A test that checks that structs in top-level code are completed
correctly during struct layout (they are)
- A test that checks that structs defined in function bodies are
cpmpleted correctly during struct layout (currently they are not,
so this is XFAIL).
The second test fails because LookupSameContext()
(ExternalASTMerger.cpp) can't find the struct. This is an issue I
intend to resolve separately.
Differential Revision: https://reviews.llvm.org/D36429
llvm-svn: 310318
Diffstat (limited to 'clang/test/Import')
| -rw-r--r-- | clang/test/Import/local-struct/Inputs/Callee.cpp | 12 | ||||
| -rw-r--r-- | clang/test/Import/local-struct/test.cpp | 8 | ||||
| -rw-r--r-- | clang/test/Import/struct-layout/Inputs/Callee.cpp | 9 | ||||
| -rw-r--r-- | clang/test/Import/struct-layout/test.cpp | 6 |
4 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/Import/local-struct/Inputs/Callee.cpp b/clang/test/Import/local-struct/Inputs/Callee.cpp new file mode 100644 index 00000000000..96cd2f22e49 --- /dev/null +++ b/clang/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/clang/test/Import/local-struct/test.cpp b/clang/test/Import/local-struct/test.cpp new file mode 100644 index 00000000000..8f6e38138f2 --- /dev/null +++ b/clang/test/Import/local-struct/test.cpp @@ -0,0 +1,8 @@ +// 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 } + +void foo() { + return Bar().bar(3, true); +} diff --git a/clang/test/Import/struct-layout/Inputs/Callee.cpp b/clang/test/Import/struct-layout/Inputs/Callee.cpp new file mode 100644 index 00000000000..62422af6c2d --- /dev/null +++ b/clang/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/clang/test/Import/struct-layout/test.cpp b/clang/test/Import/struct-layout/test.cpp new file mode 100644 index 00000000000..698d0609fa0 --- /dev/null +++ b/clang/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); +} |

