#include <cassert>
namespace clang {
-namespace printf {
+namespace analyze_printf {
class ConversionSpecifier {
public:
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; }
return (LengthModifier) lengthModifier;
}
+ const OptionalAmount &getFieldWidth() const {
+ return FieldWidth;
+ }
+
void setFieldWidth(const OptionalAmount &Amt) {
FieldWidth = Amt;
}
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; }
#include "clang/Analysis/Analyses/PrintfFormatString.h"
using namespace clang;
-using namespace printf;
+using namespace analyze_printf;
namespace {
class FormatSpecifierResult {
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) {}
assert(hasValue());
return FS;
}
- const printf::FormatSpecifier &getValue() { return FS; }
+ const FormatSpecifier &getValue() { return FS; }
};
} // end anonymous namespace
return OptionalAmount();
}
-static FormatSpecifierResult ParseFormatSpecifier(printf::FormatStringHandler &H,
+static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
const char *&Beg, const char *E) {
const char *I = Beg;