summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-07 00:41:46 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-07 00:41:46 +0000
commita40433a33ae83fa0d4797123b082dd5658acfa00 (patch)
tree7949d3c554497cd1c15db7cf174b191373567bed /clang/lib/Sema/SemaDecl.cpp
parent52700c348b4cee9c328dd70d1fb74226a2942cc0 (diff)
downloadbcm5719-llvm-a40433a33ae83fa0d4797123b082dd5658acfa00.tar.gz
bcm5719-llvm-a40433a33ae83fa0d4797123b082dd5658acfa00.zip
Use Sema::MaybeCreateExprWithCleanups() only after we've checked for a NULL/invalid expression
llvm-svn: 121081
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index aa2e2a53d64..88512af8b3c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3037,7 +3037,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
SourceLocation(),
Owned(E));
if (!Res.isInvalid()) {
- Res = MaybeCreateExprWithCleanups(Res.get());
+ Res = MaybeCreateExprWithCleanups(Res);
Expr *Init = Res.takeAs<Expr>();
Context.setBlockVarCopyInits(NewVD, Init);
}
@@ -4805,7 +4805,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
if (Init.isInvalid())
Var->setInvalidDecl();
else if (Init.get()) {
- Var->setInit(MaybeCreateExprWithCleanups(Init.takeAs<Expr>()));
+ Var->setInit(MaybeCreateExprWithCleanups(Init.get()));
if (getLangOptions().CPlusPlus && !Var->isInvalidDecl() &&
Var->hasGlobalStorage() && !Var->isStaticLocal() &&
OpenPOWER on IntegriCloud