aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-16 05:13:48 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-16 05:13:48 +0000
commit9abf2aedae7538cfd85f3ff0898a6d14385c8e36 (patch)
treea173ddcd8f0aa57278b894e1c9917e79bb556e0f /lib/Sema/SemaDecl.cpp
parent2d46eb21eb2c904831b0e9f75ab3523384c70e66 (diff)
AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and create the CXXExprWithTemporaries before setting the initializer on the VarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index bf1dd91f74..b672d0501a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2996,8 +2996,8 @@ bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) {
return true;
}
-void Sema::AddInitializerToDecl(DeclPtrTy dcl, FullExprArg init) {
- AddInitializerToDecl(dcl, init.release(), /*DirectInit=*/false);
+void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init) {
+ AddInitializerToDecl(dcl, move(init), /*DirectInit=*/false);
}
/// AddInitializerToDecl - Adds the initializer Init to the
@@ -3160,6 +3160,8 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
Init->setType(DclT);
}
+ Init = MaybeCreateCXXExprWithTemporaries(Init,
+ /*ShouldDestroyTemporaries=*/true);
// Attach the initializer to the decl.
VDecl->setInit(Context, Init);