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

#include "clang/AST/FormatString.h"

Inheritance diagram for clang::analyze_printf::PrintfSpecifier:
Inheritance graph
[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 setIsPrivate (const char *position)
 
void setIsPublic (const char *position)
 
void setIsSensitive (const char *position)
 
void setUsesPositionalArg ()
 
const PrintfConversionSpecifiergetConversionSpecifier () const
 
void setPrecision (const OptionalAmount &Amt)
 
const OptionalAmountgetPrecision () 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.
 
const OptionalFlaghasThousandsGrouping () const
 
const OptionalFlagisLeftJustified () const
 
const OptionalFlaghasPlusPrefix () const
 
const OptionalFlaghasAlternativeForm () const
 
const OptionalFlaghasLeadingZeros () const
 
const OptionalFlaghasSpacePrefix () const
 
const OptionalFlaghasObjCTechnicalTerm () const
 
const OptionalFlagisPrivate () const
 
const OptionalFlagisPublic () const
 
const OptionalFlagisSensitive () const
 
bool usesPositionalArg () const
 
StringRef getMaskType () const
 
void setMaskType (StringRef S)
 
bool fixType (QualType QT, const LangOptions &LangOpt, ASTContext &Ctx, bool IsObjCLiteral)
 Changes the specifier and length according to a QualType, retaining any flags or options.
 
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 setVectorNumElts (const OptionalAmount &Amt)
 
const OptionalAmountgetVectorNumElts () const
 
void setFieldWidth (const OptionalAmount &Amt)
 
bool usesPositionalArg () const
 
bool hasValidLengthModifier (const TargetInfo &Target, const LangOptions &LO) const
 
bool hasStandardLengthModifier () const
 
std::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)
 For a TypedefType QT, if it is a named integer type such as size_t, assign the appropriate value to LM and return true.
 

Additional Inherited Members

- Protected Attributes inherited from clang::analyze_format_string::FormatSpecifier
LengthModifier LM
 
OptionalAmount FieldWidth
 
ConversionSpecifier CS
 
OptionalAmount VectorNumElts
 
bool UsesPositionalArg
 Positional arguments, an IEEE extension: IEEE Std 1003.1, 2004 Edition http://www.opengroup.org/onlinepubs/009695399/functions/printf.html.
 
unsigned argIndex
 

Detailed Description

Definition at line 524 of file FormatString.h.

Constructor & Destructor Documentation

◆ PrintfSpecifier()

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

Definition at line 541 of file FormatString.h.

Member Function Documentation

◆ consumesDataArgument()

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

◆ fixType()

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 747 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::AsShortLong, clang::analyze_format_string::LengthModifier::AsWideChar, clang::analyze_format_string::FormatSpecifier::CS, clang::analyze_format_string::ConversionSpecifier::dArg, getArgType(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::analyze_format_string::ConversionSpecifier::getKind(), clang::BuiltinType::getKind(), clang::VectorType::getNumElements(), clang::Type::getPointeeType(), clang::ASTContext::getTargetInfo(), clang::analyze_format_string::FormatSpecifier::hasValidLengthModifier(), clang::Type::isAnyCharacterType(), clang::Type::isCharType(), clang::analyze_format_string::OptionalAmount::isInvalid(), clang::Type::isObjCRetainableType(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerType(), clang::Type::isUnsignedIntegerType(), clang::analyze_format_string::ArgType::isValid(), clang::Type::isWideCharType(), clang::analyze_format_string::FormatSpecifier::LM, clang::analyze_format_string::ArgType::matchesType(), clang::analyze_format_string::FormatSpecifier::namedTypeToLengthModifier(), clang::analyze_format_string::LengthModifier::None, clang::analyze_format_string::OptionalAmount::NotSpecified, clang::analyze_format_string::OptionalAmount::setHowSpecified(), clang::analyze_format_string::LengthModifier::setKind(), clang::analyze_format_string::ConversionSpecifier::setKind(), clang::analyze_format_string::ConversionSpecifier::uArg, and clang::analyze_format_string::FormatSpecifier::VectorNumElts.

◆ getArgType()

ArgType PrintfSpecifier::getArgType ( ASTContext Ctx,
bool  IsObjCLiteral 
) const

◆ getConversionSpecifier()

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

◆ getMaskType()

StringRef clang::analyze_printf::PrintfSpecifier::getMaskType ( ) const
inline

Definition at line 622 of file FormatString.h.

◆ getPrecision()

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

Definition at line 593 of file FormatString.h.

◆ hasAlternativeForm()

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

Definition at line 613 of file FormatString.h.

◆ hasLeadingZeros()

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

Definition at line 614 of file FormatString.h.

◆ hasObjCTechnicalTerm()

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

Definition at line 616 of file FormatString.h.

◆ hasPlusPrefix()

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

Definition at line 612 of file FormatString.h.

◆ hasSpacePrefix()

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

Definition at line 615 of file FormatString.h.

◆ hasThousandsGrouping()

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

Definition at line 608 of file FormatString.h.

◆ hasValidAlternativeForm()

bool PrintfSpecifier::hasValidAlternativeForm ( ) const

◆ hasValidFieldWidth()

bool PrintfSpecifier::hasValidFieldWidth ( ) const

◆ hasValidLeadingZeros()

bool PrintfSpecifier::hasValidLeadingZeros ( ) const

◆ hasValidLeftJustified()

bool PrintfSpecifier::hasValidLeftJustified ( ) const

◆ hasValidPlusPrefix()

bool PrintfSpecifier::hasValidPlusPrefix ( ) const

◆ hasValidPrecision()

bool PrintfSpecifier::hasValidPrecision ( ) const

◆ hasValidSpacePrefix()

bool PrintfSpecifier::hasValidSpacePrefix ( ) const

◆ hasValidThousandsGroupingPrefix()

bool PrintfSpecifier::hasValidThousandsGroupingPrefix ( ) const

◆ isLeftJustified()

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

Definition at line 611 of file FormatString.h.

◆ isPrivate()

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

Definition at line 617 of file FormatString.h.

◆ isPublic()

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

Definition at line 618 of file FormatString.h.

◆ isSensitive()

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

Definition at line 619 of file FormatString.h.

◆ Parse()

static PrintfSpecifier clang::analyze_printf::PrintfSpecifier::Parse ( const char *  beg,
const char *  end 
)
static

◆ setConversionSpecifier()

void clang::analyze_printf::PrintfSpecifier::setConversionSpecifier ( const PrintfConversionSpecifier cs)
inline

Definition at line 551 of file FormatString.h.

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

◆ setHasAlternativeForm()

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

◆ setHasLeadingZeros()

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

◆ setHasObjCTechnicalTerm()

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

◆ setHasPlusPrefix()

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

◆ setHasSpacePrefix()

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

◆ setHasThousandsGrouping()

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

◆ setIsLeftJustified()

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

◆ setIsPrivate()

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

◆ setIsPublic()

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

◆ setIsSensitive()

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

◆ setMaskType()

void clang::analyze_printf::PrintfSpecifier::setMaskType ( StringRef  S)
inline

Definition at line 623 of file FormatString.h.

◆ setPrecision()

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

◆ setUsesPositionalArg()

void clang::analyze_printf::PrintfSpecifier::setUsesPositionalArg ( )
inline

◆ toString()

void PrintfSpecifier::toString ( raw_ostream &  os) const

◆ usesPositionalArg()

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

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