diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-05 07:02:11 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-05 07:02:11 +0000 |
commit | ed83ebd77e12e561d435574fbe093a220f270e4e (patch) | |
tree | e3650f69e384d49e014b196a97e44923ccd09407 /clang/lib/AST/ItaniumMangle.cpp | |
parent | 6956e2e68338f62bd19d54b82f0791a8f626c84d (diff) | |
download | bcm5719-llvm-ed83ebd77e12e561d435574fbe093a220f270e4e.tar.gz bcm5719-llvm-ed83ebd77e12e561d435574fbe093a220f270e4e.zip |
PR22465: when performing list-initialization for a class type C, if we see an
initializer of the form {x}, where x is of type C or a type derived from C,
perform *non-list* initialization of the entity from x, but create a
CXXConstructExpr that knows that we used list-initialization syntax.
Plus some fixes to ensure we mangle correctly in this and related cases.
llvm-svn: 228276
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 96d4db75e5a..eae82a28273 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2864,7 +2864,7 @@ recurse: case Expr::CXXConstructExprClass: { const auto *CE = cast<CXXConstructExpr>(E); - if (!CE->isListInitialization()) { + if (!CE->isListInitialization() || CE->isStdInitListInitialization()) { assert( CE->getNumArgs() >= 1 && (CE->getNumArgs() == 1 || isa<CXXDefaultArgExpr>(CE->getArg(1))) && @@ -2890,8 +2890,18 @@ recurse: mangleType(CE->getType()); if (!List && N != 1) Out << '_'; - for (auto *E : CE->arguments()) - mangleExpression(E); + if (CE->isStdInitListInitialization()) { + // We implicitly created a std::initializer_list<T> for the first argument + // of a constructor of type U in an expression of the form U{a, b, c}. + // Strip all the semantic gunk off the initializer list. + auto *SILE = + cast<CXXStdInitializerListExpr>(CE->getArg(0)->IgnoreImplicit()); + auto *ILE = cast<InitListExpr>(SILE->getSubExpr()->IgnoreImplicit()); + mangleInitListElements(ILE); + } else { + for (auto *E : CE->arguments()) + mangleExpression(E); + } if (List || N != 1) Out << 'E'; break; |