clang  13.0.0git
Classes | Enumerations | Functions
clang::analyze_format_string Namespace Reference

Common components of both fprintf and fscanf format strings. More...

Classes

class  ArgType
 
class  ConversionSpecifier
 
class  FormatSpecifier
 
class  FormatStringHandler
 
class  LengthModifier
 Represents the length modifier in a format string in scanf/printf. More...
 
class  OptionalAmount
 
class  OptionalFlag
 Class representing optional flags with location and representation information. More...
 
class  SpecifierResult
 

Enumerations

enum  PositionContext { FieldWidthPos = 0, PrecisionPos = 1 }
 

Functions

bool ParsePrintfString (FormatStringHandler &H, const char *beg, const char *end, const LangOptions &LO, const TargetInfo &Target, bool isFreeBSDKPrintf)
 
bool ParseFormatStringHasSArg (const char *beg, const char *end, const LangOptions &LO, const TargetInfo &Target)
 
bool ParseScanfString (FormatStringHandler &H, const char *beg, const char *end, const LangOptions &LO, const TargetInfo &Target)
 
bool parseFormatStringHasFormattingSpecifiers (const char *Begin, const char *End, const LangOptions &LO, const TargetInfo &Target)
 Return true if the given string has at least one formatting specifier. More...
 
OptionalAmount ParseAmount (const char *&Beg, const char *E)
 
OptionalAmount ParseNonPositionAmount (const char *&Beg, const char *E, unsigned &argIndex)
 
OptionalAmount ParsePositionAmount (FormatStringHandler &H, const char *Start, const char *&Beg, const char *E, PositionContext p)
 
bool ParseFieldWidth (FormatStringHandler &H, FormatSpecifier &CS, const char *Start, const char *&Beg, const char *E, unsigned *argIndex)
 
bool ParseArgPosition (FormatStringHandler &H, FormatSpecifier &CS, const char *Start, const char *&Beg, const char *E)
 
bool ParseVectorModifier (FormatStringHandler &H, FormatSpecifier &FS, const char *&Beg, const char *E, const LangOptions &LO)
 
bool ParseLengthModifier (FormatSpecifier &FS, const char *&Beg, const char *E, const LangOptions &LO, bool IsScanf=false)
 Returns true if a LengthModifier was parsed and installed in the FormatSpecifier& argument, and false otherwise. More...
 
bool ParseUTF8InvalidSpecifier (const char *SpecifierBegin, const char *FmtStrEnd, unsigned &Len)
 Returns true if the invalid specifier in SpecifierBegin is a UTF-8 string; check that it won't go further than FmtStrEnd and write up the total size in Len. More...
 

Detailed Description

Common components of both fprintf and fscanf format strings.

Enumeration Type Documentation

◆ PositionContext

Enumerator
FieldWidthPos 
PrecisionPos 

Definition at line 690 of file FormatString.h.

Function Documentation

◆ ParseAmount()

OptionalAmount clang::analyze_format_string::ParseAmount ( const char *&  Beg,
const char *  E 
)

Definition at line 37 of file FormatString.cpp.

References c.

Referenced by ParseNonPositionAmount(), and ParsePositionAmount().

◆ ParseArgPosition()

bool clang::analyze_format_string::ParseArgPosition ( FormatStringHandler H,
FormatSpecifier CS,
const char *  Start,
const char *&  Beg,
const char *  E 
)

Definition at line 144 of file FormatString.cpp.

◆ ParseFieldWidth()

bool clang::analyze_format_string::ParseFieldWidth ( FormatStringHandler H,
FormatSpecifier CS,
const char *  Start,
const char *&  Beg,
const char *  E,
unsigned argIndex 
)

◆ parseFormatStringHasFormattingSpecifiers()

bool clang::analyze_format_string::parseFormatStringHasFormattingSpecifiers ( const char *  Begin,
const char *  End,
const LangOptions LO,
const TargetInfo Target 
)

◆ ParseFormatStringHasSArg()

bool clang::analyze_format_string::ParseFormatStringHasSArg ( const char *  beg,
const char *  end,
const LangOptions LO,
const TargetInfo Target 
)

◆ ParseLengthModifier()

bool clang::analyze_format_string::ParseLengthModifier ( FormatSpecifier FS,
const char *&  Beg,
const char *  E,
const LangOptions LO,
bool  IsScanf = false 
)

Returns true if a LengthModifier was parsed and installed in the FormatSpecifier& argument, and false otherwise.

Definition at line 211 of file FormatString.cpp.

◆ ParseNonPositionAmount()

OptionalAmount clang::analyze_format_string::ParseNonPositionAmount ( const char *&  Beg,
const char *  E,
unsigned argIndex 
)

Definition at line 63 of file FormatString.cpp.

References ParseAmount().

Referenced by ParseFieldWidth().

◆ ParsePositionAmount()

OptionalAmount clang::analyze_format_string::ParsePositionAmount ( FormatStringHandler H,
const char *  Start,
const char *&  Beg,
const char *  E,
PositionContext  p 
)

◆ ParsePrintfString()

bool clang::analyze_format_string::ParsePrintfString ( FormatStringHandler H,
const char *  beg,
const char *  end,
const LangOptions LO,
const TargetInfo Target,
bool  isFreeBSDKPrintf 
)

◆ ParseScanfString()

bool clang::analyze_format_string::ParseScanfString ( FormatStringHandler H,
const char *  beg,
const char *  end,
const LangOptions LO,
const TargetInfo Target 
)

◆ ParseUTF8InvalidSpecifier()

bool clang::analyze_format_string::ParseUTF8InvalidSpecifier ( const char *  SpecifierBegin,
const char *  FmtStrEnd,
unsigned Len 
)

Returns true if the invalid specifier in SpecifierBegin is a UTF-8 string; check that it won't go further than FmtStrEnd and write up the total size in Len.

Definition at line 296 of file FormatString.cpp.

◆ ParseVectorModifier()

bool clang::analyze_format_string::ParseVectorModifier ( FormatStringHandler H,
FormatSpecifier FS,
const char *&  Beg,
const char *  E,
const LangOptions LO 
)

Definition at line 181 of file FormatString.cpp.