2009-09-17 11:46:43 +08:00
|
|
|
// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
2009-02-13 08:10:09 +08:00
|
|
|
|
|
|
|
struct X { };
|
|
|
|
struct Y { };
|
2009-03-08 07:57:03 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: @unmangled_variable = global
|
|
|
|
// CHECK: @_ZN1N1iE = global
|
|
|
|
// CHECK: @_ZZN1N1fEiiE1b = internal global
|
|
|
|
// CHECK: @_ZZN1N1gEvE1a = internal global
|
|
|
|
// CHECK: @_ZGVZN1N1gEvE1a = internal global
|
|
|
|
|
|
|
|
// CHECK: define zeroext i1 @_ZplRK1YRA100_P1X
|
2009-02-13 08:10:09 +08:00
|
|
|
bool operator+(const Y&, X* (&xs)[100]) { return false; }
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f1s
|
2009-03-08 07:57:03 +08:00
|
|
|
typedef struct { int a; } s;
|
|
|
|
void f(s) { }
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f1e
|
2009-03-08 07:57:03 +08:00
|
|
|
typedef enum { foo } e;
|
|
|
|
void f(e) { }
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f1u
|
2009-03-08 07:57:03 +08:00
|
|
|
typedef union { int a; } u;
|
|
|
|
void f(u) { }
|
2009-03-11 01:07:44 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f1x
|
2009-03-11 01:07:44 +08:00
|
|
|
typedef struct { int a; } x,y;
|
|
|
|
void f(y) { }
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1fv
|
2009-04-01 08:15:23 +08:00
|
|
|
void f() { }
|
2009-04-01 08:58:25 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_ZN1N1fEv
|
2009-04-01 08:58:25 +08:00
|
|
|
namespace N { void f() { } }
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_ZN1N1N1fEv
|
2009-04-01 08:58:25 +08:00
|
|
|
namespace N { namespace N { void f() { } } }
|
2009-04-02 13:55:18 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @unmangled_function
|
2009-04-02 13:55:18 +08:00
|
|
|
extern "C" { namespace N { void unmangled_function() { } } }
|
|
|
|
|
2009-05-17 05:02:39 +08:00
|
|
|
extern "C" { namespace N { int unmangled_variable = 10; } }
|
2009-04-02 13:55:18 +08:00
|
|
|
|
2009-04-03 00:05:20 +08:00
|
|
|
namespace N { int i; }
|
2009-04-03 00:24:45 +08:00
|
|
|
|
|
|
|
namespace N { int f(int, int) { static int b; return b; } }
|
2009-04-14 02:03:33 +08:00
|
|
|
|
|
|
|
namespace N { int h(); void g() { static int a = h(); } }
|
2009-04-30 10:43:43 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1fno
|
2009-04-30 10:43:43 +08:00
|
|
|
void f(__int128_t, __uint128_t) { }
|
2009-05-16 00:09:15 +08:00
|
|
|
|
|
|
|
template <typename T> struct S1 {};
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S1IiE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S1<int>) {}
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S1IdE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S1<double>) {}
|
|
|
|
|
|
|
|
template <int N> struct S2 {};
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S2ILi100EE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S2<100>) {}
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S2ILin100EE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S2<-100>) {}
|
|
|
|
|
|
|
|
template <bool B> struct S3 {};
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S3ILb1EE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S3<true>) {}
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1f2S3ILb0EE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f(S3<false>) {}
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z2f22S3ILb1EE
|
2009-05-16 00:09:15 +08:00
|
|
|
void f2(S3<100>) {}
|
2009-05-18 01:41:20 +08:00
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1fM1SKFvvE
|
2009-05-18 01:41:20 +08:00
|
|
|
void f(void (S::*)() const) {}
|
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1fM1SFvvE
|
2009-05-18 01:41:20 +08:00
|
|
|
void f(void (S::*)()) {}
|
2009-09-17 07:53:19 +08:00
|
|
|
|
2009-09-17 11:46:43 +08:00
|
|
|
// CHECK: define void @_Z1fi
|
2009-09-17 07:53:19 +08:00
|
|
|
void f(const int) { }
|
|
|
|
|
2009-09-17 12:02:31 +08:00
|
|
|
template<typename T, typename U> void ft1(U u, T t) { }
|
|
|
|
|
|
|
|
template<typename T> void ft2(T t, void (*)(T), void (*)(T)) { }
|
2009-09-17 11:46:43 +08:00
|
|
|
|
|
|
|
void g() {
|
2009-09-17 12:02:31 +08:00
|
|
|
// CHECK: @_Z3ft1IidEvT0_T_
|
|
|
|
ft1<int, double>(1, 0);
|
|
|
|
|
|
|
|
// CHECK: @_Z3ft2IcEvT_PFvS0_ES2_
|
|
|
|
ft2<char>(1, 0, 0);
|
2009-09-17 11:46:43 +08:00
|
|
|
}
|
2009-09-18 00:12:20 +08:00
|
|
|
|
|
|
|
extern "C++" {
|
|
|
|
// CHECK: @_Z1hv
|
|
|
|
void h() { }
|
|
|
|
}
|