40 unsigned &argIndex)
const;
51 const char *E)
const {
53 const char *start = I - 1;
54 UpdateOnReturn<const char *> UpdateBeg(Beg, I);
58 H.HandleIncompleteScanList(start, I);
65 H.HandleIncompleteScanList(start, I - 1);
71 if (I + 1 != E && I[0] ==
'^' && I[1] ==
']') {
74 H.HandleIncompleteScanList(start, I - 1);
82 H.HandleIncompleteScanList(start, I - 1);
94ScanfFormatStringParser::parseSpecifier(
const char *&Beg,
const char *E,
95 unsigned &argIndex)
const {
96 using namespace clang::analyze_format_string;
97 using namespace clang::analyze_scanf;
99 const char *Start =
nullptr;
100 UpdateOnReturn<const char *> UpdateBeg(Beg, I);
103 for (; I != E; ++I) {
122 H.HandleIncompleteSpecifier(Start, E - Start);
127 if (parseArgPosition(FS, Start, I, E))
132 H.HandleIncompleteSpecifier(Start, E - Start);
140 H.HandleIncompleteSpecifier(Start, E - Start);
147 const OptionalAmount &Amt = parseAmount(I, E);
154 H.HandleIncompleteSpecifier(Start, E - Start);
160 if (parseLengthModifier(FS, I, E) && I == E) {
162 H.HandleIncompleteSpecifier(Start, E - Start);
173 const char *conversionPosition = I++;
175 switch (*conversionPosition) {
250 if (
Target.getTriple().isOSDarwin())
254 if (
Target.getTriple().isOSDarwin())
258 if (
Target.getTriple().isOSDarwin())
262 ScanfConversionSpecifier CS(conversionPosition, k);
264 if (parseScanList(CS, I, E))
276 unsigned Len = I - Beg;
277 if (parseUTF8InvalidSpecifier(Beg, E, Len)) {
282 return !H.HandleInvalidScanfConversionSpecifier(FS, Beg, Len);
290 if (!
CS.consumesDataArgument())
293 switch (
CS.getKind()) {
298 switch (
LM.getKind()) {
337 llvm_unreachable(
"Unsupported LengthModifier Type");
347 switch (
LM.getKind()) {
387 llvm_unreachable(
"Unsupported LengthModifier Type");
398 switch (
LM.getKind()) {
419 switch (
LM.getKind()) {
438 switch (
LM.getKind()) {
459 switch (
LM.getKind()) {
520 if (!ED->isComplete())
522 PT = ED->getIntegerType();
541 CAT->getZExtSize() - 1,
"", 0,
false);
549 case BuiltinType::UInt:
550 case BuiltinType::Int:
551 case BuiltinType::Float:
556 case BuiltinType::Char_U:
557 case BuiltinType::UChar:
558 case BuiltinType::Char_S:
559 case BuiltinType::SChar:
564 case BuiltinType::Short:
565 case BuiltinType::UShort:
570 case BuiltinType::Long:
571 case BuiltinType::ULong:
572 case BuiltinType::Double:
577 case BuiltinType::LongLong:
578 case BuiltinType::ULongLong:
583 case BuiltinType::LongDouble:
593 if (LangOpt.C99 || LangOpt.CPlusPlus11)
611 llvm_unreachable(
"Unexpected type");
621 if (SuppressAssignment)
635 unsigned argIndex = 0;
638 ScanfFormatStringParser P(H, LO,
Target);
655 assert(I == E &&
"Format string not exhausted");
llvm::MachO::Target Target
bool fixType(QualType QT, QualType RawQT, const LangOptions &LangOpt, ASTContext &Ctx)
void toString(raw_ostream &os) const
ArgType getArgType(ASTContext &Ctx) const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
CanQualType UnsignedLongTy
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
const TargetInfo & getTargetInfo() const
QualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
QualType getWideCharType() const
Return the type of wide characters.
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
This class is used for builtin types like 'int'.
Represents the canonical version of C arrays with a specified constant size.
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.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isRealFloatingType() const
Floating point categories.
bool isWideCharType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
const T * getAs() const
Member-template getAs<specific type>'.
static ArgType makePtrdiffT(const ArgType &A)
Create an ArgType which corresponds to the ptrdiff_t/unsigned ptrdiff_t type.
static ArgType PtrTo(const ArgType &A)
Create an ArgType which corresponds to the type pointer to A.
static ArgType Unsupported(const char *N)
static ArgType makeIntNType(ASTContext &Ctx, const LengthModifier &LengthMod, bool Signed)
static ArgType makeSizeT(const ArgType &A)
Create an ArgType which corresponds to the size_t/ssize_t type.
const OptionalFlag & getSuppressAssignment() const
void setConversionSpecifier(const ScanfConversionSpecifier &cs)
const ScanfConversionSpecifier & getConversionSpecifier() const
void setSuppressAssignment(const char *position)
ArgType getArgType(ASTContext &Ctx) const
Defines the clang::TargetInfo interface.
Top level wrappers for InstallAPI frontend operations.