18#ifndef LLVM_CLANG_AST_FORMATSTRING_H
19#define LLVM_CLANG_AST_FORMATSTRING_H
30namespace analyze_format_string {
37 : representation(Representation), flag(
false) {}
38 bool isSet()
const {
return flag; }
39 void set() { flag =
true; }
44 this->position = position;
50 const char *
toString()
const {
return representation; }
53 explicit operator bool()
const {
return flag; }
59 const char *representation;
89 : Position(nullptr), kind(
None) {}
91 : Position(pos), kind(k) {}
118 const char *Position;
295 const char *Name =
nullptr;
300 enum class TypeKind { DontCare, SizeT, PtrdiffT };
301 TypeKind TK = TypeKind::DontCare;
311 bool isSizeT()
const {
return TK == TypeKind::SizeT; }
317 assert(A.K >=
InvalidTy &&
"ArgType cannot be pointer to invalid/unknown");
326 Res.TK = TypeKind::SizeT;
334 Res.TK = TypeKind::PtrdiffT;
353 const char *amountStart,
354 unsigned amountLength,
356 : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
361 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
364 : start(nullptr), length(0), hs(
Constant), amt(Amount),
365 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
388 return start - UsesDotPrefix;
393 return length + UsesDotPrefix;
398 void toString(raw_ostream &os)
const;
414 bool UsesPositionalArg : 1;
497namespace analyze_printf {
541 IsLeftJustified(
"-"), HasPlusPrefix(
"+"), HasSpacePrefix(
" "),
542 HasAlternativeForm(
"#"), HasLeadingZeroes(
"0"),
543 HasObjCTechnicalTerm(
"tt"), IsPrivate(
"private"), IsPublic(
"public"),
544 IsSensitive(
"sensitive") {}
583 return cast<PrintfConversionSpecifier>(
CS);
607 return HasThousandsGrouping;
629 void toString(raw_ostream &os)
const;
647namespace analyze_scanf {
673 SuppressAssignment(
"*") {}
680 return SuppressAssignment;
688 return cast<ScanfConversionSpecifier>(
CS);
700 void toString(raw_ostream &os)
const;
710namespace analyze_format_string {
729 unsigned specifierLen) {}
732 unsigned flagsLen) {}
738 const char *flagsEnd,
739 const char *conversionPosition) {}
744 const char *startSpecifier,
745 unsigned specifierLen) {
750 const char *startSpecifier,
751 unsigned specifierLen,
763 const char *startSpecifier,
764 unsigned specifierLen) {
769 const char *startSpecifier,
770 unsigned specifierLen) {
778 const char *beg,
const char *end,
const LangOptions &LO,
785 const char *beg,
const char *end,
const LangOptions &LO,
llvm::MachO::Target Target
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A (possibly-)qualified type.
Exposes information about the current target.
PrintfConversionSpecifier(const char *pos, Kind k)
static bool classof(const analyze_format_string::ConversionSpecifier *CS)
PrintfConversionSpecifier()
const OptionalFlag & isPrivate() const
void setHasAlternativeForm(const char *position)
bool hasValidLeftJustified() const
void setIsSensitive(const char *position)
bool hasValidFieldWidth() const
void setMaskType(StringRef S)
void setHasSpacePrefix(const char *position)
bool hasValidSpacePrefix() const
void setHasThousandsGrouping(const char *position)
const OptionalAmount & getPrecision() const
static PrintfSpecifier Parse(const char *beg, const char *end)
const OptionalFlag & hasSpacePrefix() const
bool usesPositionalArg() const
void setIsLeftJustified(const char *position)
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.
StringRef getMaskType() const
const OptionalFlag & isSensitive() const
const OptionalFlag & isLeftJustified() const
bool hasValidPrecision() const
const OptionalFlag & hasLeadingZeros() const
const OptionalFlag & hasAlternativeForm() const
bool hasValidLeadingZeros() const
void setHasPlusPrefix(const char *position)
void setIsPrivate(const char *position)
void toString(raw_ostream &os) const
const PrintfConversionSpecifier & getConversionSpecifier() const
void setHasLeadingZeros(const char *position)
const OptionalFlag & hasPlusPrefix() const
const OptionalFlag & hasThousandsGrouping() const
void setUsesPositionalArg()
bool hasValidThousandsGroupingPrefix() const
ArgType getArgType(ASTContext &Ctx, bool IsObjCLiteral) const
Returns the builtin type that a data argument paired with this format specifier should have.
void setIsPublic(const char *position)
const OptionalFlag & hasObjCTechnicalTerm() const
void setPrecision(const OptionalAmount &Amt)
void setHasObjCTechnicalTerm(const char *position)
const OptionalFlag & isPublic() const
bool consumesDataArgument() const
bool hasValidPlusPrefix() const
void setConversionSpecifier(const PrintfConversionSpecifier &cs)
bool hasValidAlternativeForm() const
ScanfConversionSpecifier(const char *pos, Kind k)
ScanfConversionSpecifier()
static bool classof(const analyze_format_string::ConversionSpecifier *CS)
static ScanfSpecifier Parse(const char *beg, const char *end)
bool fixType(QualType QT, QualType RawQT, const LangOptions &LangOpt, ASTContext &Ctx)
const OptionalFlag & getSuppressAssignment() const
void toString(raw_ostream &os) const
bool consumesDataArgument() const
void setConversionSpecifier(const ScanfConversionSpecifier &cs)
const ScanfConversionSpecifier & getConversionSpecifier() const
void setSuppressAssignment(const char *position)
ArgType getArgType(ASTContext &Ctx) const
The JSON file list parser is used to communicate input to InstallAPI.