diff options
| author | Ted Kremenek <kremenek@apple.com> | 2011-02-24 23:03:04 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2011-02-24 23:03:04 +0000 |
| commit | a8890833f227d57cf092f112a2dbfc774a484c0c (patch) | |
| tree | 73478f2318fd9eeb7c2c61567fa0e57633617961 /clang/lib | |
| parent | 27361a712423283d5c1c330741ac5c93b74f9b1c (diff) | |
| download | bcm5719-llvm-a8890833f227d57cf092f112a2dbfc774a484c0c.tar.gz bcm5719-llvm-a8890833f227d57cf092f112a2dbfc774a484c0c.zip | |
Don't warn about using PredefinedExprs as format string literals. These never can be a real security issue.
Fixes PR 9314.
llvm-svn: 126447
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 5c2356f54db..97cc44e7372 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -875,7 +875,7 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) { return false; } -// Handle i > 1 ? "x" : "y", recursivelly +// Handle i > 1 ? "x" : "y", recursively. bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall, bool HasVAListArg, unsigned format_idx, unsigned firstDataArg, @@ -918,6 +918,12 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall, } return false; + case Stmt::PredefinedExprClass: + // While __func__, etc., are technically not string literals, they + // cannot contain format specifiers and thus are not a security + // liability. + return true; + case Stmt::DeclRefExprClass: { const DeclRefExpr *DR = cast<DeclRefExpr>(E); |

