Fix the source ranges of ill-formed precedence groups.

rdar://problem/27662943
This commit is contained in:
John McCall
2016-08-05 12:15:57 -07:00
parent e80966547b
commit 7ad3e838ba
2 changed files with 12 additions and 0 deletions

View File

@@ -5684,6 +5684,11 @@ Parser::parseDeclPrecedenceGroup(ParseDeclOptions flags,
return result;
};
auto createInvalid = [&] {
// Use the last consumed token location as the rbrace to satisfy
// the AST invariant about a decl's source range including all of
// its components.
if (!rbraceLoc.isValid()) rbraceLoc = PreviousLoc;
auto result = create();
result->setInvalid();
return makeParserErrorResult(result);