diff options
| author | Kaelyn Takata <rikka@google.com> | 2014-11-20 22:06:40 +0000 |
|---|---|---|
| committer | Kaelyn Takata <rikka@google.com> | 2014-11-20 22:06:40 +0000 |
| commit | b16e632c64666bfab88518b369ecaab989a4915d (patch) | |
| tree | 6eaba0dc0d1b23be2565cb80e4e7e173c7cdbef5 /clang/lib/Parse/ParseStmt.cpp | |
| parent | 6f71ce2e212df2d0b834bf71ad128ea95508adbe (diff) | |
| download | bcm5719-llvm-b16e632c64666bfab88518b369ecaab989a4915d.tar.gz bcm5719-llvm-b16e632c64666bfab88518b369ecaab989a4915d.zip | |
Wire up delayed typo correction to DiagnoseEmptyLookup and set up
Sema::ActOnIdExpression to use the new functionality.
Among other things, this allows recovery in several cases where it
wasn't possible before (e.g. correcting a mistyped static_cast<>).
llvm-svn: 222464
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 3bf66c3f2e3..1bfce60a3bf 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -642,6 +642,11 @@ StmtResult Parser::ParseCaseStatement(bool MissingCase, ExprResult Expr) { ExprResult LHS; if (!MissingCase) { LHS = ParseConstantExpression(); + if (!getLangOpts().CPlusPlus11) { + LHS = Actions.CorrectDelayedTyposInExpr(LHS, [this](class Expr *E) { + return Actions.VerifyIntegerConstantExpression(E); + }); + } if (LHS.isInvalid()) { // If constant-expression is parsed unsuccessfully, recover by skipping // current case statement (moving to the colon that ends it). @@ -1562,7 +1567,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) { } } else { ProhibitAttributes(attrs); - Value = ParseExpression(); + Value = Actions.CorrectDelayedTyposInExpr(ParseExpression()); ForEach = isTokIdentifier_in(); |

