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 | 4127b8ef97e5d361fddf9142af61cee106348522 (patch) | |
tree | a9f1d4e8aa5f4dca04d8357867a0e73d7712fe00 /clang/test/CodeGenCXX/static-init-1.cpp | |
parent | a117dd23e9eb9ac77eca31de963dc8ba51aef204 (diff) | |
download | bcm5719-llvm-4127b8ef97e5d361fddf9142af61cee106348522.tar.gz bcm5719-llvm-4127b8ef97e5d361fddf9142af61cee106348522.zip |
Added support for static variables which require
initialization before main. Fixes pr5396.
llvm-svn: 86145
Diffstat (limited to 'clang/test/CodeGenCXX/static-init-1.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/static-init-1.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/static-init-1.cpp b/clang/test/CodeGenCXX/static-init-1.cpp new file mode 100644 index 00000000000..d485d4c9570 --- /dev/null +++ b/clang/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); + |