[cfe-commits] r151462 - in /cfe/trunk: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle-exprs.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Sat Feb 25 14:59:28 PST 2012
Author: cornedbee
Date: Sat Feb 25 16:59:28 2012
New Revision: 151462
URL: http://llvm.org/viewvc/llvm-project?rev=151462&view=rev
Log:
Richard Smith pointed out that there already is a proposal for init list mangling.
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=151462&r1=151461&r2=151462&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Sat Feb 25 16:59:28 2012
@@ -2361,7 +2361,6 @@
llvm_unreachable("unexpected statement kind");
// FIXME: invent manglings for all these.
- case Expr::InitListExprClass:
case Expr::BlockExprClass:
case Expr::CXXPseudoDestructorExprClass:
case Expr::ChooseExprClass:
@@ -2418,6 +2417,16 @@
case Expr::OpaqueValueExprClass:
llvm_unreachable("cannot mangle opaque value; mangling wrong thing?");
+ case Expr::InitListExprClass: {
+ // Proposal by Jason Merrill, 2012-01-03
+ Out << "il";
+ const InitListExpr *InitList = cast<InitListExpr>(E);
+ for (unsigned i = 0, e = InitList->getNumInits(); i != e; ++i)
+ mangleExpression(InitList->getInit(i));
+ Out << "E";
+ break;
+ }
+
case Expr::CXXDefaultArgExprClass:
mangleExpression(cast<CXXDefaultArgExpr>(E)->getExpr(), Arity);
break;
@@ -2463,12 +2472,9 @@
Out << '_';
mangleType(New->getAllocatedType());
if (New->hasInitializer()) {
- // <initializer> is 'pi <expression>* E' in the current ABI for
- // parenthesized initializers, but braced initializers are unspecified.
- // We use 'bl <expression>* E' for "braced list". "bi" is too easy to
- // confuse.
+ // Proposal by Jason Merrill, 2012-01-03
if (New->getInitializationStyle() == CXXNewExpr::ListInit)
- Out << "bl";
+ Out << "il";
else
Out << "pi";
const Expr *Init = New->getInitializer();
@@ -2483,7 +2489,7 @@
mangleExpression(PLE->getExpr(i));
} else if (New->getInitializationStyle() == CXXNewExpr::ListInit &&
isa<InitListExpr>(Init)) {
- // Only take ParenListExprs apart for list-initialization.
+ // Only take InitListExprs apart for list-initialization.
const InitListExpr *InitList = cast<InitListExpr>(Init);
for (unsigned i = 0, e = InitList->getNumInits(); i != e; ++i)
mangleExpression(InitList->getInit(i));
@@ -2552,7 +2558,11 @@
const CXXConstructExpr *CE = cast<CXXConstructExpr>(E);
unsigned N = CE->getNumArgs();
- Out << "cv";
+ // Proposal by Jason Merrill, 2012-01-03
+ if (CE->isListInitialization())
+ Out << "tl";
+ else
+ Out << "cv";
mangleType(CE->getType());
if (N != 1) Out << '_';
for (unsigned I = 0; I != N; ++I) mangleExpression(CE->getArg(I));
Modified: cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp?rev=151462&r1=151461&r2=151462&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp Sat Feb 25 16:59:28 2012
@@ -168,7 +168,6 @@
namespace test4 {
struct X {
X(int);
- X(std::initializer_list<int>);
};
template <typename T>
@@ -186,9 +185,9 @@
// CHECK: void @_ZN5test43tf1INS_1XEEEvDTnw_T_piLi1EEE
template void tf1<X>(X*);
- // FIXME: Need mangling for braced initializers
- //template void tf2<X>(X*);
+ // CHECK: void @_ZN5test43tf2INS_1XEEEvDTnw_T_piilLi1EEEE
+ template void tf2<X>(X*);
- // CHECK: void @_ZN5test43tf3INS_1XEEEvDTnw_T_blLi1EEE
+ // CHECK: void @_ZN5test43tf3INS_1XEEEvDTnw_T_ilLi1EEE
template void tf3<X>(X*);
}
More information about the cfe-commits
mailing list