diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-05 18:03:03 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-05 18:03:03 +0000 |
commit | 393c247fe025ccb5f914e37e948192ea86faef8c (patch) | |
tree | ccd2ca710411f416b3dd51bd6e4765245133aa2c /test/CodeGenCXX/static-init-1.cpp | |
parent | 9c4b838782132ec670fd7e48d1a7a7fd433fed06 (diff) |
Added support for static variables which require
initialization before main. Fixes pr5396.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/static-init-1.cpp')
-rw-r--r-- | test/CodeGenCXX/static-init-1.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGenCXX/static-init-1.cpp b/test/CodeGenCXX/static-init-1.cpp new file mode 100644 index 0000000000..d485d4c957 --- /dev/null +++ b/test/CodeGenCXX/static-init-1.cpp @@ -0,0 +1,23 @@ +// RUN: clang-cc -triple=x86_64-apple-darwin9 -emit-llvm %s -o %t && +// RUN: grep "call i32 @_Z5func1i" %t | count 3 + +extern "C" int printf(...); + +static int count; + +int func2(int c) { return printf("loading the func2(%d)\n", c); }; +int func1(int c) { return printf("loading the func1(%d)\n", c); } + +static int loader_1 = func1(++count); + +int loader_2 = func2(++count); + +static int loader_3 = func1(++count); + + +int main() {} + +int loader_4 = func2(++count); +static int loader_5 = func1(++count); +int loader_6 = func2(++count); + |