summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-exprs.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2012-02-25 20:51:07 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2012-02-25 20:51:07 +0000
commitdadc06494d40bed5a60057b7475dd0291f3693e7 (patch)
treeaa06e3b4e4c974b6e3a0c31abd1ef7aba45edb2b /clang/test/CodeGenCXX/mangle-exprs.cpp
parent4c5c8ccf40295da236405aa89f9f5d06fc15ae28 (diff)
downloadbcm5719-llvm-dadc06494d40bed5a60057b7475dd0291f3693e7.tar.gz
bcm5719-llvm-dadc06494d40bed5a60057b7475dd0291f3693e7.zip
Better mangling for new-expressions. Also, although we can't mangle arbitrary initializer lists yet (we will need this), turn the crash into a controlled error.
llvm-svn: 151455
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-exprs.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-exprs.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-exprs.cpp b/clang/test/CodeGenCXX/mangle-exprs.cpp
index bad564f80f1..338cff75155 100644
--- a/clang/test/CodeGenCXX/mangle-exprs.cpp
+++ b/clang/test/CodeGenCXX/mangle-exprs.cpp
@@ -1,5 +1,37 @@
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+namespace std {
+ typedef decltype(sizeof(int)) size_t;
+
+ // libc++'s implementation
+ template <class _E>
+ class initializer_list
+ {
+ const _E* __begin_;
+ size_t __size_;
+
+ initializer_list(const _E* __b, size_t __s)
+ : __begin_(__b),
+ __size_(__s)
+ {}
+
+ public:
+ typedef _E value_type;
+ typedef const _E& reference;
+ typedef const _E& const_reference;
+ typedef size_t size_type;
+
+ typedef const _E* iterator;
+ typedef const _E* const_iterator;
+
+ initializer_list() : __begin_(nullptr), __size_(0) {}
+
+ size_t size() const {return __size_;}
+ const _E* begin() const {return __begin_;}
+ const _E* end() const {return __begin_ + __size_;}
+ };
+}
+
template < bool condition, typename T = void >
struct enable_if { typedef T type; };
@@ -132,3 +164,31 @@ namespace test3 {
a(x, &X::member, ip);
}
}
+
+namespace test4 {
+ struct X {
+ X(int);
+ X(std::initializer_list<int>);
+ };
+
+ template <typename T>
+ void tf1(decltype(new T(1)) p)
+ {}
+
+ template <typename T>
+ void tf2(decltype(new T({1})) p)
+ {}
+
+ template <typename T>
+ void tf3(decltype(new T{1}) p)
+ {}
+
+ // CHECK: void @_ZN5test43tf1INS_1XEEEvDTnw_T_piLi1EEE
+ template void tf1<X>(X*);
+
+ // FIXME: Need mangling for braced initializers
+ //template void tf2<X>(X*);
+
+ // CHECK: void @_ZN5test43tf3INS_1XEEEvDTnw_T_blLi1EEE
+ template void tf3<X>(X*);
+}
OpenPOWER on IntegriCloud