2009-04-30 14:18:40 +08:00
|
|
|
// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 &&
|
2009-02-13 08:10:09 +08:00
|
|
|
|
|
|
|
// FIXME: This test is intentionally trivial, because we can't yet
|
|
|
|
// CodeGen anything real in C++.
|
|
|
|
struct X { };
|
|
|
|
struct Y { };
|
2009-03-08 07:57:03 +08:00
|
|
|
|
|
|
|
// RUN: grep _ZplRK1YRA100_P1X %t | count 1 &&
|
2009-02-13 08:10:09 +08:00
|
|
|
bool operator+(const Y&, X* (&xs)[100]) { return false; }
|
|
|
|
|
2009-03-08 07:57:03 +08:00
|
|
|
// RUN: grep _Z1f1s %t | count 1 &&
|
|
|
|
typedef struct { int a; } s;
|
|
|
|
void f(s) { }
|
|
|
|
|
|
|
|
// RUN: grep _Z1f1e %t| count 1 &&
|
|
|
|
typedef enum { foo } e;
|
|
|
|
void f(e) { }
|
|
|
|
|
2009-03-11 01:07:44 +08:00
|
|
|
// RUN: grep _Z1f1u %t | count 1 &&
|
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-04-02 13:55:18 +08:00
|
|
|
// RUN: grep _Z1f1x %t | count 1 &&
|
2009-03-11 01:07:44 +08:00
|
|
|
typedef struct { int a; } x,y;
|
|
|
|
void f(y) { }
|
|
|
|
|
2009-04-02 13:55:18 +08:00
|
|
|
// RUN: grep _Z1fv %t | count 1 &&
|
2009-04-01 08:15:23 +08:00
|
|
|
void f() { }
|
2009-04-01 08:58:25 +08:00
|
|
|
|
2009-04-02 13:55:18 +08:00
|
|
|
// RUN: grep _ZN1N1fEv %t | count 1 &&
|
2009-04-01 08:58:25 +08:00
|
|
|
namespace N { void f() { } }
|
|
|
|
|
2009-04-02 13:55:18 +08:00
|
|
|
// RUN: grep _ZN1N1N1fEv %t | count 1 &&
|
2009-04-01 08:58:25 +08:00
|
|
|
namespace N { namespace N { void f() { } } }
|
2009-04-02 13:55:18 +08:00
|
|
|
|
|
|
|
// RUN: grep unmangled_function %t | count 1 &&
|
|
|
|
extern "C" { namespace N { void unmangled_function() { } } }
|
|
|
|
|
2009-04-03 00:05:20 +08:00
|
|
|
// RUN: grep unmangled_variable %t | count 1 &&
|
2009-04-02 13:55:18 +08:00
|
|
|
extern "C" { namespace N { int unmangled_variable; } }
|
|
|
|
|
2009-04-03 00:24:45 +08:00
|
|
|
// RUN: grep _ZN1N1iE %t | count 1 &&
|
2009-04-03 00:05:20 +08:00
|
|
|
namespace N { int i; }
|
2009-04-03 00:24:45 +08:00
|
|
|
|
2009-04-14 02:03:33 +08:00
|
|
|
// RUN: grep _ZZN1N1fEiiE1b %t | count 2 &&
|
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
|
|
|
|
|
|
|
// RUN: grep "_ZZN1N1gEvE1a =" %t | count 1 &&
|
2009-04-30 10:43:43 +08:00
|
|
|
// RUN: grep "_ZGVZN1N1gEvE1a =" %t | count 1 &&
|
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-05-16 00:09:15 +08:00
|
|
|
// RUN: grep "_Z1fno" %t | count 1 &&
|
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 {};
|
|
|
|
|
|
|
|
// RUN: grep "_Z1f2S1IiE" %t | count 1 &&
|
|
|
|
void f(S1<int>) {}
|
|
|
|
|
|
|
|
// RUN: grep "_Z1f2S1IdE" %t | count 1 &&
|
|
|
|
void f(S1<double>) {}
|
|
|
|
|
|
|
|
template <int N> struct S2 {};
|
|
|
|
// RUN: grep "_Z1f2S2ILi100EE" %t | count 1 &&
|
|
|
|
void f(S2<100>) {}
|
|
|
|
|
|
|
|
// RUN: grep "_Z1f2S2ILin100EE" %t | count 1 &&
|
|
|
|
void f(S2<-100>) {}
|
|
|
|
|
|
|
|
template <bool B> struct S3 {};
|
|
|
|
|
|
|
|
// RUN: grep "_Z1f2S3ILb1EE" %t | count 1 &&
|
|
|
|
void f(S3<true>) {}
|
|
|
|
|
|
|
|
// RUN: grep "_Z1f2S3ILb0EE" %t | count 1 &&
|
|
|
|
void f(S3<false>) {}
|
|
|
|
|
|
|
|
// RUN: grep "_Z2f22S3ILb1EE" %t | count 1
|
|
|
|
void f2(S3<100>) {}
|