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;
297 const char *Name =
nullptr;
302 enum class TypeKind { DontCare, SizeT, PtrdiffT };
303 TypeKind TK = TypeKind::DontCare;
313 bool isSizeT()
const {
return TK == TypeKind::SizeT; }
319 assert(A.K >=
InvalidTy &&
"ArgType cannot be pointer to invalid/unknown");
328 Res.TK = TypeKind::SizeT;
336 Res.TK = TypeKind::PtrdiffT;
355 const char *amountStart,
356 unsigned amountLength,
358 : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
363 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
366 : start(nullptr), length(0), hs(
Constant), amt(Amount),
367 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
390 return start - UsesDotPrefix;
395 return length + UsesDotPrefix;
400 void toString(raw_ostream &os)
const;
416 bool UsesPositionalArg : 1;
499namespace analyze_printf {
543 IsLeftJustified(
"-"), HasPlusPrefix(
"+"), HasSpacePrefix(
" "),
544 HasAlternativeForm(
"#"), HasLeadingZeroes(
"0"),
545 HasObjCTechnicalTerm(
"tt"), IsPrivate(
"private"), IsPublic(
"public"),
546 IsSensitive(
"sensitive") {}
585 return cast<PrintfConversionSpecifier>(
CS);
609 return HasThousandsGrouping;
631 void toString(raw_ostream &os)
const;
649namespace analyze_scanf {
675 SuppressAssignment(
"*") {}
682 return SuppressAssignment;
690 return cast<ScanfConversionSpecifier>(
CS);
702 void toString(raw_ostream &os)
const;
712namespace analyze_format_string {
731 unsigned specifierLen) {}
734 unsigned flagsLen) {}
740 const char *flagsEnd,
741 const char *conversionPosition) {}
746 const char *startSpecifier,
747 unsigned specifierLen) {
752 const char *startSpecifier,
753 unsigned specifierLen,
765 const char *startSpecifier,
766 unsigned specifierLen) {
771 const char *startSpecifier,
772 unsigned specifierLen) {
780 const char *beg,
const char *end,
const LangOptions &LO,
787 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.
const FunctionProtoType * T