Move the fixit for -Wformat-security to a note.
r263299 added a fixit for the -Wformat-security warning, but that runs into complications with our guideline that error recovery should be done as-if the fixit had been applied. Putting the fixit on a note avoids that. llvm-svn: 263584
This commit is contained in:
@@ -3628,19 +3628,20 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *> Args,
|
||||
// If there are no arguments specified, warn with -Wformat-security, otherwise
|
||||
// warn only with -Wformat-nonliteral.
|
||||
if (Args.size() == firstDataArg) {
|
||||
const SemaDiagnosticBuilder &D =
|
||||
Diag(FormatLoc, diag::warn_format_nonliteral_noargs);
|
||||
Diag(FormatLoc, diag::warn_format_nonliteral_noargs)
|
||||
<< OrigFormatExpr->getSourceRange();
|
||||
switch (Type) {
|
||||
default:
|
||||
D << OrigFormatExpr->getSourceRange();
|
||||
break;
|
||||
case FST_Kprintf:
|
||||
case FST_FreeBSDKPrintf:
|
||||
case FST_Printf:
|
||||
D << FixItHint::CreateInsertion(FormatLoc, "\"%s\", ");
|
||||
Diag(FormatLoc, diag::note_format_security_fixit)
|
||||
<< FixItHint::CreateInsertion(FormatLoc, "\"%s\", ");
|
||||
break;
|
||||
case FST_NSString:
|
||||
D << FixItHint::CreateInsertion(FormatLoc, "@\"%@\", ");
|
||||
Diag(FormatLoc, diag::note_format_security_fixit)
|
||||
<< FixItHint::CreateInsertion(FormatLoc, "@\"%@\", ");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user