fix a bug handling the gnu ?: extension. Patch by Storlek on IRC,

who prefers to be stealthy and mysterious.

llvm-svn: 91888
This commit is contained in:
Chris Lattner 2009-12-22 06:00:13 +00:00
parent 9c45ad7a1b
commit d806cbc98d
2 changed files with 2 additions and 1 deletions

View File

@ -800,7 +800,7 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall,
switch (E->getStmtClass()) {
case Stmt::ConditionalOperatorClass: {
const ConditionalOperator *C = cast<ConditionalOperator>(E);
return SemaCheckStringLiteral(C->getLHS(), TheCall,
return SemaCheckStringLiteral(C->getTrueExpr(), TheCall,
HasVAListArg, format_idx, firstDataArg)
&& SemaCheckStringLiteral(C->getRHS(), TheCall,
HasVAListArg, format_idx, firstDataArg);

View File

@ -50,6 +50,7 @@ void check_conditional_literal(const char* s, int i) {
printf(i == 1 ? "yes" : "no"); // no-warning
printf(i == 0 ? (i == 1 ? "yes" : "no") : "dont know"); // no-warning
printf(i == 0 ? (i == 1 ? s : "no") : "dont know"); // expected-warning{{format string is not a string literal}}
printf("yes" ?: "no %d", 1); // expected-warning{{more data arguments than '%' conversions}}
}
void check_writeback_specifier()