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

Ted Kremenek kremenek at apple.com
Wed Jan 27 17:00:59 PST 2010


Author: kremenek
Date: Wed Jan 27 19:00:59 2010
New Revision: 94715

URL: http://llvm.org/viewvc/llvm-project?rev=94715&view=rev
Log:
Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h
    cfe/trunk/lib/Analysis/PrintfFormatString.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=94715&r1=94714&r2=94715&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h Wed Jan 27 19:00:59 2010
@@ -176,9 +176,9 @@
   
   virtual void HandleInvalidConversionSpecifier(const char *conversionChar) {}
   
-  virtual void HandleFormatSpecifier(const FormatSpecifier &FS,
+  virtual bool HandleFormatSpecifier(const FormatSpecifier &FS,
                                      const char *startSpecifier,
-                                     const char *endSpecifier) {}
+                                     const char *endSpecifier) { return false; }
 };
   
 bool ParseFormatString(FormatStringHandler &H,

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

==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Wed Jan 27 19:00:59 2010
@@ -233,7 +233,8 @@
     if (!FSR.hasValue())
       break;    
     // We have a format specifier.  Pass it to the callback.
-    H.HandleFormatSpecifier(FSR.getValue(), FSR.getStart(), I);
+    if (!H.HandleFormatSpecifier(FSR.getValue(), FSR.getStart(), I))
+      return false;
   }  
   assert(I == E && "Format string not exhausted");      
   return false;





More information about the cfe-commits mailing list