2010-08-13 16:35:10 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - > %t
|
|
|
|
// RUN: FileCheck %s -check-prefix=1 < %t
|
|
|
|
// RUN: FileCheck %s -check-prefix=2 < %t
|
2009-10-01 08:25:31 +08:00
|
|
|
|
2010-01-26 14:15:16 +08:00
|
|
|
int f();
|
|
|
|
|
2009-10-01 08:25:31 +08:00
|
|
|
namespace {
|
2010-08-13 16:35:10 +08:00
|
|
|
// CHECK-1: @_ZN12_GLOBAL__N_11bE = internal global i32 0
|
|
|
|
// CHECK-1: @_ZN12_GLOBAL__N_1L1cE = internal global i32 0
|
|
|
|
// CHECK-1: @_ZN12_GLOBAL__N_11D1dE = internal global i32 0
|
|
|
|
// CHECK-1: @_ZN12_GLOBAL__N_11aE = internal global i32 0
|
2009-10-01 08:25:31 +08:00
|
|
|
int a = 0;
|
|
|
|
|
2010-01-26 14:15:16 +08:00
|
|
|
int b = f();
|
|
|
|
|
|
|
|
static int c = f();
|
|
|
|
|
|
|
|
class D {
|
|
|
|
static int d;
|
|
|
|
};
|
|
|
|
|
|
|
|
int D::d = f();
|
|
|
|
|
2010-05-07 06:18:21 +08:00
|
|
|
// Check for generation of a VTT with internal linkage
|
2010-08-13 16:35:10 +08:00
|
|
|
// CHECK-1: @_ZTSN12_GLOBAL__N_11X1EE = internal constant
|
2010-05-07 06:18:21 +08:00
|
|
|
struct X {
|
|
|
|
struct EBase { };
|
|
|
|
struct E : public virtual EBase { virtual ~E() {} };
|
|
|
|
};
|
|
|
|
|
2010-08-13 16:35:10 +08:00
|
|
|
// CHECK-1: define internal i32 @_ZN12_GLOBAL__N_13fooEv()
|
2009-10-01 08:25:31 +08:00
|
|
|
int foo() {
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2010-08-13 16:35:10 +08:00
|
|
|
// CHECK-1: define internal i32 @_ZN12_GLOBAL__N_11A3fooEv()
|
2009-10-01 08:25:31 +08:00
|
|
|
namespace A {
|
|
|
|
int foo() {
|
|
|
|
return 45;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int concrete() {
|
|
|
|
return a + foo() + A::foo();
|
|
|
|
}
|
2010-05-07 06:18:21 +08:00
|
|
|
|
|
|
|
void test_XE() { throw X::E(); }
|
2010-08-13 16:35:10 +08:00
|
|
|
|
|
|
|
// Miscompile on llvmc plugins.
|
|
|
|
namespace test2 {
|
|
|
|
struct A {
|
|
|
|
template <class T> struct B {
|
|
|
|
static void foo() {}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
namespace {
|
|
|
|
struct C;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-2: define void @_ZN5test24testEv()
|
|
|
|
// CHECK-2: call void @_ZN5test21A1BINS_12_GLOBAL__N_11CEE3fooEv()
|
|
|
|
void test() {
|
|
|
|
A::B<C>::foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-2: define internal void @_ZN5test21A1BINS_12_GLOBAL__N_11CEE3fooEv()
|
|
|
|
}
|