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

Ted Kremenek kremenek at apple.com
Wed Jan 27 18:02:59 PST 2010


Author: kremenek
Date: Wed Jan 27 20:02:59 2010
New Revision: 94733

URL: http://llvm.org/viewvc/llvm-project?rev=94733&view=rev
Log:
Rename namespace clang::printf to clang::analyze_printf to avoid problems where the reference to 'printf' is ambiguous.

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=94733&r1=94732&r2=94733&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/PrintfFormatString.h Wed Jan 27 20:02:59 2010
@@ -18,7 +18,7 @@
 #include <cassert>
 
 namespace clang {
-namespace printf {
+namespace analyze_printf {
 
 class ConversionSpecifier {
 public:
@@ -61,6 +61,7 @@
 
   ConversionSpecifier(Kind k) : kind(k) {}
   
+  bool isObjCArg() const { return kind >= ObjCBeg && kind <= ObjCEnd; }
   bool isIntArg() const { return kind >= dArg && kind <= iArg; }
   bool isUIntArg() const { return kind >= oArg && kind <= XArg; }
   bool isDoubleArg() const { return kind >= fArg && kind <= AArg; }
@@ -147,6 +148,10 @@
     return (LengthModifier) lengthModifier;
   }
   
+  const OptionalAmount &getFieldWidth() const {
+    return FieldWidth;
+  }
+  
   void setFieldWidth(const OptionalAmount &Amt) {
     FieldWidth = Amt;
   }
@@ -154,6 +159,10 @@
   void setPrecision(const OptionalAmount &Amt) {
     Precision = Amt;
   }
+  
+  const OptionalAmount &getPrecision() const {
+    return Precision;
+  }
 
   bool isLeftJustified() const { return flags & LeftJustified; }
   bool hasPlusPrefix() const { return flags & PlusPrefix; }

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

==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Wed Jan 27 20:02:59 2010
@@ -15,7 +15,7 @@
 #include "clang/Analysis/Analyses/PrintfFormatString.h"
 
 using namespace clang;
-using namespace printf;
+using namespace analyze_printf;
 
 namespace {
 class FormatSpecifierResult {
@@ -26,7 +26,7 @@
   FormatSpecifierResult(bool err = false)
     : Start(0), HasError(err) {}
   FormatSpecifierResult(const char *start,
-                        const printf::FormatSpecifier &fs)
+                        const FormatSpecifier &fs)
     : FS(fs), Start(start), HasError(false) {}
 
   
@@ -37,7 +37,7 @@
     assert(hasValue());
     return FS;
   }
-  const printf::FormatSpecifier &getValue() { return FS; }
+  const FormatSpecifier &getValue() { return FS; }
 };
 } // end anonymous namespace
 
@@ -81,7 +81,7 @@
   return OptionalAmount();  
 }
 
-static FormatSpecifierResult ParseFormatSpecifier(printf::FormatStringHandler &H,
+static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
                                                   const char *&Beg, const char *E) {
   
   const char *I = Beg;





More information about the cfe-commits mailing list