diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-20 21:52:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-20 21:52:32 +0000 |
commit | 8b533d97e0683a0c87096b95927a2e9ce02243d4 (patch) | |
tree | 7d5410b9c89d4fde235fe52eb592867cc579262c /lib/Parse/ParseStmt.cpp | |
parent | cb5336fa5985a02298aeccf473257c0fcd6b89b4 (diff) |
If the range in a for range statement doesn't have a viable begin/end function,
but can be dereferenced to form an expression which does have viable begin/end
functions, then typo-correct the range, even if something else goes wrong with
the statement (such as inaccessible begin/end or the wrong type of loop
variable).
In order to ensure we recover correctly and produce any followup diagnostics in
this case, redo semantic analysis on the for-range statement outside of the
diagnostic trap, after issuing the typo-correction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index f58f90d56c..db6b3d48f3 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1441,7 +1441,8 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) { ForRangeStmt = Actions.ActOnCXXForRangeStmt(ForLoc, FirstPart.take(), ForRangeInit.ColonLoc, ForRangeInit.RangeExpr.get(), - T.getCloseLocation(), true); + T.getCloseLocation(), + Sema::BFRK_Build); // Similarly, we need to do the semantic analysis for a for-range |