summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorKaelyn Takata <rikka@google.com>2014-11-11 23:26:58 +0000
committerKaelyn Takata <rikka@google.com>2014-11-11 23:26:58 +0000
commit2e764b83aad54c5e557a64a9507f35cad90edead (patch)
tree58b4dea479d1c241b41dd04281dd68c7fa125d2a /clang/lib/Sema/SemaExpr.cpp
parent49d84328d998ea17ba7563fa77db25cfd58f4d43 (diff)
downloadbcm5719-llvm-2e764b83aad54c5e557a64a9507f35cad90edead.tar.gz
bcm5719-llvm-2e764b83aad54c5e557a64a9507f35cad90edead.zip
Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo. Includes a needed fix for non-C++ code to not choke on TypoExprs (which also resolves a TODO from r220698). llvm-svn: 221736
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 37a08cfb081..dda9d88abac 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8618,6 +8618,17 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
QualType CompoundType) {
assert(!LHSExpr->hasPlaceholderType(BuiltinType::PseudoObject));
+ if (!getLangOpts().CPlusPlus) {
+ // C cannot handle TypoExpr nodes on either side of n assignment because it
+ // doesn't handle dependent types properly, so make sure any TypoExprs have
+ // been dealt with before checking the operands.
+ ExprResult Res = CorrectDelayedTyposInExpr(LHSExpr);
+ Expr *NewLHS = Res.isInvalid() ? LHSExpr : Res.get();
+ Res = CorrectDelayedTyposInExpr(RHS);
+ if (!Res.isInvalid() && (Res.get() != RHS.get() || NewLHS != LHSExpr))
+ return CheckAssignmentOperands(NewLHS, Res, Loc, CompoundType);
+ }
+
// Verify that LHS is a modifiable lvalue, and emit error if not.
if (CheckForModifiableLvalue(LHSExpr, Loc, *this))
return QualType();
OpenPOWER on IntegriCloud