clang  3.7.0
Public Member Functions | Static Public Member Functions | List of all members
clang::analyze_printf::PrintfSpecifier Class Reference

#include <FormatString.h>

Inheritance diagram for clang::analyze_printf::PrintfSpecifier:
[legend]
Collaboration diagram for clang::analyze_printf::PrintfSpecifier:
[legend]

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 setHasObjCTechnicalTerm (const char *position)
 
void setUsesPositionalArg ()
 
const PrintfConversionSpecifiergetConversionSpecifier () 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. More...
 
const OptionalFlag & hasThousandsGrouping () const
 
const OptionalFlag & isLeftJustified () const
 
const OptionalFlag & hasPlusPrefix () const
 
const OptionalFlag & hasAlternativeForm () const
 
const OptionalFlag & hasLeadingZeros () const
 
const OptionalFlag & hasSpacePrefix () const
 
const OptionalFlag & hasObjCTechnicalTerm () 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
 
- Public Member Functions inherited from clang::analyze_format_string::FormatSpecifier
 FormatSpecifier (bool isPrintf)
 
void setLengthModifier (LengthModifier lm)
 
void setUsesPositionalArg ()
 
void setArgIndex (unsigned i)
 
unsigned getArgIndex () const
 
unsigned getPositionalArgIndex () const
 
const LengthModifiergetLengthModifier () const
 
const OptionalAmountgetFieldWidth () const
 
void setFieldWidth (const OptionalAmount &Amt)
 
bool usesPositionalArg () const
 
bool hasValidLengthModifier (const TargetInfo &Target) const
 
bool hasStandardLengthModifier () const
 
Optional< LengthModifiergetCorrectedLengthModifier () const
 
bool hasStandardConversionSpecifier (const LangOptions &LangOpt) const
 
bool hasStandardLengthConversionCombination () const
 

Static Public Member Functions

static PrintfSpecifier Parse (const char *beg, const char *end)
 
- Static Public Member Functions inherited from clang::analyze_format_string::FormatSpecifier
static bool namedTypeToLengthModifier (QualType QT, LengthModifier &LM)
 

Additional Inherited Members

- Protected Attributes inherited from clang::analyze_format_string::FormatSpecifier
LengthModifier LM
 
OptionalAmount FieldWidth
 
ConversionSpecifier CS
 
bool UsesPositionalArg
 
unsigned argIndex
 

Detailed Description

Definition at line 432 of file FormatString.h.

Constructor & Destructor Documentation

clang::analyze_printf::PrintfSpecifier::PrintfSpecifier ( )
inline

Definition at line 442 of file FormatString.h.

Member Function Documentation

bool clang::analyze_printf::PrintfSpecifier::consumesDataArgument ( ) const
inline
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 550 of file PrintfFormatString.cpp.

References clang::analyze_format_string::LengthModifier::AsChar, clang::analyze_format_string::LengthModifier::AsLong, clang::analyze_format_string::LengthModifier::AsLongDouble, clang::analyze_format_string::LengthModifier::AsLongLong, clang::analyze_format_string::LengthModifier::AsShort, clang::analyze_format_string::LengthModifier::AsWideChar, clang::analyze_format_string::ConversionSpecifier::cArg, clang::analyze_format_string::ConversionSpecifier::dArg, clang::analyze_format_string::ConversionSpecifier::DArg, clang::analyze_format_string::ConversionSpecifier::fArg, clang::Type::getAs(), clang::BuiltinType::getKind(), clang::Type::getPointeeType(), clang::ASTContext::getTargetInfo(), clang::analyze_format_string::ConversionSpecifier::iArg, clang::Type::isAnyCharacterType(), clang::Type::isCharType(), clang::Type::isObjCRetainableType(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerType(), clang::Type::isUnsignedIntegerType(), clang::Type::isWideCharType(), clang::analyze_format_string::ConversionSpecifier::nArg, clang::analyze_format_string::LengthModifier::None, clang::analyze_format_string::OptionalAmount::NotSpecified, clang::analyze_format_string::ConversionSpecifier::ObjCObjArg, clang::analyze_format_string::ConversionSpecifier::sArg, clang::analyze_format_string::ConversionSpecifier::uArg, 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 385 of file PrintfFormatString.cpp.

References clang::analyze_format_string::ArgType::AnyCharTy, clang::analyze_format_string::LengthModifier::AsAllocate, clang::analyze_format_string::LengthModifier::AsChar, clang::analyze_format_string::LengthModifier::AsInt32, clang::analyze_format_string::LengthModifier::AsInt3264, clang::analyze_format_string::LengthModifier::AsInt64, clang::analyze_format_string::LengthModifier::AsIntMax, clang::analyze_format_string::LengthModifier::AsLong, clang::analyze_format_string::LengthModifier::AsLongDouble, clang::analyze_format_string::LengthModifier::AsLongLong, clang::analyze_format_string::LengthModifier::AsMAllocate, clang::analyze_format_string::LengthModifier::AsPtrDiff, clang::analyze_format_string::LengthModifier::AsQuad, clang::analyze_format_string::LengthModifier::AsShort, clang::analyze_format_string::LengthModifier::AsSizeT, clang::analyze_format_string::LengthModifier::AsWide, clang::analyze_format_string::LengthModifier::AsWideChar, clang::analyze_format_string::ConversionSpecifier::cArg, clang::analyze_format_string::ConversionSpecifier::CArg, clang::analyze_format_string::ConversionSpecifier::consumesDataArgument(), clang::analyze_format_string::ArgType::CPointerTy, clang::analyze_format_string::ArgType::CStrTy, 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_format_string::ArgType::Invalid(), 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::analyze_format_string::ConversionSpecifier::nArg, clang::analyze_format_string::LengthModifier::None, clang::analyze_format_string::ConversionSpecifier::ObjCObjArg, clang::analyze_format_string::ArgType::ObjCPointerTy, clang::analyze_format_string::ConversionSpecifier::pArg, clang::analyze_format_string::ArgType::PtrTo(), clang::analyze_format_string::ConversionSpecifier::sArg, clang::analyze_format_string::ConversionSpecifier::SArg, clang::ASTContext::ShortTy, clang::ASTContext::SignedCharTy, clang::ASTContext::UnsignedCharTy, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, clang::ASTContext::UnsignedShortTy, clang::analyze_format_string::ArgType::WCStrTy, clang::ASTContext::WideCharTy, clang::analyze_format_string::ArgType::WIntTy, and clang::CanQual< T >::withConst().

const PrintfConversionSpecifier& clang::analyze_printf::PrintfSpecifier::getConversionSpecifier ( ) const
inline
const OptionalAmount& clang::analyze_printf::PrintfSpecifier::getPrecision ( ) const
inline

Definition at line 488 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasAlternativeForm ( ) const
inline

Definition at line 508 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasLeadingZeros ( ) const
inline

Definition at line 509 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasObjCTechnicalTerm ( ) const
inline

Definition at line 511 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasPlusPrefix ( ) const
inline

Definition at line 507 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasSpacePrefix ( ) const
inline

Definition at line 510 of file FormatString.h.

const OptionalFlag& clang::analyze_printf::PrintfSpecifier::hasThousandsGrouping ( ) const
inline

Definition at line 503 of file FormatString.h.

bool PrintfSpecifier::hasValidAlternativeForm ( ) const
bool PrintfSpecifier::hasValidFieldWidth ( ) const
bool PrintfSpecifier::hasValidLeadingZeros ( ) const
bool PrintfSpecifier::hasValidLeftJustified ( ) const
bool PrintfSpecifier::hasValidPlusPrefix ( ) const
bool PrintfSpecifier::hasValidPrecision ( ) const
bool PrintfSpecifier::hasValidSpacePrefix ( ) const
bool PrintfSpecifier::hasValidThousandsGroupingPrefix ( ) const
const OptionalFlag& clang::analyze_printf::PrintfSpecifier::isLeftJustified ( ) const
inline

Definition at line 506 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 451 of file FormatString.h.

References clang::analyze_format_string::FormatSpecifier::CS.

void clang::analyze_printf::PrintfSpecifier::setHasAlternativeForm ( const char *  position)
inline

Definition at line 466 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setHasLeadingZeros ( const char *  position)
inline

Definition at line 469 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setHasObjCTechnicalTerm ( const char *  position)
inline

Definition at line 472 of file FormatString.h.

Referenced by ParseObjCFlags().

void clang::analyze_printf::PrintfSpecifier::setHasPlusPrefix ( const char *  position)
inline

Definition at line 460 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setHasSpacePrefix ( const char *  position)
inline

Definition at line 463 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setHasThousandsGrouping ( const char *  position)
inline

Definition at line 454 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setIsLeftJustified ( const char *  position)
inline

Definition at line 457 of file FormatString.h.

void clang::analyze_printf::PrintfSpecifier::setPrecision ( const OptionalAmount &  Amt)
inline

Definition at line 483 of file FormatString.h.

Referenced by ParsePrecision().

void clang::analyze_printf::PrintfSpecifier::setUsesPositionalArg ( )
inline
void PrintfSpecifier::toString ( raw_ostream &  os) const

Definition at line 718 of file PrintfFormatString.cpp.

bool clang::analyze_printf::PrintfSpecifier::usesPositionalArg ( ) const
inline

The documentation for this class was generated from the following files: