summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-06-30 18:36:34 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-06-30 18:36:34 +0000
commitcc4bb63351e527682d13a0b06a3ff3e32eaa1c37 (patch)
treed4262d93e989690d06469648267d7ab7d3f3a68f /clang/lib/Sema/SemaExpr.cpp
parentfbac64d678060084fdce35371783ad9edd7264f3 (diff)
downloadbcm5719-llvm-cc4bb63351e527682d13a0b06a3ff3e32eaa1c37.tar.gz
bcm5719-llvm-cc4bb63351e527682d13a0b06a3ff3e32eaa1c37.zip
PR28373: fix crash-on-invalid if the condition of an if-statement fails typo-correction.
llvm-svn: 274260
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 56cf5d4fd37..cc2a11fccfb 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -14394,7 +14394,12 @@ Sema::ConditionResult Sema::ActOnCondition(Scope *S, SourceLocation Loc,
if (Cond.isInvalid())
return ConditionError();
- return ConditionResult(*this, nullptr, MakeFullExpr(Cond.get(), Loc),
+ // FIXME: FullExprArg doesn't have an invalid bit, so check nullness instead.
+ FullExprArg FullExpr = MakeFullExpr(Cond.get(), Loc);
+ if (!FullExpr.get())
+ return ConditionError();
+
+ return ConditionResult(*this, nullptr, FullExpr,
CK == ConditionKind::ConstexprIf);
}
OpenPOWER on IntegriCloud