Add fixit hint for missing ':' in ternary expressions.

llvm-svn: 101073
This commit is contained in:
Ted Kremenek 2010-04-12 22:10:35 +00:00
parent 393c4df342
commit e601365de9
2 changed files with 7 additions and 1 deletions

View File

@ -336,7 +336,8 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, unsigned MinPrec) {
}
if (Tok.isNot(tok::colon)) {
Diag(Tok, diag::err_expected_colon);
Diag(Tok, diag::err_expected_colon)
<< FixItHint::CreateInsertion(Tok.getLocation(), ": ");
Diag(OpToken, diag::note_matching) << "?";
return ExprError();
}

View File

@ -31,3 +31,8 @@ void f1(x, y)
int i0 = { 17 };
int test_cond(int y) {
// CHECK: int x = y ? 1 : 2;
int x = y ? 1 2;
return x;
}