[cfe-commits] r127703 - /cfe/trunk/lib/Sema/SemaChecking.cpp

Ted Kremenek kremenek at apple.com
Tue Mar 15 14:18:48 PDT 2011


Author: kremenek
Date: Tue Mar 15 16:18:48 2011
New Revision: 127703

URL: http://llvm.org/viewvc/llvm-project?rev=127703&view=rev
Log:
Don't warn about null characters in Objective-C format string literals.

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=127703&r1=127702&r2=127703&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Mar 15 16:18:48 2011
@@ -1218,10 +1218,12 @@
 }
 
 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 {





More information about the cfe-commits mailing list