[cfe-commits] r95324 - in /cfe/trunk: include/clang/Analysis/Analyses/PrintfFormatString.h lib/Analysis/PrintfFormatString.cpp lib/Sema/SemaChecking.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 4 12:46:58 PST 2010


Author: kremenek
Date: Thu Feb  4 14:46:58 2010
New Revision: 95324

URL: http://llvm.org/viewvc/llvm-project?rev=95324&view=rev
Log:
Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h
    cfe/trunk/lib/Analysis/PrintfFormatString.cpp
    cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h?rev=95324&r1=95323&r2=95324&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h Thu Feb  4 14:46:58 2010
@@ -234,8 +234,6 @@
   bool hasLeadingZeros() const { return (bool) HasLeadingZeroes; }  
 };
 
-} // end printf namespace
-
 class FormatStringHandler {
 public:
   FormatStringHandler() {}
@@ -261,6 +259,6 @@
 bool ParseFormatString(FormatStringHandler &H,
                        const char *beg, const char *end);
 
-
+} // end printf namespace
 } // end clang namespace
 #endif

Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=95324&r1=95323&r2=95324&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Thu Feb  4 14:46:58 2010
@@ -18,6 +18,7 @@
 using clang::analyze_printf::FormatSpecifier;
 using clang::analyze_printf::OptionalAmount;
 using clang::analyze_printf::ArgTypeResult;
+using clang::analyze_printf::FormatStringHandler;
 using namespace clang;
 
 namespace {
@@ -87,7 +88,8 @@
 }
 
 static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
-                                                  const char *&Beg, const char *E) {
+                                                  const char *&Beg,
+                                                  const char *E) {
   
   using namespace clang::analyze_printf;
   
@@ -241,7 +243,7 @@
   return FormatSpecifierResult(Start, FS);
 }
 
-bool clang::ParseFormatString(FormatStringHandler &H,
+bool clang::analyze_printf::ParseFormatString(FormatStringHandler &H,
                        const char *I, const char *E) {
   // Keep looking for a format specifier until we have exhausted the string.
   while (I != E) {

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=95324&r1=95323&r2=95324&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Feb  4 14:46:58 2010
@@ -1033,7 +1033,7 @@
 }
 
 namespace {
-class CheckPrintfHandler : public FormatStringHandler {
+class CheckPrintfHandler : public analyze_printf::FormatStringHandler {
   Sema &S;
   const StringLiteral *FExpr;
   const Expr *OrigFormatExpr;
@@ -1061,9 +1061,10 @@
   void HandleIncompleteFormatSpecifier(const char *startSpecifier,
                                        unsigned specifierLen);
   
-  void HandleInvalidConversionSpecifier(const analyze_printf::FormatSpecifier &FS,
-                                        const char *startSpecifier,
-                                        unsigned specifierLen);
+  void
+  HandleInvalidConversionSpecifier(const analyze_printf::FormatSpecifier &FS,
+                                   const char *startSpecifier,
+                                   unsigned specifierLen);
   
   void HandleNullChar(const char *nullCharacter);
   
@@ -1292,9 +1293,9 @@
 
       S.Diag(getLocationOfByte(CS.getStart()),
              diag::warn_printf_conversion_argument_type_mismatch)
-        << *T << Ex->getType()
-        << getFormatSpecifierRange(startSpecifier, specifierLen)
-        << Ex->getSourceRange();
+      << *T << Ex->getType();
+//        << getFormatSpecifierRange(startSpecifier, specifierLen)
+//        << Ex->getSourceRange();
     }
     return true;
   }
@@ -1341,7 +1342,7 @@
                        isa<ObjCStringLiteral>(OrigFormatExpr), Str,
                        HasVAListArg, TheCall, format_idx);
 
-  if (!ParseFormatString(H, Str, Str + StrLen))
+  if (!analyze_printf::ParseFormatString(H, Str, Str + StrLen))
     H.DoneProcessing();
 }
 





More information about the cfe-commits mailing list