diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2021-12-06 12:46:54 -0500 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2021-12-06 12:52:01 -0500 |
commit | 6c75ab5f66b403f7ca67e86aeed3a58abe10570b (patch) | |
tree | 08a85a30d4be191d1d0dd512f718b8b3d940a500 /clang/lib/Sema | |
parent | a6816b957d28ab7855f2af1277c72a6d65b600b4 (diff) | |
download | llvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.zip llvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.tar.gz llvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.tar.bz2 |
Introduce _BitInt, deprecate _ExtInt
WG14 adopted the _ExtInt feature from Clang for C23, but renamed the
type to be _BitInt. This patch does the vast majority of the work to
rename _ExtInt to _BitInt, which accounts for most of its size. The new
type is exposed in older C modes and all C++ modes as a conforming
extension. However, there are functional changes worth calling out:
* Deprecates _ExtInt with a fix-it to help users migrate to _BitInt.
* Updates the mangling for the type.
* Updates the documentation and adds a release note to warn users what
is going on.
* Adds new diagnostics for use of _BitInt to call out when it's used as
a Clang extension or as a pre-C23 compatibility concern.
* Adds new tests for the new diagnostic behaviors.
I want to call out the ABI break specifically. We do not believe that
this break will cause a significant imposition for early adopters of
the feature, and so this is being done as a full break. If it turns out
there are critical uses where recompilation is not an option for some
reason, we can consider using ABI tags to ease the transition.
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 12 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 26 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateVariadic.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 36 | ||||
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 40 |
13 files changed, 85 insertions, 86 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 4405f29..d4dc790 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -365,7 +365,7 @@ bool Declarator::isDeclarationOfFunction() const { case TST_half: case TST_int: case TST_int128: - case TST_extint: + case TST_bitint: case TST_struct: case TST_interface: case TST_union: @@ -551,7 +551,7 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T, case DeclSpec::TST_char32: return "char32_t"; case DeclSpec::TST_int: return "int"; case DeclSpec::TST_int128: return "__int128"; - case DeclSpec::TST_extint: return "_ExtInt"; + case DeclSpec::TST_bitint: return "_BitInt"; case DeclSpec::TST_half: return "half"; case DeclSpec::TST_float: return "float"; case DeclSpec::TST_double: return "double"; @@ -932,7 +932,7 @@ bool DeclSpec::SetTypeSpecError() { return false; } -bool DeclSpec::SetExtIntType(SourceLocation KWLoc, Expr *BitsExpr, +bool DeclSpec::SetBitIntType(SourceLocation KWLoc, Expr *BitsExpr, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy) { assert(BitsExpr && "no expression provided!"); @@ -945,7 +945,7 @@ bool DeclSpec::SetExtIntType(SourceLocation KWLoc, Expr *BitsExpr, return true; } - TypeSpecType = TST_extint; + TypeSpecType = TST_bitint; ExprRep = BitsExpr; TSTLoc = KWLoc; TSTNameLoc = KWLoc; @@ -1252,7 +1252,7 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) { TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int. else if (TypeSpecType != TST_int && TypeSpecType != TST_int128 && TypeSpecType != TST_char && TypeSpecType != TST_wchar && - !IsFixedPointType && TypeSpecType != TST_extint) { + !IsFixedPointType && TypeSpecType != TST_bitint) { S.Diag(TSSLoc, diag::err_invalid_sign_spec) << getSpecifierName((TST)TypeSpecType, Policy); // signed double -> double. @@ -1302,7 +1302,7 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) { " double"); TypeSpecType = TST_double; // _Complex -> _Complex double. } else if (TypeSpecType == TST_int || TypeSpecType == TST_char || - TypeSpecType == TST_extint) { + TypeSpecType == TST_bitint) { // Note that this intentionally doesn't include _Complex _Bool. if (!S.getLangOpts().CPlusPlus) S.Diag(TSTLoc, diag::ext_integer_complex); diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index a2b8f47..734ed0f 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1881,8 +1881,8 @@ void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) { if (Ty->isDependentType()) return; - if (Ty->isExtIntType()) { - if (!Context.getTargetInfo().hasExtIntType()) { + if (Ty->isBitIntType()) { + if (!Context.getTargetInfo().hasBitIntType()) { PartialDiagnostic PD = PDiag(diag::err_target_unsupported_type); if (D) PD << D; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 33e2b3b..fc3886e 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -325,17 +325,17 @@ static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall, } } - // Disallow signed ExtIntType args larger than 128 bits to mul function until - // we improve backend support. + // Disallow signed bit-precise integer args larger than 128 bits to mul + // function until we improve backend support. if (BuiltinID == Builtin::BI__builtin_mul_overflow) { for (unsigned I = 0; I < 3; ++I) { const auto Arg = TheCall->getArg(I); // Third argument will be a pointer. auto Ty = I < 2 ? Arg->getType() : Arg->getType()->getPointeeType(); - if (Ty->isExtIntType() && Ty->isSignedIntegerType() && + if (Ty->isBitIntType() && Ty->isSignedIntegerType() && S.getASTContext().getIntWidth(Ty) > 128) return S.Diag(Arg->getBeginLoc(), - diag::err_overflow_builtin_ext_int_max_size) + diag::err_overflow_builtin_bit_int_max_size) << 128; } } @@ -5819,8 +5819,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, ? 0 : 1); - if (ValType->isExtIntType()) { - Diag(Ptr->getExprLoc(), diag::err_atomic_builtin_ext_int_prohibit); + if (ValType->isBitIntType()) { + Diag(Ptr->getExprLoc(), diag::err_atomic_builtin_bit_int_prohibit); return ExprError(); } @@ -6217,11 +6217,11 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { // gracefully. TheCall->setType(ResultType); - // Prohibit use of _ExtInt with atomic builtins. - // The arguments would have already been converted to the first argument's - // type, so only need to check the first argument. - const auto *ExtIntValType = ValType->getAs<ExtIntType>(); - if (ExtIntValType && !llvm::isPowerOf2_64(ExtIntValType->getNumBits())) { + // Prohibit problematic uses of bit-precise integer types with atomic + // builtins. The arguments would have already been converted to the first + // argument's type, so only need to check the first argument. + const auto *BitIntValType = ValType->getAs<BitIntType>(); + if (BitIntValType && !llvm::isPowerOf2_64(BitIntValType->getNumBits())) { Diag(FirstArg->getExprLoc(), diag::err_atomic_builtin_ext_int_size); return ExprError(); } @@ -11249,7 +11249,7 @@ struct IntRange { false/*NonNegative*/); } - if (const auto *EIT = dyn_cast<ExtIntType>(T)) + if (const auto *EIT = dyn_cast<BitIntType>(T)) return IntRange(EIT->getNumBits(), EIT->isUnsigned()); const BuiltinType *BT = cast<BuiltinType>(T); @@ -11275,7 +11275,7 @@ struct IntRange { if (const EnumType *ET = dyn_cast<EnumType>(T)) T = C.getCanonicalType(ET->getDecl()->getIntegerType()).getTypePtr(); - if (const auto *EIT = dyn_cast<ExtIntType>(T)) + if (const auto *EIT = dyn_cast<BitIntType>(T)) return IntRange(EIT->getNumBits(), EIT->isUnsigned()); const BuiltinType *BT = cast<BuiltinType>(T); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 7be71ca..421ca95 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -15359,7 +15359,7 @@ bool Sema::CheckEnumUnderlyingType(TypeSourceInfo *TI) { if (BT->isInteger()) return false; - if (T->isExtIntType()) + if (T->isBitIntType()) return false; return Diag(UnderlyingLoc, diag::err_enum_invalid_underlying) << T; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 4df8687..ba22c16 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4502,7 +4502,7 @@ void Sema::AddModeAttr(Decl *D, const AttributeCommonInfo &CI, return; } bool IntegralOrAnyEnumType = (OldElemTy->isIntegralOrEnumerationType() && - !OldElemTy->isExtIntType()) || + !OldElemTy->isBitIntType()) || OldElemTy->getAs<EnumType>(); if (!OldElemTy->getAs<BuiltinType>() && !OldElemTy->isComplexType() && diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index b305d4e..2b69c37 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4384,7 +4384,7 @@ static void captureVariablyModifiedType(ASTContext &Context, QualType T, case Type::ObjCObjectPointer: case Type::ObjCTypeParam: case Type::Pipe: - case Type::ExtInt: + case Type::BitInt: llvm_unreachable("type class is never variably-modified!"); case Type::Adjusted: T = cast<AdjustedType>(Ty)->getOriginalType(); @@ -8388,9 +8388,10 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, // If both operands have arithmetic type, do the usual arithmetic conversions // to find a common type: C99 6.5.15p3,5. if (LHSTy->isArithmeticType() && RHSTy->isArithmeticType()) { - // Disallow invalid arithmetic conversions, such as those between ExtInts of - // different sizes, or between ExtInts and other types. - if (ResTy.isNull() && (LHSTy->isExtIntType() || RHSTy->isExtIntType())) { + // Disallow invalid arithmetic conversions, such as those between bit- + // precise integers types of different sizes, or between a bit-precise + // integer and another type. + if (ResTy.isNull() && (LHSTy->isBitIntType() || RHSTy->isBitIntType())) { Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands) << LHSTy << RHSTy << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); @@ -10974,7 +10975,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS, QualType LHSExprType = LHS.get()->getType(); uint64_t LeftSize = S.Context.getTypeSize(LHSExprType); - if (LHSExprType->isExtIntType()) + if (LHSExprType->isBitIntType()) LeftSize = S.Context.getIntWidth(LHSExprType); else if (LHSExprType->isFixedPointType()) { auto FXSema = S.Context.getFixedPointSemantics(LHSExprType); diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 0711e6d..635e93b 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2935,7 +2935,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) { case Type::ExtVector: case Type::ConstantMatrix: case Type::Complex: - case Type::ExtInt: + case Type::BitInt: break; // Non-deduced auto types only get here for error cases. diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 603611b..49f7a8d 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -296,9 +296,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, checkExprMemoryConstraintCompat(*this, OutputExpr, Info, false)) return StmtError(); - // Disallow _ExtInt, since the backends tend to have difficulties with - // non-normal sizes. - if (OutputExpr->getType()->isExtIntType()) + // Disallow bit-precise integer types, since the backends tend to have + // difficulties with abnormal sizes. + if (OutputExpr->getType()->isBitIntType()) return StmtError( Diag(OutputExpr->getBeginLoc(), diag::err_asm_invalid_type) << OutputExpr->getType() << 0 /*Input*/ @@ -429,7 +429,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, } } - if (InputExpr->getType()->isExtIntType()) + if (InputExpr->getType()->isBitIntType()) return StmtError( Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_type) << InputExpr->getType() << 1 /*Output*/ @@ -924,7 +924,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, setFunctionHasBranchProtectedScope(); for (uint64_t I = 0; I < NumOutputs + NumInputs; ++I) { - if (Exprs[I]->getType()->isExtIntType()) + if (Exprs[I]->getType()->isBitIntType()) return StmtError( Diag(Exprs[I]->getBeginLoc(), diag::err_asm_invalid_type) << Exprs[I]->getType() << (I < NumOutputs) diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index f4fd2ea..2482f6d 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -6142,12 +6142,12 @@ bool UnnamedLocalNoLinkageFinder::VisitPipeType(const PipeType* T) { return false; } -bool UnnamedLocalNoLinkageFinder::VisitExtIntType(const ExtIntType *T) { +bool UnnamedLocalNoLinkageFinder::VisitBitIntType(const BitIntType *T) { return false; } -bool UnnamedLocalNoLinkageFinder::VisitDependentExtIntType( - const DependentExtIntType *T) { +bool UnnamedLocalNoLinkageFinder::VisitDependentBitIntType( + const DependentBitIntType *T) { return false; } @@ -7089,7 +7089,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, QualType IntegerType = ParamType; if (const EnumType *Enum = IntegerType->getAs<EnumType>()) IntegerType = Enum->getDecl()->getIntegerType(); - Value = Value.extOrTrunc(IntegerType->isExtIntType() + Value = Value.extOrTrunc(IntegerType->isBitIntType() ? Context.getIntWidth(IntegerType) : Context.getTypeSize(IntegerType)); @@ -7184,7 +7184,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, // Coerce the template argument's value to the value it will have // based on the template parameter's type. - unsigned AllowedBits = IntegerType->isExtIntType() + unsigned AllowedBits = IntegerType->isBitIntType() ? Context.getIntWidth(IntegerType) : Context.getTypeSize(IntegerType); if (Value.getBitWidth() != AllowedBits) diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 81edae1..d527a37 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1597,7 +1597,7 @@ static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch( case Type::ObjCObject: case Type::ObjCInterface: case Type::ObjCObjectPointer: - case Type::ExtInt: + case Type::BitInt: return (TDF & TDF_SkipNonDependent) || ((TDF & TDF_IgnoreQualifiers) ? S.Context.hasSameUnqualifiedType(P, A) @@ -2145,9 +2145,9 @@ static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch( return Sema::TDK_NonDeducedMismatch; } case Type::DependentExtInt: { - const auto *IP = P->castAs<DependentExtIntType>(); + const auto *IP = P->castAs<DependentBitIntType>(); - if (const auto *IA = A->getAs<ExtIntType>()) { + if (const auto *IA = A->getAs<BitIntType>()) { if (IP->isUnsigned() != IA->isUnsigned()) return Sema::TDK_NonDeducedMismatch; @@ -2164,7 +2164,7 @@ static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch( Deduced); } - if (const auto *IA = A->getAs<DependentExtIntType>()) { + if (const auto *IA = A->getAs<DependentBitIntType>()) { if (IP->isUnsigned() != IA->isUnsigned()) return Sema::TDK_NonDeducedMismatch; return Sema::TDK_Success; @@ -5949,9 +5949,9 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T, cast<DeducedType>(T)->getDeducedType(), OnlyDeduced, Depth, Used); break; - case Type::DependentExtInt: + case Type::DependentBitInt: MarkUsedTemplateParameters(Ctx, - cast<DependentExtIntType>(T)->getNumBitsExpr(), + cast<DependentBitIntType>(T)->getNumBitsExpr(), OnlyDeduced, Depth, Used); break; @@ -5966,7 +5966,7 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T, case Type::ObjCObjectPointer: case Type::UnresolvedUsing: case Type::Pipe: - case Type::ExtInt: + case Type::BitInt: #define TYPE(Class, Base) #define ABSTRACT_TYPE(Class, Base) #define DEPENDENT_TYPE(Class, Base) diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index c0bb310..51c79e9 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -870,7 +870,7 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) { case TST_typeofExpr: case TST_decltype: - case TST_extint: + case TST_bitint: if (DS.getRepAsExpr() && DS.getRepAsExpr()->containsUnexpandedParameterPack()) return true; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index d2ee669..b786c9f 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1435,12 +1435,11 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { } break; } - case DeclSpec::TST_extint: { - if (!S.Context.getTargetInfo().hasExtIntType()) - S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) - << "_ExtInt"; + case DeclSpec::TST_bitint: { + if (!S.Context.getTargetInfo().hasBitIntType()) + S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) << "_BitInt"; Result = - S.BuildExtIntType(DS.getTypeSpecSign() == TypeSpecifierSign::Unsigned, + S.BuildBitIntType(DS.getTypeSpecSign() == TypeSpecifierSign::Unsigned, DS.getRepAsExpr(), DS.getBeginLoc()); if (Result.isNull()) { Result = Context.IntTy; @@ -2237,7 +2236,7 @@ QualType Sema::BuildWritePipeType(QualType T, SourceLocation Loc) { return Context.getWritePipeType(T); } -/// Build a extended int type. +/// Build a bit-precise integer type. /// /// \param IsUnsigned Boolean representing the signedness of the type. /// @@ -2245,10 +2244,10 @@ QualType Sema::BuildWritePipeType(QualType T, SourceLocation Loc) { /// that. /// /// \param Loc Location of the keyword. -QualType Sema::BuildExtIntType(bool IsUnsigned, Expr *BitWidth, +QualType Sema::BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc) { if (BitWidth->isInstantiationDependent()) - return Context.getDependentExtIntType(IsUnsigned, BitWidth); + return Context.getDependentBitIntType(IsUnsigned, BitWidth); llvm::APSInt Bits(32); ExprResult ICE = @@ -2259,22 +2258,22 @@ QualType Sema::BuildExtIntType(bool IsUnsigned, Expr *BitWidth, int64_t NumBits = Bits.getSExtValue(); if (!IsUnsigned && NumBits < 2) { - Diag(Loc, diag::err_ext_int_bad_size) << 0; + Diag(Loc, diag::err_bit_int_bad_size) << 0; return QualType(); } if (IsUnsigned && NumBits < 1) { - Diag(Loc, diag::err_ext_int_bad_size) << 1; + Diag(Loc, diag::err_bit_int_bad_size) << 1; return QualType(); } if (NumBits > llvm::IntegerType::MAX_INT_BITS) { - Diag(Loc, diag::err_ext_int_max_size) << IsUnsigned - << llvm::IntegerType::MAX_INT_BITS; + Diag(Loc, diag::err_bit_int_max_size) + << IsUnsigned << llvm::IntegerType::MAX_INT_BITS; return QualType(); } - return Context.getExtIntType(IsUnsigned, NumBits); + return Context.getBitIntType(IsUnsigned, NumBits); } /// Check whether the specified array bound can be evaluated using the relevant @@ -6077,11 +6076,11 @@ namespace { TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc()); } - void VisitExtIntTypeLoc(ExtIntTypeLoc TL) { + void VisitExtIntTypeLoc(BitIntTypeLoc TL) { TL.setNameLoc(DS.getTypeSpecTypeLoc()); } - void VisitDependentExtIntTypeLoc(DependentExtIntTypeLoc TL) { + void VisitDependentExtIntTypeLoc(DependentBitIntTypeLoc TL) { TL.setNameLoc(DS.getTypeSpecTypeLoc()); } @@ -6211,7 +6210,7 @@ namespace { assert(Chunk.Kind == DeclaratorChunk::Pipe); TL.setKWLoc(Chunk.Loc); } - void VisitExtIntTypeLoc(ExtIntTypeLoc TL) { + void VisitBitIntTypeLoc(BitIntTypeLoc TL) { TL.setNameLoc(Chunk.Loc); } void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) { @@ -9079,9 +9078,8 @@ QualType Sema::BuildAtomicType(QualType T, SourceLocation Loc) { else if (!T.isTriviallyCopyableType(Context)) // Some other non-trivially-copyable type (probably a C++ class) DisallowedKind = 7; - else if (T->isExtIntType()) { - DisallowedKind = 8; - } + else if (T->isBitIntType()) + DisallowedKind = 8; if (DisallowedKind != -1) { Diag(Loc, diag::err_atomic_specifier_bad_type) << DisallowedKind << T; diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 7f3326c..31f4c47 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1195,12 +1195,12 @@ public: QualType RebuildPipeType(QualType ValueType, SourceLocation KWLoc, bool isReadPipe); - /// Build an extended int given its value type. - QualType RebuildExtIntType(bool IsUnsigned, unsigned NumBits, + /// Build a bit-precise int given its value type. + QualType RebuildBitIntType(bool IsUnsigned, unsigned NumBits, SourceLocation Loc); - /// Build a dependent extended int given its value type. - QualType RebuildDependentExtIntType(bool IsUnsigned, Expr *NumBitsExpr, + /// Build a dependent bit-precise int given its value type. + QualType RebuildDependentBitIntType(bool IsUnsigned, Expr *NumBitsExpr, SourceLocation Loc); /// Build a new template name given a nested name specifier, a flag @@ -6430,27 +6430,27 @@ QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB, } template <typename Derived> -QualType TreeTransform<Derived>::TransformExtIntType(TypeLocBuilder &TLB, - ExtIntTypeLoc TL) { - const ExtIntType *EIT = TL.getTypePtr(); +QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB, + BitIntTypeLoc TL) { + const BitIntType *EIT = TL.getTypePtr(); QualType Result = TL.getType(); if (getDerived().AlwaysRebuild()) { - Result = getDerived().RebuildExtIntType(EIT->isUnsigned(), + Result = getDerived().RebuildBitIntType(EIT->isUnsigned(), EIT->getNumBits(), TL.getNameLoc()); if (Result.isNull()) return QualType(); } - ExtIntTypeLoc NewTL = TLB.push<ExtIntTypeLoc>(Result); + BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(Result); NewTL.setNameLoc(TL.getNameLoc()); return Result; } template <typename Derived> -QualType TreeTransform<Derived>::TransformDependentExtIntType( - TypeLocBuilder &TLB, DependentExtIntTypeLoc TL) { - const DependentExtIntType *EIT = TL.getTypePtr(); +QualType TreeTransform<Derived>::TransformDependentBitIntType( + TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) { + const DependentBitIntType *EIT = TL.getTypePtr(); EnterExpressionEvaluationContext Unevaluated( SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated); @@ -6463,18 +6463,18 @@ QualType TreeTransform<Derived>::TransformDependentExtIntType( QualType Result = TL.getType(); if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) { - Result = getDerived().RebuildDependentExtIntType( + Result = getDerived().RebuildDependentBitIntType( EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc()); if (Result.isNull()) return QualType(); } - if (isa<DependentExtIntType>(Result)) { - DependentExtIntTypeLoc NewTL = TLB.push<DependentExtIntTypeLoc>(Result); + if (isa<DependentBitIntType>(Result)) { + DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(Result); NewTL.setNameLoc(TL.getNameLoc()); } else { - ExtIntTypeLoc NewTL = TLB.push<ExtIntTypeLoc>(Result); + BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(Result); NewTL.setNameLoc(TL.getNameLoc()); } return Result; @@ -14557,20 +14557,20 @@ QualType TreeTransform<Derived>::RebuildPipeType(QualType ValueType, } template <typename Derived> -QualType TreeTransform<Derived>::RebuildExtIntType(bool IsUnsigned, +QualType TreeTransform<Derived>::RebuildBitIntType(bool IsUnsigned, unsigned NumBits, SourceLocation Loc) { llvm::APInt NumBitsAP(SemaRef.Context.getIntWidth(SemaRef.Context.IntTy), NumBits, true); IntegerLiteral *Bits = IntegerLiteral::Create(SemaRef.Context, NumBitsAP, SemaRef.Context.IntTy, Loc); - return SemaRef.BuildExtIntType(IsUnsigned, Bits, Loc); + return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc); } template <typename Derived> -QualType TreeTransform<Derived>::RebuildDependentExtIntType( +QualType TreeTransform<Derived>::RebuildDependentBitIntType( bool IsUnsigned, Expr *NumBitsExpr, SourceLocation Loc) { - return SemaRef.BuildExtIntType(IsUnsigned, NumBitsExpr, Loc); + return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc); } template<typename Derived> |