summaryrefslogtreecommitdiffstats
path: root/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
commitfafd75257dc5ff0e8a682aa822bb0e0abeb287e0 (patch)
tree333d2d71542870e149be0615904f651e6e27e56f /lib/Sema/SemaExpr.cpp
parent1fb78b742be35cea97512b7e5e1233e57b8d1434 (diff)
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 37a08cfb08..dda9d88aba 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/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();