diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index a6c26a07800c3..7fff819cba25d 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -5352,10 +5352,6 @@ class FunctionProtoType final return getNumFunctionEffects(); } - unsigned numTrailingObjects(OverloadToken) const { - return getNumFunctionEffectConditions(); - } - /// Determine whether there are any argument types that /// contain an unexpanded parameter pack. static bool containsAnyUnexpandedParameterPack(const QualType *ArgArray, @@ -5686,8 +5682,8 @@ class FunctionProtoType final if (hasExtraBitfields()) { const auto *Bitfields = getTrailingObjects(); if (Bitfields->NumFunctionEffects > 0) - return {getTrailingObjects(), - Bitfields->NumFunctionEffects}; + return getTrailingObjects( + Bitfields->NumFunctionEffects); } return {}; } @@ -5706,8 +5702,8 @@ class FunctionProtoType final if (hasExtraBitfields()) { const auto *Bitfields = getTrailingObjects(); if (Bitfields->EffectsHaveConditions) - return {getTrailingObjects(), - Bitfields->NumFunctionEffects}; + return getTrailingObjects( + Bitfields->NumFunctionEffects); } return {}; } @@ -5721,8 +5717,7 @@ class FunctionProtoType final ? Bitfields->NumFunctionEffects : 0; return FunctionEffectsRef( - {getTrailingObjects(), - Bitfields->NumFunctionEffects}, + getTrailingObjects(Bitfields->NumFunctionEffects), {NumConds ? getTrailingObjects() : nullptr, NumConds}); } @@ -6063,8 +6058,6 @@ class PackIndexingType final static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr, ArrayRef Expansions = {}); - - unsigned numTrailingObjects(OverloadToken) const { return Size; } }; /// A unary type transform, which is a type constructed from another. @@ -6491,8 +6484,7 @@ class HLSLInlineSpirvType final for (size_t I = 0; I < NumOperands; I++) { // Since Operands are stored as a trailing object, they have not been // initialized yet. Call the constructor manually. - auto *Operand = - new (&getTrailingObjects()[I]) SpirvOperand(); + auto *Operand = new (&getTrailingObjects()[I]) SpirvOperand(); *Operand = Operands[I]; } } @@ -6502,7 +6494,7 @@ class HLSLInlineSpirvType final uint32_t getSize() const { return Size; } uint32_t getAlignment() const { return Alignment; } ArrayRef getOperands() const { - return {getTrailingObjects(), NumOperands}; + return getTrailingObjects(NumOperands); } bool isSugared() const { return false; } @@ -6602,7 +6594,7 @@ class SubstTemplateTypeParmType final /// parameter. QualType getReplacementType() const { return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType - ? *getTrailingObjects() + ? *getTrailingObjects() : getCanonicalTypeInternal(); } @@ -7164,7 +7156,7 @@ class ElaboratedType final ElaboratedTypeBits.HasOwnedTagDecl = false; if (OwnedTagDecl) { ElaboratedTypeBits.HasOwnedTagDecl = true; - *getTrailingObjects() = OwnedTagDecl; + *getTrailingObjects() = OwnedTagDecl; } } @@ -7184,8 +7176,7 @@ class ElaboratedType final /// Return the (re)declaration of this type owned by this occurrence of this /// type, or nullptr if there is none. TagDecl *getOwnedTagDecl() const { - return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects() - : nullptr; + return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects() : nullptr; } void Profile(llvm::FoldingSetNodeID &ID) { diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 5bb39b12693fb..800cd2a91ec26 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -4019,12 +4019,11 @@ TypedefType::TypedefType(TypeClass tc, const TypedefNameDecl *D, assert(!isa(can) && "Invalid canonical type"); TypedefBits.hasTypeDifferentFromDecl = !Underlying.isNull(); if (!typeMatchesDecl()) - *getTrailingObjects() = Underlying; + *getTrailingObjects() = Underlying; } QualType TypedefType::desugar() const { - return typeMatchesDecl() ? Decl->getUnderlyingType() - : *getTrailingObjects(); + return typeMatchesDecl() ? Decl->getUnderlyingType() : *getTrailingObjects(); } UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying, @@ -4033,14 +4032,14 @@ UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying, Found(const_cast(Found)) { UsingBits.hasTypeDifferentFromDecl = !Underlying.isNull(); if (!typeMatchesDecl()) - *getTrailingObjects() = Underlying; + *getTrailingObjects() = Underlying; } QualType UsingType::getUnderlyingType() const { return typeMatchesDecl() ? QualType( cast(Found->getTargetDecl())->getTypeForDecl(), 0) - : *getTrailingObjects(); + : *getTrailingObjects(); } QualType MacroQualifiedType::desugar() const { return getUnderlyingType(); } @@ -4146,7 +4145,7 @@ PackIndexingType::PackIndexingType(QualType Canonical, QualType Pattern, Pattern(Pattern), IndexExpr(IndexExpr), Size(Expansions.size()), FullySubstituted(FullySubstituted) { - llvm::uninitialized_copy(Expansions, getTrailingObjects()); + llvm::uninitialized_copy(Expansions, getTrailingObjects()); } UnsignedOrNone PackIndexingType::getSelectedIndex() const { @@ -4369,7 +4368,7 @@ SubstTemplateTypeParmType::SubstTemplateTypeParmType(QualType Replacement, SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType = Replacement != getCanonicalTypeInternal(); if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType) - *getTrailingObjects() = Replacement; + *getTrailingObjects() = Replacement; SubstTemplateTypeParmTypeBits.Index = Index; SubstTemplateTypeParmTypeBits.Final = Final;