summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/dso-local-executable.cpp
blob: cd8a0a7297330c37552d0e46df1b144cd605b634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
OpenPOWER on IntegriCloud