27 using namespace clang;
34 const char *&Beg,
const char *
E) {
36 const char *start = I - 1;
54 if (I + 1 != E && I[0] ==
'^' && I[1] ==
']') {
82 using namespace clang::analyze_format_string;
83 using namespace clang::analyze_scanf;
85 const char *Start =
nullptr;
89 for ( ;
I !=
E ; ++
I) {
124 FS.setSuppressAssignment(
I);
136 FS.setFieldWidth(Amt);
159 const char *conversionPosition =
I++;
161 switch (*conversionPosition) {
202 if (k == ScanfConversionSpecifier::ScanListArg) {
206 FS.setConversionSpecifier(CS);
208 && !FS.usesPositionalArg())
209 FS.setArgIndex(argIndex++);
214 if (k == ScanfConversionSpecifier::InvalidSpecifier) {
215 unsigned Len =
I - Beg;
218 FS.setConversionSpecifier(CS);
237 switch (LM.getKind()) {
276 switch (LM.getKind()) {
317 switch (LM.getKind()) {
332 switch (LM.getKind()) {
350 switch (LM.getKind()) {
370 switch (LM.getKind()) {
422 PT = ETy->getDecl()->getIntegerType();
440 CAT->getSize().getZExtValue() - 1,
450 case BuiltinType::UInt:
451 case BuiltinType::Int:
452 case BuiltinType::Float:
457 case BuiltinType::Char_U:
458 case BuiltinType::UChar:
459 case BuiltinType::Char_S:
460 case BuiltinType::SChar:
465 case BuiltinType::Short:
466 case BuiltinType::UShort:
471 case BuiltinType::Long:
472 case BuiltinType::ULong:
473 case BuiltinType::Double:
478 case BuiltinType::LongLong:
479 case BuiltinType::ULongLong:
484 case BuiltinType::LongDouble:
494 if (isa<TypedefType>(PT) && (LangOpt.C99 || LangOpt.CPlusPlus11))
495 namedTypeToLengthModifier(PT, LM);
499 const analyze_scanf::ArgType &AT = getArgType(Ctx);
500 if (AT.isValid() && AT.matchesType(Ctx, QT))
512 llvm_unreachable(
"Unexpected type");
520 if (usesPositionalArg())
521 os << getPositionalArgIndex() <<
"$";
522 if (SuppressAssignment)
525 FieldWidth.toString(os);
536 unsigned argIndex = 0;
556 assert(I == E &&
"Format string not exhausted");
A (possibly-)qualified type.
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
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...
const TargetInfo & getTargetInfo() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
detail::InMemoryDirectory::const_iterator I
CanQualType UnsignedCharTy
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isRealFloatingType() const
Floating point categories.
Exposes information about the current target.
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getWideCharType() const
Return the type of wide characters.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType UnsignedShortTy
CanQualType UnsignedLongLongTy
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
detail::InMemoryDirectory::const_iterator E
bool isWideCharType() const
std::string toString(const til::SExpr *E)
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
const T * getAs() const
Member-template getAs<specific type>'.
CanQualType UnsignedLongTy
This class is used for builtin types like 'int'.
Defines the clang::TargetInfo interface.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Represents the canonical version of C arrays with a specified constant size.
CanQualType UnsignedIntTy
bool isPointerType() const