@@ -12583,6 +12583,7 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
1258312583 // Modifiers.
1258412584 int HowLong = 0;
1258512585 bool Signed = false, Unsigned = false;
12586+ bool IsChar = false, IsShort = false;
1258612587 RequiresICE = false;
1258712588
1258812589 // Read the prefixed modifiers first.
@@ -12606,8 +12607,29 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
1260612607 assert(!Unsigned && "Can't use 'U' modifier multiple times!");
1260712608 Unsigned = true;
1260812609 break;
12610+ case 'B':
12611+ // This modifier represents int8 type (byte-width).
12612+ assert(!IsSpecial &&
12613+ "Can't use two 'N', 'W', 'Z', 'O', 'B', or 'T' modifiers!");
12614+ assert(HowLong == 0 && "Can't use both 'L' and 'B' modifiers!");
12615+ #ifndef NDEBUG
12616+ IsSpecial = true;
12617+ #endif
12618+ IsChar = true;
12619+ break;
12620+ case 'T':
12621+ // This modifier represents int16 type (short-width).
12622+ assert(!IsSpecial &&
12623+ "Can't use two 'N', 'W', 'Z', 'O', 'B', or 'T' modifiers!");
12624+ assert(HowLong == 0 && "Can't use both 'L' and 'T' modifiers!");
12625+ #ifndef NDEBUG
12626+ IsSpecial = true;
12627+ #endif
12628+ IsShort = true;
12629+ break;
1260912630 case 'L':
12610- assert(!IsSpecial && "Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
12631+ assert(!IsSpecial &&
12632+ "Can't use 'L' with 'W', 'N', 'Z', 'O', 'B', or 'T' modifiers");
1261112633 assert(HowLong <= 2 && "Can't have LLLL modifier");
1261212634 ++HowLong;
1261312635 break;
@@ -12723,7 +12745,11 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
1272312745 Type = Context.ShortTy;
1272412746 break;
1272512747 case 'i':
12726- if (HowLong == 3)
12748+ if (IsChar)
12749+ Type = Unsigned ? Context.UnsignedCharTy : Context.SignedCharTy;
12750+ else if (IsShort)
12751+ Type = Unsigned ? Context.UnsignedShortTy : Context.ShortTy;
12752+ else if (HowLong == 3)
1272712753 Type = Unsigned ? Context.UnsignedInt128Ty : Context.Int128Ty;
1272812754 else if (HowLong == 2)
1272912755 Type = Unsigned ? Context.UnsignedLongLongTy : Context.LongLongTy;
0 commit comments