clang 20.0.0git
|
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. | |
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. | |
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 . | |
Common components of both fprintf and fscanf format strings.
Enumerator | |
---|---|
FieldWidthPos | |
PrecisionPos |
Definition at line 714 of file FormatString.h.
OptionalAmount clang::analyze_format_string::ParseAmount | ( | const char *& | Beg, |
const char * | E | ||
) |
Definition at line 37 of file FormatString.cpp.
References c, clang::analyze_format_string::OptionalAmount::Constant, and E.
Referenced by ParseArgPosition(), ParseNonPositionAmount(), ParsePositionAmount(), ParseScanfSpecifier(), and ParseVectorModifier().
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.
References clang::analyze_format_string::OptionalAmount::Constant, E, clang::analyze_format_string::OptionalAmount::getConstantAmount(), clang::analyze_format_string::OptionalAmount::getHowSpecified(), clang::analyze_format_string::FormatStringHandler::HandleIncompleteSpecifier(), clang::analyze_format_string::FormatStringHandler::HandlePosition(), clang::analyze_format_string::FormatStringHandler::HandleZeroPosition(), and ParseAmount().
bool clang::analyze_format_string::ParseFieldWidth | ( | FormatStringHandler & | H, |
FormatSpecifier & | CS, | ||
const char * | Start, | ||
const char *& | Beg, | ||
const char * | E, | ||
unsigned * | argIndex | ||
) |
Definition at line 122 of file FormatString.cpp.
References E, FieldWidthPos, clang::analyze_format_string::OptionalAmount::isInvalid(), ParseNonPositionAmount(), ParsePositionAmount(), and clang::analyze_format_string::FormatSpecifier::setFieldWidth().
bool clang::analyze_format_string::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.
Definition at line 486 of file PrintfFormatString.cpp.
References Begin, clang::analyze_format_string::SpecifierResult< T >::hasValue(), ParsePrintfSpecifier(), and clang::analyze_format_string::SpecifierResult< T >::shouldStop().
Referenced by CheckFormatString().
bool clang::analyze_format_string::ParseFormatStringHasSArg | ( | const char * | beg, |
const char * | end, | ||
const LangOptions & | LO, | ||
const TargetInfo & | Target | ||
) |
Definition at line 457 of file PrintfFormatString.cpp.
References E, clang::analyze_format_string::SpecifierResult< T >::getValue(), clang::analyze_format_string::SpecifierResult< T >::hasValue(), ParsePrintfSpecifier(), clang::analyze_format_string::ConversionSpecifier::sArg, and clang::analyze_format_string::SpecifierResult< T >::shouldStop().
Referenced by clang::Sema::FormatStringHasSArg().
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.
References 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::AsShortLong, clang::analyze_format_string::LengthModifier::AsSizeT, clang::analyze_format_string::LengthModifier::AsWide, E, and clang::analyze_format_string::LengthModifier::None.
OptionalAmount clang::analyze_format_string::ParseNonPositionAmount | ( | const char *& | Beg, |
const char * | E, | ||
unsigned & | argIndex | ||
) |
Definition at line 63 of file FormatString.cpp.
References clang::analyze_format_string::OptionalAmount::Arg, E, and ParseAmount().
Referenced by ParseFieldWidth().
OptionalAmount clang::analyze_format_string::ParsePositionAmount | ( | FormatStringHandler & | H, |
const char * | Start, | ||
const char *& | Beg, | ||
const char * | E, | ||
PositionContext | p | ||
) |
Definition at line 75 of file FormatString.cpp.
References clang::analyze_format_string::OptionalAmount::Arg, clang::analyze_format_string::OptionalAmount::Constant, E, clang::analyze_format_string::OptionalAmount::getConstantAmount(), clang::analyze_format_string::OptionalAmount::getHowSpecified(), clang::analyze_format_string::FormatStringHandler::HandleIncompleteSpecifier(), clang::analyze_format_string::FormatStringHandler::HandleInvalidPosition(), clang::analyze_format_string::FormatStringHandler::HandleZeroPosition(), clang::analyze_format_string::OptionalAmount::NotSpecified, and ParseAmount().
Referenced by ParseFieldWidth().
bool clang::analyze_format_string::ParsePrintfString | ( | FormatStringHandler & | H, |
const char * | beg, | ||
const char * | end, | ||
const LangOptions & | LO, | ||
const TargetInfo & | Target, | ||
bool | isFreeBSDKPrintf | ||
) |
Definition at line 426 of file PrintfFormatString.cpp.
References E, clang::analyze_format_string::SpecifierResult< T >::getStart(), clang::analyze_format_string::SpecifierResult< T >::getValue(), clang::analyze_format_string::FormatStringHandler::HandlePrintfSpecifier(), clang::analyze_format_string::SpecifierResult< T >::hasValue(), ParsePrintfSpecifier(), and clang::analyze_format_string::SpecifierResult< T >::shouldStop().
Referenced by CheckFormatString(), and clang::ast_matchers::libc_func_matchers::hasUnsafeFormatOrSArg().
bool clang::analyze_format_string::ParseScanfString | ( | FormatStringHandler & | H, |
const char * | beg, | ||
const char * | end, | ||
const LangOptions & | LO, | ||
const TargetInfo & | Target | ||
) |
Definition at line 539 of file ScanfFormatString.cpp.
References E, clang::analyze_format_string::SpecifierResult< T >::getStart(), clang::analyze_format_string::SpecifierResult< T >::getValue(), clang::analyze_format_string::FormatStringHandler::HandleScanfSpecifier(), clang::analyze_format_string::SpecifierResult< T >::hasValue(), ParseScanfSpecifier(), and clang::analyze_format_string::SpecifierResult< T >::shouldStop().
Referenced by CheckFormatString().
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.
bool clang::analyze_format_string::ParseVectorModifier | ( | FormatStringHandler & | H, |
FormatSpecifier & | FS, | ||
const char *& | Beg, | ||
const char * | E, | ||
const LangOptions & | LO | ||
) |