diff options
author | Lang Hames <lhames@gmail.com> | 2024-11-21 18:14:10 +1100 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2024-11-21 18:20:43 +1100 |
commit | 7c0786363e6b14e05a868cfe7614074cf742e7cc (patch) | |
tree | ca33d7307cbd7fd43f99ae52839df7a232b3bc41 | |
parent | 476b208e0115e766605e9f850982996a1d51c287 (diff) | |
download | llvm-7c0786363e6b14e05a868cfe7614074cf742e7cc.zip llvm-7c0786363e6b14e05a868cfe7614074cf742e7cc.tar.gz llvm-7c0786363e6b14e05a868cfe7614074cf742e7cc.tar.bz2 |
[ORC-RT] Test basic C++ static initialization support in the ORC runtime.
This tests that a simple C++ static initializer works as expected.
Compared to the architecture specific, assembly level regression tests for the
ORC runtime; this test is expected to catch cases where the compiler adopts
some new MachO feature that the ORC runtime does not yet support (e.g. a new
initializer section).
-rw-r--r-- | compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp new file mode 100644 index 0000000..c3c9cad --- /dev/null +++ b/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp @@ -0,0 +1,17 @@ +// RUN: %clangxx -c -o %t %s +// RUN: %llvm_jitlink %t +// +// REQUIRES: system-darwin && host-arch-compatible + +static int x = 1; + +class Init { +public: + Init() { x = 0; } +}; + +static Init I; + +int main(int argc, char *argv[]) { + return x; +} |