17#include "llvm/Support/ConvertUTF.h" 
   39  UpdateOnReturn <const char*> UpdateBeg(Beg, I);
 
   41  unsigned accumulator = 0;
 
   42  bool hasDigits = 
false;
 
   44  for ( ; I != E; ++I) {
 
   46    if (
c >= 
'0' && 
c <= 
'9') {
 
   48      accumulator = (accumulator * 10) + (
c - 
'0');
 
 
   81    const char *I = Beg + 1;
 
  106      const char *Tmp = Beg;
 
 
  125                                              const char *&Beg, 
const char *E,
 
  126                                              unsigned *argIndex) {
 
 
  189  const char *Start = I;
 
 
  217  const char *lmPosition = I;
 
  223      if (I != E && *I == 
'h') {
 
  226      } 
else if (I != E && *I == 
'l' && LO.OpenCL) {
 
  235      if (I != E && *I == 
'l') {
 
  248      if (IsScanf && !LO.C99 && !LO.CPlusPlus11) {
 
  253        if (I != E && (*I == 
's' || *I == 
'S' || *I == 
'[')) {
 
  270      if (I + 1 != E && I + 2 != E) {
 
  271        if (I[1] == 
'6' && I[2] == 
'4') {
 
  279        if (I[1] == 
'3' && I[2] == 
'2') {
 
 
  297    const char *SpecifierBegin, 
const char *FmtStrEnd, 
unsigned &Len) {
 
  298  if (SpecifierBegin + 1 >= FmtStrEnd)
 
  301  const llvm::UTF8 *SB =
 
  302      reinterpret_cast<const llvm::UTF8 *
>(SpecifierBegin + 1);
 
  303  const llvm::UTF8 *SE = 
reinterpret_cast<const llvm::UTF8 *
>(FmtStrEnd);
 
  304  const char FirstByte = *SB;
 
  309  unsigned NumBytes = llvm::getNumBytesForUTF8(FirstByte);
 
  312  if (SB + NumBytes > SE)
 
 
  328    const auto *TD = TT->getDecl();
 
  329    const auto *DC = TT->getDecl()->getDeclContext();
 
  330    if (DC->isTranslationUnit() || DC->isStdNamespace()) {
 
  331      StringRef Name = TD->getIdentifier()->getName();
 
  332      if (Name == 
"size_t") {
 
  335      } 
else if (Name == 
"ssize_t" ) {
 
  338      } 
else if (Name == 
"ptrdiff_t") {
 
  341      } 
else if (Name == 
"intmax_t") {
 
  344      } 
else if (Name == 
"uintmax_t") {
 
  352    switch (PST->getKind()) {
 
  354    case Kind::SignedSizeT:
 
  361    llvm_unreachable(
"unexpected kind");
 
 
  374  if (!
T->isIntegerType())
 
  375    return MatchKind::NoMatch;
 
  377  if (
C.hasSameType(
T, E))
 
  378    return MatchKind::Match;
 
  380  if (
C.getCorrespondingSignedType(
T.getCanonicalType()) !=
 
  382    return MatchKind::NoMatch;
 
  384  return MatchKind::NoMatchSignedness;
 
 
  393    argTy = 
C.getDecayedType(argTy);
 
  410      llvm_unreachable(
"ArgType must be valid");
 
  420        if (!ED->isComplete())
 
  423          argTy = ED->getIntegerType();
 
  428        switch (BT->getKind()) {
 
  431        case BuiltinType::Char_S:
 
  432        case BuiltinType::SChar:
 
  433        case BuiltinType::UChar:
 
  434        case BuiltinType::Char_U:
 
  436        case BuiltinType::Bool:
 
  443          switch (BT->getKind()) {
 
  446          case BuiltinType::Int:
 
  447          case BuiltinType::UInt:
 
  449          case BuiltinType::Short:
 
  450          case BuiltinType::UShort:
 
  451          case BuiltinType::WChar_S:
 
  452          case BuiltinType::WChar_U:
 
  461      if (TK != TypeKind::DontCare) {
 
  469        if (!ED->isComplete())
 
  471        else if (!ED->isScoped())
 
  472          argTy = ED->getIntegerType();
 
  476        argTy = 
C.getCorrespondingUnsaturatedType(argTy);
 
  478      argTy = 
C.getCanonicalType(argTy).getUnqualifiedType();
 
  485        switch (BT->getKind()) {
 
  488          case BuiltinType::Bool:
 
  489            if (Ptr && (T == 
C.UnsignedCharTy || T == 
C.SignedCharTy))
 
  492          case BuiltinType::Char_S:
 
  493          case BuiltinType::SChar:
 
  494            if (T == 
C.UnsignedShortTy || T == 
C.ShortTy)
 
  496            if (T == 
C.UnsignedCharTy)
 
  498            if (T == 
C.SignedCharTy)
 
  501          case BuiltinType::Char_U:
 
  502          case BuiltinType::UChar:
 
  503            if (T == 
C.UnsignedShortTy || T == 
C.ShortTy)
 
  505            if (T == 
C.UnsignedCharTy)
 
  507            if (T == 
C.SignedCharTy)
 
  510          case BuiltinType::Short:
 
  511            if (T == 
C.UnsignedShortTy)
 
  514          case BuiltinType::UShort:
 
  518          case BuiltinType::Int:
 
  519            if (T == 
C.UnsignedIntTy)
 
  522          case BuiltinType::UInt:
 
  526          case BuiltinType::Long:
 
  527            if (T == 
C.UnsignedLongTy)
 
  530          case BuiltinType::ULong:
 
  534          case BuiltinType::LongLong:
 
  535            if (T == 
C.UnsignedLongLongTy)
 
  538          case BuiltinType::ULongLong:
 
  539            if (T == 
C.LongLongTy)
 
  545            switch (BT->getKind()) {
 
  548            case BuiltinType::Bool:
 
  549              if (T == 
C.IntTy || T == 
C.UnsignedIntTy)
 
  552            case BuiltinType::Int:
 
  553            case BuiltinType::UInt:
 
  554              if (T == 
C.SignedCharTy || T == 
C.UnsignedCharTy ||
 
  555                  T == 
C.ShortTy || T == 
C.UnsignedShortTy || T == 
C.WCharTy ||
 
  559            case BuiltinType::Char_U:
 
  560              if (T == 
C.UnsignedIntTy)
 
  562              if (T == 
C.UnsignedShortTy)
 
  565            case BuiltinType::Char_S:
 
  571            case BuiltinType::Half:
 
  572            case BuiltinType::Float:
 
  576            case BuiltinType::Short:
 
  577            case BuiltinType::UShort:
 
  578              if (T == 
C.SignedCharTy || T == 
C.UnsignedCharTy)
 
  581            case BuiltinType::WChar_U:
 
  582            case BuiltinType::WChar_S:
 
  583              if (T != 
C.WCharTy && T != 
C.WideCharTy)
 
  600          C.hasSameUnqualifiedType(PT->getPointeeType(), 
C.getWideCharType()))
 
  605      QualType WInt = 
C.getCanonicalType(
C.getWIntType()).getUnqualifiedType();
 
  607      if (
C.getCanonicalType(argTy).getUnqualifiedType() == WInt)
 
  610      QualType PromoArg = 
C.isPromotableIntegerType(argTy)
 
  611                              ? 
C.getPromotedIntegerType(argTy)
 
  613      PromoArg = 
C.getCanonicalType(PromoArg).getUnqualifiedType();
 
  618          C.getCorrespondingUnsignedType(PromoArg) == WInt)
 
  663  llvm_unreachable(
"Invalid ArgType Kind!");
 
 
  670  uint64_t IntSize = 
C.getTypeSize(
C.IntTy);
 
  671  uint64_t ASize = 
C.getTypeSize(A);
 
  672  uint64_t BSize = 
C.getTypeSize(B);
 
  673  if (std::max(ASize, IntSize) != std::max(BSize, IntSize))
 
  676    return MK::NoMatchSignedness;
 
  678    return MK::MatchPromotion;
 
 
  687  if (K == AK::InvalidTy || 
Other.K == AK::InvalidTy)
 
  689  if (K == AK::UnknownTy || 
Other.K == AK::UnknownTy)
 
  696  bool LeftWasPointer = 
false;
 
  698  bool RightWasPointer = 
false;
 
  701    LeftWasPointer = 
true;
 
  702  } 
else if (Left.K == AK::SpecificTy && Left.T->isPointerType()) {
 
  703    Left.T = Left.T->getPointeeType();
 
  704    LeftWasPointer = 
true;
 
  708    RightWasPointer = 
true;
 
  709  } 
else if (Right.K == AK::SpecificTy && Right.T->isPointerType()) {
 
  710    Right.T = Right.T->getPointeeType();
 
  711    RightWasPointer = 
true;
 
  714  if (LeftWasPointer != RightWasPointer)
 
  719  if (Right.K == AK::SpecificTy)
 
  720    std::swap(Left, Right);
 
  722  if (Left.K == AK::SpecificTy) {
 
  723    if (Right.K == AK::SpecificTy) {
 
  724      if (Left.TK != TypeKind::DontCare) {
 
  726      } 
else if (Right.TK != TypeKind::DontCare) {
 
  730      auto Canon1 = 
C.getCanonicalType(Left.T);
 
  731      auto Canon2 = 
C.getCanonicalType(Right.T);
 
  732      if (Canon1 == Canon2)
 
  737      if (BT1 == 
nullptr || BT2 == 
nullptr)
 
  742      if (!LeftWasPointer && BT1->isInteger() && BT2->
isInteger())
 
  745    } 
else if (Right.K == AK::AnyCharTy) {
 
  746      if (!LeftWasPointer && Left.T->isIntegerType())
 
  749    } 
else if (Right.K == AK::WIntTy) {
 
  750      if (!LeftWasPointer && Left.T->isIntegerType())
 
 
  768  QualType Vec = 
C.getExtVectorType(T, NumElts);
 
 
  776      llvm_unreachable(
"No representative type for Invalid ArgType");
 
  778      llvm_unreachable(
"No representative type for Unknown ArgType");
 
  783      if (TK == TypeKind::PtrdiffT || TK == TypeKind::SizeT)
 
  790      Res = 
C.getPointerType(
C.CharTy);
 
  793      Res = 
C.getPointerType(
C.getWideCharType());
 
  796      Res = 
C.ObjCBuiltinIdTy;
 
  802      Res = 
C.getWIntType();
 
  808    Res = 
C.getPointerType(Res);
 
 
  820      Alias += (Alias[Alias.size()-1] == 
'*') ? 
"*" : 
" *";
 
  828    return std::string(
"'") + Alias + 
"' (aka '" + S + 
"')";
 
  829  return std::string(
"'") + S + 
"'";
 
 
  893  case bArg: 
return "b";
 
  894  case BArg: 
return "B";
 
  895  case dArg: 
return "d";
 
  896  case DArg: 
return "D";
 
  897  case iArg: 
return "i";
 
  898  case oArg: 
return "o";
 
  899  case OArg: 
return "O";
 
  900  case uArg: 
return "u";
 
  901  case UArg: 
return "U";
 
  902  case xArg: 
return "x";
 
  903  case XArg: 
return "X";
 
  904  case fArg: 
return "f";
 
  905  case FArg: 
return "F";
 
  906  case eArg: 
return "e";
 
  907  case EArg: 
return "E";
 
  908  case gArg: 
return "g";
 
  909  case GArg: 
return "G";
 
  910  case aArg: 
return "a";
 
  911  case AArg: 
return "A";
 
  912  case cArg: 
return "c";
 
  913  case sArg: 
return "s";
 
  914  case pArg: 
return "p";
 
  917  case nArg: 
return "n";
 
  923  case CArg: 
return "C";
 
  924  case SArg: 
return "S";
 
  939  case ZArg: 
return "Z";
 
 
  954std::optional<ConversionSpecifier>
 
 1004  switch (
LM.getKind()) {
 
 1011      if (LO.OpenCL && 
CS.isDoubleArg())
 
 1014      if (
CS.isFixedPointArg())
 
 1017      if (
Target.getTriple().isOSMSVCRT()) {
 
 1018        switch (
CS.getKind()) {
 
 1036      switch (
CS.getKind()) {
 
 1052          return Target.getTriple().isOSFreeBSD() || 
Target.getTriple().isPS();
 
 1062      if (
CS.isDoubleArg()) {
 
 1069      if (
CS.isFixedPointArg())
 
 1072      switch (
CS.getKind()) {
 
 1092          return Target.getTriple().isOSFreeBSD() || 
Target.getTriple().isPS();
 
 1098      switch (
CS.getKind()) {
 
 1115          return !
Target.getTriple().isOSDarwin() &&
 
 1116                 !
Target.getTriple().isOSWindows();
 
 1122      switch (
CS.getKind()) {
 
 1132      switch (
CS.getKind()) {
 
 1145      switch (
CS.getKind()) {
 
 1152          return Target.getTriple().isOSMSVCRT();
 
 1157      switch (
CS.getKind()) {
 
 1163          return Target.getTriple().isOSMSVCRT();
 
 1168  llvm_unreachable(
"Invalid LengthModifier Kind!");
 
 
 1172  switch (
LM.getKind()) {
 
 1193  llvm_unreachable(
"Invalid LengthModifier Kind!");
 
 
 1198  switch (
CS.getKind()) {
 
 1226      return LangOpt.ObjC;
 
 1242      return LangOpt.FixedPoint;
 
 1244  llvm_unreachable(
"Invalid ConversionSpecifier Kind!");
 
 
 1249    switch(
CS.getKind()) {
 
 
 1264std::optional<LengthModifier>
 
 1275  return std::nullopt;
 
 
Defines the clang::LangOptions interface.
__device__ __2f16 float c
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
This class is used for builtin types like 'int'.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents a pointer to an Objective C object.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
A (possibly-)qualified type.
QualType getCanonicalType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Exposes information about the current target.
bool isStructureType() const
bool isBlockPointerType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
@ Other
Other implicit parameter.