From 0c06944f5ef31cc6356e30da2971fa5439c4c8ef Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 15 Mar 2011 21:18:48 +0000 Subject: [PATCH] Don't warn about null characters in Objective-C format string literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127703 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaChecking.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index ea14b4bbb1..24cf23bf43 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -1218,10 +1218,12 @@ void CheckFormatHandler::HandleZeroPosition(const char *startPos, } void CheckFormatHandler::HandleNullChar(const char *nullCharacter) { - // The presence of a null character is likely an error. - S.Diag(getLocationOfByte(nullCharacter), - diag::warn_printf_format_string_contains_null_char) - << getFormatStringRange(); + if (!IsObjCLiteral) { + // The presence of a null character is likely an error. + S.Diag(getLocationOfByte(nullCharacter), + diag::warn_printf_format_string_contains_null_char) + << getFormatStringRange(); + } } const Expr *CheckFormatHandler::getDataArg(unsigned i) const { -- 2.40.0