diff options
author | Bob Wilson <bob.wilson@apple.com> | 2016-03-15 20:56:38 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2016-03-15 20:56:38 +0000 |
commit | 57819fc809d1a72e253233930bbd06f13fb9bae6 (patch) | |
tree | 732cab7e54e904040185c40282a3aea9b90d21b0 /clang/lib/Sema | |
parent | 20c1e4e69d05e56d270e8380679c8735bac2c6d2 (diff) | |
download | bcm5719-llvm-57819fc809d1a72e253233930bbd06f13fb9bae6.tar.gz bcm5719-llvm-57819fc809d1a72e253233930bbd06f13fb9bae6.zip |
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
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 966d3493926..cc261e05963 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -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 { |