Improve recovery when a comma is missing between enumerators in an
enumeration definition. Fixes <rdar://problem/7159693>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113201 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 6a63986..67d4985 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1737,11 +1737,11 @@
break;
// If the next token looks like a base or member initializer, assume that
// we're just missing a comma.
- else if (Tok.is(tok::identifier) || Tok.is(tok::coloncolon))
- Diag(Tok.getLocation(), diag::err_ctor_init_missing_comma)
- << FixItHint::CreateInsertion(PP.getLocForEndOfToken(PrevTokLocation),
- ", ");
- else {
+ else if (Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) {
+ SourceLocation Loc = PP.getLocForEndOfToken(PrevTokLocation);
+ Diag(Loc, diag::err_ctor_init_missing_comma)
+ << FixItHint::CreateInsertion(Loc, ", ");
+ } else {
// Skip over garbage, until we get to '{'. Don't eat the '{'.
Diag(Tok.getLocation(), diag::err_expected_lbrace_or_comma);
SkipUntil(tok::l_brace, true, true);