blob: c49abeb7efea3ec229f77324f300ddb479acaca9 [file] [log] [blame]
Chris Lattner4d150c82009-04-30 06:18:40 +00001// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 &&
Douglas Gregor5f2bfd42009-02-13 00:10:09 +00002
3// FIXME: This test is intentionally trivial, because we can't yet
4// CodeGen anything real in C++.
5struct X { };
6struct Y { };
Anders Carlssonb1d947b2009-03-07 23:57:03 +00007
8// RUN: grep _ZplRK1YRA100_P1X %t | count 1 &&
Douglas Gregor5f2bfd42009-02-13 00:10:09 +00009bool operator+(const Y&, X* (&xs)[100]) { return false; }
10
Anders Carlssonb1d947b2009-03-07 23:57:03 +000011// RUN: grep _Z1f1s %t | count 1 &&
12typedef struct { int a; } s;
13void f(s) { }
14
15// RUN: grep _Z1f1e %t| count 1 &&
16typedef enum { foo } e;
17void f(e) { }
18
Anders Carlsson4843e582009-03-10 17:07:44 +000019// RUN: grep _Z1f1u %t | count 1 &&
Anders Carlssonb1d947b2009-03-07 23:57:03 +000020typedef union { int a; } u;
21void f(u) { }
Anders Carlsson4843e582009-03-10 17:07:44 +000022
Anders Carlsson91e20dd2009-04-02 05:55:18 +000023// RUN: grep _Z1f1x %t | count 1 &&
Anders Carlsson4843e582009-03-10 17:07:44 +000024typedef struct { int a; } x,y;
25void f(y) { }
26
Anders Carlsson91e20dd2009-04-02 05:55:18 +000027// RUN: grep _Z1fv %t | count 1 &&
Anders Carlssonc6c91bc2009-04-01 00:15:23 +000028void f() { }
Anders Carlsson984e0682009-04-01 00:58:25 +000029
Anders Carlsson91e20dd2009-04-02 05:55:18 +000030// RUN: grep _ZN1N1fEv %t | count 1 &&
Anders Carlsson984e0682009-04-01 00:58:25 +000031namespace N { void f() { } }
32
Anders Carlsson91e20dd2009-04-02 05:55:18 +000033// RUN: grep _ZN1N1N1fEv %t | count 1 &&
Anders Carlsson984e0682009-04-01 00:58:25 +000034namespace N { namespace N { void f() { } } }
Anders Carlsson91e20dd2009-04-02 05:55:18 +000035
36// RUN: grep unmangled_function %t | count 1 &&
37extern "C" { namespace N { void unmangled_function() { } } }
38
Anders Carlsson329749c2009-04-02 16:05:20 +000039// RUN: grep unmangled_variable %t | count 1 &&
Anders Carlsson91e20dd2009-04-02 05:55:18 +000040extern "C" { namespace N { int unmangled_variable; } }
41
Anders Carlsson1b42c792009-04-02 16:24:45 +000042// RUN: grep _ZN1N1iE %t | count 1 &&
Anders Carlsson329749c2009-04-02 16:05:20 +000043namespace N { int i; }
Anders Carlsson1b42c792009-04-02 16:24:45 +000044
Anders Carlsson283a0622009-04-13 18:03:33 +000045// RUN: grep _ZZN1N1fEiiE1b %t | count 2 &&
Anders Carlsson1b42c792009-04-02 16:24:45 +000046namespace N { int f(int, int) { static int b; return b; } }
Anders Carlsson283a0622009-04-13 18:03:33 +000047
48// RUN: grep "_ZZN1N1gEvE1a =" %t | count 1 &&
Chris Lattner2df9ced2009-04-30 02:43:43 +000049// RUN: grep "_ZGVZN1N1gEvE1a =" %t | count 1 &&
Anders Carlsson283a0622009-04-13 18:03:33 +000050namespace N { int h(); void g() { static int a = h(); } }
Chris Lattner2df9ced2009-04-30 02:43:43 +000051
52// RUN: grep "_Z1fno" %t | count 1
53void f(__int128_t, __uint128_t) { }