aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-09-18 00:52:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-09-18 00:52:05 +0000
commit4b0824229b96d024a96f3c7dd75ab70652c05c5b (patch)
treec82ecc61d62f02db1d9f57ef74724d87b3ba5238 /lib/Parse/Parser.cpp
parent43f8c40b05482894d94a8779a5ccd0f9a35420f3 (diff)
If a comma operator is followed by a token which unambiguously indicates the
start of a statement or the end of a compound-statement, diagnose the comma as a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and minor refactoring by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 4c40b8e974..2b19c973ce 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -154,7 +154,8 @@ void Parser::SuggestParentheses(SourceLocation Loc, unsigned DK,
static bool IsCommonTypo(tok::TokenKind ExpectedTok, const Token &Tok) {
switch (ExpectedTok) {
- case tok::semi: return Tok.is(tok::colon); // : for ;
+ case tok::semi:
+ return Tok.is(tok::colon) || Tok.is(tok::comma); // : or , for ;
default: return false;
}
}