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;
356 const char *amountStart,
357 unsigned amountLength,
359 : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
364 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
367 : start(nullptr), length(0), hs(
Constant), amt(Amount),
368 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
391 return start - UsesDotPrefix;
396 return length + UsesDotPrefix;
401 void toString(raw_ostream &os)
const;
417 bool UsesPositionalArg : 1;
501namespace analyze_printf {
545 IsLeftJustified(
"-"), HasPlusPrefix(
"+"), HasSpacePrefix(
" "),
546 HasAlternativeForm(
"#"), HasLeadingZeroes(
"0"),
547 HasObjCTechnicalTerm(
"tt"), IsPrivate(
"private"), IsPublic(
"public"),
548 IsSensitive(
"sensitive") {}
587 return cast<PrintfConversionSpecifier>(
CS);
611 return HasThousandsGrouping;
633 void toString(raw_ostream &os)
const;
651namespace analyze_scanf {
677 SuppressAssignment(
"*") {}
684 return SuppressAssignment;
692 return cast<ScanfConversionSpecifier>(
CS);
704 void toString(raw_ostream &os)
const;
714namespace analyze_format_string {
733 unsigned specifierLen) {}
736 unsigned flagsLen) {}
742 const char *flagsEnd,
743 const char *conversionPosition) {}
748 const char *startSpecifier,
749 unsigned specifierLen) {
754 const char *startSpecifier,
755 unsigned specifierLen,
767 const char *startSpecifier,
768 unsigned specifierLen) {
773 const char *startSpecifier,
774 unsigned specifierLen) {
782 const char *beg,
const char *end,
const LangOptions &LO,
789 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