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

Tom Care tcare at apple.com
Thu Jun 17 15:55:40 PDT 2010


Author: tcare
Date: Thu Jun 17 17:55:40 2010
New Revision: 106245

URL: http://llvm.org/viewvc/llvm-project?rev=106245&view=rev
Log:
Bug 7394 - Fixed toString representation of Precisions in format strings.

M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp

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=106245&r1=106244&r2=106245&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h Thu Jun 17 17:55:40 2010
@@ -192,11 +192,11 @@
                  unsigned amountLength,
                  bool usesPositionalArg)
     : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
-      UsesPositionalArg(usesPositionalArg) {}
+      UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {}
 
   OptionalAmount(bool valid = true)
     : start(0),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
-      UsesPositionalArg(0) {}
+      UsesPositionalArg(0), UsesDotPrefix(0) {}
 
   bool isInvalid() const {
     return hs == Invalid;
@@ -236,12 +236,16 @@
     return amt + 1;
   }
 
+  bool usesDotPrefix() const { return UsesDotPrefix; }
+  void setUsesDotPrefix() { UsesDotPrefix = true; }
+
 private:
   const char *start;
   unsigned length;
   HowSpecified hs;
   unsigned amt;
   bool UsesPositionalArg : 1;
+  bool UsesDotPrefix;
 };
 
 // Class representing optional flags with location and representation
@@ -362,6 +366,7 @@
 
   void setPrecision(const OptionalAmount &Amt) {
     Precision = Amt;
+    Precision.setUsesDotPrefix();
   }
 
   const OptionalAmount &getPrecision() const {

Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=106245&r1=106244&r2=106245&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Thu Jun 17 17:55:40 2010
@@ -611,6 +611,9 @@
 //===----------------------------------------------------------------------===//
 
 void OptionalAmount::toString(llvm::raw_ostream &os) const {
+  if (UsesDotPrefix)
+    os << ".";
+
   switch (hs) {
   case Invalid:
   case NotSpecified:





More information about the cfe-commits mailing list