diff options
Diffstat (limited to 'clang/test/CodeGenCXX/dso-local-executable.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/dso-local-executable.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/dso-local-executable.cpp b/clang/test/CodeGenCXX/dso-local-executable.cpp new file mode 100644 index 00000000000..cd8a0a72973 --- /dev/null +++ b/clang/test/CodeGenCXX/dso-local-executable.cpp @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -mrelocation-model static -emit-llvm %s -o - | FileCheck --check-prefix=STATIC %s + +// STATIC: @_ZTV1C = linkonce_odr dso_local unnamed_addr constant +// STATIC: @_ZTS1C = linkonce_odr dso_local constant +// STATIC: @_ZTI1C = linkonce_odr dso_local constant +// STATIC: @_ZZ14useStaticLocalvE3obj = linkonce_odr dso_local global +// STATIC: @_ZGVZN5guard1gEvE1a = linkonce_odr dso_local global +// STATIC: define dso_local void @_ZN1CC2Ev( +// STATIC: define dso_local void @_ZN1CC1Ev( +// STATIC: define linkonce_odr dso_local void @_ZN1C3fooEv( + +struct C { + C(); + virtual void foo() {} +}; +C::C() {} + +struct HasVTable { + virtual void f(); +}; +inline HasVTable &useStaticLocal() { + static HasVTable obj; + return obj; +} +void useit() { + useStaticLocal(); +} + +namespace guard { +int f(); +inline int g() { + static int a = f(); + return a; +} +int h() { + return g(); +} +} // namespace guard |