summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-25 01:12:44 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-25 01:12:44 +0000
commitc6abd96bffa1d5743e985235863bc75c3ed58036 (patch)
tree4bd0a43a328adab0c1916f86cb260a59ddf8e119 /clang/lib/Sema/TreeTransform.h
parentd86c901f29b673161a8728ad853abff262cceb42 (diff)
downloadbcm5719-llvm-c6abd96bffa1d5743e985235863bc75c3ed58036.tar.gz
bcm5719-llvm-c6abd96bffa1d5743e985235863bc75c3ed58036.zip
PR20445: Properly transform the initializer in a CXXNewExpr rather than running
it through the normal TreeTransform logic for Exprs (which will strip off implicit parts of the initialization and never re-create them). llvm-svn: 213913
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index a098b537bec..8e21b56bb78 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -344,7 +344,7 @@ public:
/// TransformExpr or TransformExprs.
///
/// \returns the transformed initializer.
- ExprResult TransformInitializer(Expr *Init, bool CXXDirectInit);
+ ExprResult TransformInitializer(Expr *Init, bool NotCopyInit);
/// \brief Transform the given list of expressions.
///
@@ -2858,7 +2858,7 @@ ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) {
template<typename Derived>
ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
- bool CXXDirectInit) {
+ bool NotCopyInit) {
// Initializers are instantiated like expressions, except that various outer
// layers are stripped.
if (!Init)
@@ -2878,13 +2878,13 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
if (CXXStdInitializerListExpr *ILE =
dyn_cast<CXXStdInitializerListExpr>(Init))
- return TransformInitializer(ILE->getSubExpr(), CXXDirectInit);
+ return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
- // If this is not a direct-initializer, we only need to reconstruct
+ // If this is copy-initialization, we only need to reconstruct
// InitListExprs. Other forms of copy-initialization will be a no-op if
// the initializer is already the right type.
CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init);
- if (!CXXDirectInit && !(Construct && Construct->isListInitialization()))
+ if (!NotCopyInit && !(Construct && Construct->isListInitialization()))
return getDerived().TransformExpr(Init);
// Revert value-initialization back to empty parens.
@@ -2907,12 +2907,12 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
// If the initialization implicitly converted an initializer list to a
// std::initializer_list object, unwrap the std::initializer_list too.
if (Construct && Construct->isStdInitListInitialization())
- return TransformInitializer(Construct->getArg(0), CXXDirectInit);
+ return TransformInitializer(Construct->getArg(0), NotCopyInit);
SmallVector<Expr*, 8> NewArgs;
bool ArgChanged = false;
if (getDerived().TransformExprs(Construct->getArgs(), Construct->getNumArgs(),
- /*IsCall*/true, NewArgs, &ArgChanged))
+ /*IsCall*/true, NewArgs, &ArgChanged))
return ExprError();
// If this was list initialization, revert to list form.
@@ -8179,7 +8179,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
Expr *OldInit = E->getInitializer();
ExprResult NewInit;
if (OldInit)
- NewInit = getDerived().TransformExpr(OldInit);
+ NewInit = getDerived().TransformInitializer(OldInit, true);
if (NewInit.isInvalid())
return ExprError();
OpenPOWER on IntegriCloud