diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-07 14:51:08 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-07 14:51:08 +0000 |
commit | 751f6922376dfe9432795b65a3649179e4ef5cf5 (patch) | |
tree | 18b14744149494a17086a56e7460d8a78557ea38 /lib/Parse/ParseDecl.cpp | |
parent | b1f6fa48960eae269a3931d1fc545ed468d9a4d2 (diff) |
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
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 555fcf0dec..cf0cc9c4aa 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2127,6 +2127,14 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { EnumConstantDecls.push_back(EnumConstDecl); LastEnumConstDecl = EnumConstDecl; + if (Tok.is(tok::identifier)) { + // We're missing a comma between enumerators. + SourceLocation Loc = PP.getLocForEndOfToken(PrevTokLocation); + Diag(Loc, diag::err_enumerator_list_missing_comma) + << FixItHint::CreateInsertion(Loc, ", "); + continue; + } + if (Tok.isNot(tok::comma)) break; SourceLocation CommaLoc = ConsumeToken(); |