[cfe-commits] r169399 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/FixIt/format-darwin.m

Jordan Rose jordan_rose at apple.com
Wed Dec 5 10:44:44 PST 2012


Author: jrose
Date: Wed Dec  5 12:44:44 2012
New Revision: 169399

URL: http://llvm.org/viewvc/llvm-project?rev=169399&view=rev
Log:
Format strings: add more expression types that don't need parens to cast.

No functionality change (the test change is a comment only, and the new
functionality can't be tested using the current test).

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp
    cfe/trunk/test/FixIt/format-darwin.m

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=169399&r1=169398&r2=169399&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Dec  5 12:44:44 2012
@@ -2690,12 +2690,24 @@
   switch (Inside->getStmtClass()) {
   case Stmt::ArraySubscriptExprClass:
   case Stmt::CallExprClass:
+  case Stmt::CharacterLiteralClass:
+  case Stmt::CXXBoolLiteralExprClass:
   case Stmt::DeclRefExprClass:
+  case Stmt::FloatingLiteralClass:
+  case Stmt::IntegerLiteralClass:
   case Stmt::MemberExprClass:
+  case Stmt::ObjCArrayLiteralClass:
+  case Stmt::ObjCBoolLiteralExprClass:
+  case Stmt::ObjCBoxedExprClass:
+  case Stmt::ObjCDictionaryLiteralClass:
+  case Stmt::ObjCEncodeExprClass:
   case Stmt::ObjCIvarRefExprClass:
   case Stmt::ObjCMessageExprClass:
   case Stmt::ObjCPropertyRefExprClass:
+  case Stmt::ObjCStringLiteralClass:
+  case Stmt::ObjCSubscriptRefExprClass:
   case Stmt::ParenExprClass:
+  case Stmt::StringLiteralClass:
   case Stmt::UnaryOperatorClass:
     return false;
   default:

Modified: cfe/trunk/test/FixIt/format-darwin.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/format-darwin.m?rev=169399&r1=169398&r2=169399&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/format-darwin.m (original)
+++ cfe/trunk/test/FixIt/format-darwin.m Wed Dec  5 12:44:44 2012
@@ -65,7 +65,7 @@
   NSInteger arr[4] = {0};
   NSInteger i = 0;
 
-  // These cases match the cases in CheckPrintfHandler::checkFormatExpr.
+  // These cases match the relevant cases in CheckPrintfHandler::checkFormatExpr.
   printf("%s", arr[0]);  // expected-warning{{values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}}
   printf("%s", getNSInteger());  // expected-warning{{values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}}
   printf("%s", i);  // expected-warning{{values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}}





More information about the cfe-commits mailing list