clang API Documentation
#include <FormatString.h>
Public Member Functions | |
PrintfSpecifier () | |
void | setConversionSpecifier (const PrintfConversionSpecifier &cs) |
void | setHasThousandsGrouping (const char *position) |
void | setIsLeftJustified (const char *position) |
void | setHasPlusPrefix (const char *position) |
void | setHasSpacePrefix (const char *position) |
void | setHasAlternativeForm (const char *position) |
void | setHasLeadingZeros (const char *position) |
void | setUsesPositionalArg () |
const PrintfConversionSpecifier & | getConversionSpecifier () const |
void | setPrecision (const OptionalAmount &Amt) |
const OptionalAmount & | getPrecision () const |
bool | consumesDataArgument () const |
ArgType | getArgType (ASTContext &Ctx, bool IsObjCLiteral) const |
Returns the builtin type that a data argument paired with this format specifier should have. This method will return null if the format specifier does not have a matching data argument or the matching argument matches more than one type. | |
const OptionalFlag & | hasThousandsGrouping () const |
const OptionalFlag & | isLeftJustified () const |
const OptionalFlag & | hasPlusPrefix () const |
const OptionalFlag & | hasAlternativeForm () const |
const OptionalFlag & | hasLeadingZeros () const |
const OptionalFlag & | hasSpacePrefix () const |
bool | usesPositionalArg () const |
bool | fixType (QualType QT, const LangOptions &LangOpt, ASTContext &Ctx, bool IsObjCLiteral) |
void | toString (raw_ostream &os) const |
bool | hasValidPlusPrefix () const |
bool | hasValidAlternativeForm () const |
bool | hasValidLeadingZeros () const |
bool | hasValidSpacePrefix () const |
bool | hasValidLeftJustified () const |
bool | hasValidThousandsGroupingPrefix () const |
bool | hasValidPrecision () const |
bool | hasValidFieldWidth () const |
Static Public Member Functions | |
static PrintfSpecifier | Parse (const char *beg, const char *end) |
Definition at line 421 of file FormatString.h.
Definition at line 430 of file FormatString.h.
bool clang::analyze_printf::PrintfSpecifier::consumesDataArgument | ( | ) | const [inline] |
Definition at line 482 of file FormatString.h.
References clang::analyze_format_string::ConversionSpecifier::consumesDataArgument(), and getConversionSpecifier().
bool PrintfSpecifier::fixType | ( | QualType | QT, |
const LangOptions & | LangOpt, | ||
ASTContext & | Ctx, | ||
bool | IsObjCLiteral | ||
) |
Changes the specifier and length according to a QualType, retaining any flags or options. Returns true on success, or false when a conversion was not successful.
Definition at line 465 of file PrintfFormatString.cpp.
References clang::analyze_format_string::ConversionSpecifier::dArg, clang::Type::getAs(), clang::BuiltinType::getKind(), clang::Type::getPointeeType(), clang::ASTContext::getTargetInfo(), clang::Type::isAnyCharacterType(), clang::Type::isCharType(), clang::Type::isObjCRetainableType(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerType(), clang::Type::isUnsignedIntegerType(), clang::Type::isWideCharType(), and clang::analyze_format_string::ConversionSpecifier::uArg.
ArgType PrintfSpecifier::getArgType | ( | ASTContext & | Ctx, |
bool | IsObjCLiteral | ||
) | const |
Returns the builtin type that a data argument paired with this format specifier should have. This method will return null if the format specifier does not have a matching data argument or the matching argument matches more than one type.
Definition at line 300 of file PrintfFormatString.cpp.
References clang::analyze_format_string::ConversionSpecifier::consumesDataArgument(), clang::ASTContext::DoubleTy, clang::ASTContext::getIntMaxType(), clang::analyze_format_string::ConversionSpecifier::getKind(), clang::ASTContext::getPointerDiffType(), clang::ASTContext::getPointerType(), clang::ASTContext::getSizeType(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::ASTContext::getUIntMaxType(), clang::ASTContext::IntTy, clang::analyze_printf::PrintfConversionSpecifier::isDoubleArg(), clang::analyze_format_string::ConversionSpecifier::isIntArg(), clang::analyze_format_string::ConversionSpecifier::isUIntArg(), clang::ASTContext::LongDoubleTy, clang::ASTContext::LongLongTy, clang::ASTContext::LongTy, clang::ASTContext::ShortTy, clang::ASTContext::SignedCharTy, clang::ASTContext::UnsignedCharTy, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, clang::ASTContext::UnsignedShortTy, clang::ASTContext::WideCharTy, and clang::CanQual< T >::withConst().
const PrintfConversionSpecifier& clang::analyze_printf::PrintfSpecifier::getConversionSpecifier | ( | ) | const [inline] |
Definition at line 469 of file FormatString.h.
References clang::analyze_format_string::FormatSpecifier::CS.
Referenced by consumesDataArgument(), and clang::analyze_format_string::ParseFormatStringHasSArg().
const OptionalAmount& clang::analyze_printf::PrintfSpecifier::getPrecision | ( | ) | const [inline] |
Definition at line 478 of file FormatString.h.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasAlternativeForm | ( | ) | const [inline] |
Definition at line 498 of file FormatString.h.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasLeadingZeros | ( | ) | const [inline] |
Definition at line 499 of file FormatString.h.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasPlusPrefix | ( | ) | const [inline] |
Definition at line 497 of file FormatString.h.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasSpacePrefix | ( | ) | const [inline] |
Definition at line 500 of file FormatString.h.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasThousandsGrouping | ( | ) | const [inline] |
Definition at line 493 of file FormatString.h.
bool PrintfSpecifier::hasValidAlternativeForm | ( | ) | const |
Definition at line 684 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidFieldWidth | ( | ) | const |
Definition at line 827 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidLeadingZeros | ( | ) | const |
Definition at line 709 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidLeftJustified | ( | ) | const |
Definition at line 763 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidPlusPrefix | ( | ) | const |
Definition at line 660 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidPrecision | ( | ) | const |
Definition at line 797 of file PrintfFormatString.cpp.
bool PrintfSpecifier::hasValidSpacePrefix | ( | ) | const |
Definition at line 739 of file PrintfFormatString.cpp.
Definition at line 777 of file PrintfFormatString.cpp.
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::isLeftJustified | ( | ) | const [inline] |
Definition at line 496 of file FormatString.h.
static PrintfSpecifier clang::analyze_printf::PrintfSpecifier::Parse | ( | const char * | beg, |
const char * | end | ||
) | [static] |
void clang::analyze_printf::PrintfSpecifier::setConversionSpecifier | ( | const PrintfConversionSpecifier & | cs | ) | [inline] |
Definition at line 438 of file FormatString.h.
References clang::analyze_format_string::FormatSpecifier::CS.
void clang::analyze_printf::PrintfSpecifier::setHasAlternativeForm | ( | const char * | position | ) | [inline] |
Definition at line 457 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setHasLeadingZeros | ( | const char * | position | ) | [inline] |
Definition at line 461 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setHasPlusPrefix | ( | const char * | position | ) | [inline] |
Definition at line 449 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setHasSpacePrefix | ( | const char * | position | ) | [inline] |
Definition at line 453 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setHasThousandsGrouping | ( | const char * | position | ) | [inline] |
Definition at line 441 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setIsLeftJustified | ( | const char * | position | ) | [inline] |
Definition at line 445 of file FormatString.h.
void clang::analyze_printf::PrintfSpecifier::setPrecision | ( | const OptionalAmount & | Amt | ) | [inline] |
Definition at line 473 of file FormatString.h.
Referenced by ParsePrecision().
void clang::analyze_printf::PrintfSpecifier::setUsesPositionalArg | ( | ) | [inline] |
Reimplemented from clang::analyze_format_string::FormatSpecifier.
Definition at line 465 of file FormatString.h.
References clang::analyze_format_string::FormatSpecifier::UsesPositionalArg.
void PrintfSpecifier::toString | ( | raw_ostream & | os | ) | const |
Definition at line 633 of file PrintfFormatString.cpp.
bool clang::analyze_printf::PrintfSpecifier::usesPositionalArg | ( | ) | const [inline] |
Reimplemented from clang::analyze_format_string::FormatSpecifier.
Definition at line 501 of file FormatString.h.
References clang::analyze_format_string::FormatSpecifier::UsesPositionalArg.