18#ifndef LLVM_CLANG_AST_FORMATSTRING_H
19#define LLVM_CLANG_AST_FORMATSTRING_H
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; }
60 const char *representation;
92 const char *
getStart()
const {
return Position; }
115 const char *Position;
301 const char *Name =
nullptr;
306 enum class TypeKind { DontCare,
SizeT, PtrdiffT };
307 TypeKind TK = TypeKind::DontCare;
317 bool isSizeT()
const {
return TK == TypeKind::SizeT; }
323 assert(A.K >=
InvalidTy &&
"ArgType cannot be pointer to invalid/unknown");
332 Res.TK = TypeKind::SizeT;
340 Res.TK = TypeKind::PtrdiffT;
359 const char *amountStart,
unsigned amountLength,
361 : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
366 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
370 UsesPositionalArg(
false), UsesDotPrefix(
false) {}
391 return start - UsesDotPrefix;
396 return length + UsesDotPrefix;
400 return StringRef(start - UsesDotPrefix, length + UsesDotPrefix);
405 void toString(raw_ostream &os)
const;
421 bool UsesPositionalArg : 1;
532 IsLeftJustified(
"-"), HasPlusPrefix(
"+"), HasSpacePrefix(
" "),
533 HasAlternativeForm(
"#"), HasLeadingZeroes(
"0"),
534 HasObjCTechnicalTerm(
"tt"), IsPrivate(
"private"), IsPublic(
"public"),
535 IsSensitive(
"sensitive") {}
542 HasThousandsGrouping.setPosition(position);
545 IsLeftJustified.setPosition(position);
548 HasPlusPrefix.setPosition(position);
551 HasSpacePrefix.setPosition(position);
554 HasAlternativeForm.setPosition(position);
557 HasLeadingZeroes.setPosition(position);
560 HasObjCTechnicalTerm.setPosition(position);
562 void setIsPrivate(
const char *position) { IsPrivate.setPosition(position); }
563 void setIsPublic(
const char *position) { IsPublic.setPosition(position); }
565 IsSensitive.setPosition(position);
594 return HasThousandsGrouping;
602 return HasObjCTechnicalTerm;
618 void toString(raw_ostream &os)
const;
664 SuppressAssignment.setPosition(position);
668 return SuppressAssignment;
678 return CS.consumesDataArgument() && !SuppressAssignment;
686 void toString(raw_ostream &os)
const;
715 unsigned specifierLen) {}
718 unsigned flagsLen) {}
725 const char *flagsEnd,
726 const char *conversionPosition) {}
731 unsigned specifierLen) {
736 const char *startSpecifier,
737 unsigned specifierLen,
749 const char *startSpecifier,
750 unsigned specifierLen) {
755 const char *startSpecifier,
756 unsigned specifierLen) {
765 bool isFreeBSDKPrintf);
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
ArgType(Kind K=UnknownTy, const char *N=nullptr)
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
Pieces specific to fprintf format strings.
Pieces specific to fscanf format strings.
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
U cast(CodeGen::Address addr)
float __ovld __cnfn length(float)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)