Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -5352,10 +5352,6 @@ class FunctionProtoType final
return getNumFunctionEffects();
}

unsigned numTrailingObjects(OverloadToken<EffectConditionExpr>) const {
return getNumFunctionEffectConditions();
}

/// Determine whether there are any argument types that
/// contain an unexpanded parameter pack.
static bool containsAnyUnexpandedParameterPack(const QualType *ArgArray,
Expand Down Expand Up @@ -5686,8 +5682,8 @@ class FunctionProtoType final
if (hasExtraBitfields()) {
const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
if (Bitfields->NumFunctionEffects > 0)
return {getTrailingObjects<FunctionEffect>(),
Bitfields->NumFunctionEffects};
return getTrailingObjects<FunctionEffect>(
Bitfields->NumFunctionEffects);
}
return {};
}
Expand All @@ -5706,8 +5702,8 @@ class FunctionProtoType final
if (hasExtraBitfields()) {
const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
if (Bitfields->EffectsHaveConditions)
return {getTrailingObjects<EffectConditionExpr>(),
Bitfields->NumFunctionEffects};
return getTrailingObjects<EffectConditionExpr>(
Bitfields->NumFunctionEffects);
}
return {};
}
Expand All @@ -5721,8 +5717,7 @@ class FunctionProtoType final
? Bitfields->NumFunctionEffects
: 0;
return FunctionEffectsRef(
{getTrailingObjects<FunctionEffect>(),
Bitfields->NumFunctionEffects},
getTrailingObjects<FunctionEffect>(Bitfields->NumFunctionEffects),
{NumConds ? getTrailingObjects<EffectConditionExpr>() : nullptr,
NumConds});
}
Expand Down Expand Up @@ -6063,8 +6058,6 @@ class PackIndexingType final

static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr,
ArrayRef<QualType> Expansions = {});

unsigned numTrailingObjects(OverloadToken<QualType>) const { return Size; }
};

/// A unary type transform, which is a type constructed from another.
Expand Down Expand Up @@ -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<SpirvOperand>()[I]) SpirvOperand();
auto *Operand = new (&getTrailingObjects()[I]) SpirvOperand();
*Operand = Operands[I];
}
}
Expand All @@ -6502,7 +6494,7 @@ class HLSLInlineSpirvType final
uint32_t getSize() const { return Size; }
uint32_t getAlignment() const { return Alignment; }
ArrayRef<SpirvOperand> getOperands() const {
return {getTrailingObjects<SpirvOperand>(), NumOperands};
return getTrailingObjects<SpirvOperand>(NumOperands);
}

bool isSugared() const { return false; }
Expand Down Expand Up @@ -6602,7 +6594,7 @@ class SubstTemplateTypeParmType final
/// parameter.
QualType getReplacementType() const {
return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
? *getTrailingObjects<QualType>()
? *getTrailingObjects()
: getCanonicalTypeInternal();
}

Expand Down Expand Up @@ -7164,7 +7156,7 @@ class ElaboratedType final
ElaboratedTypeBits.HasOwnedTagDecl = false;
if (OwnedTagDecl) {
ElaboratedTypeBits.HasOwnedTagDecl = true;
*getTrailingObjects<TagDecl *>() = OwnedTagDecl;
*getTrailingObjects() = OwnedTagDecl;
}
}

Expand All @@ -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<TagDecl *>()
: nullptr;
return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects() : nullptr;
}

void Profile(llvm::FoldingSetNodeID &ID) {
Expand Down
13 changes: 6 additions & 7 deletions clang/lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4019,12 +4019,11 @@ TypedefType::TypedefType(TypeClass tc, const TypedefNameDecl *D,
assert(!isa<TypedefType>(can) && "Invalid canonical type");
TypedefBits.hasTypeDifferentFromDecl = !Underlying.isNull();
if (!typeMatchesDecl())
*getTrailingObjects<QualType>() = Underlying;
*getTrailingObjects() = Underlying;
}

QualType TypedefType::desugar() const {
return typeMatchesDecl() ? Decl->getUnderlyingType()
: *getTrailingObjects<QualType>();
return typeMatchesDecl() ? Decl->getUnderlyingType() : *getTrailingObjects();
}

UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying,
Expand All @@ -4033,14 +4032,14 @@ UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying,
Found(const_cast<UsingShadowDecl *>(Found)) {
UsingBits.hasTypeDifferentFromDecl = !Underlying.isNull();
if (!typeMatchesDecl())
*getTrailingObjects<QualType>() = Underlying;
*getTrailingObjects() = Underlying;
}

QualType UsingType::getUnderlyingType() const {
return typeMatchesDecl()
? QualType(
cast<TypeDecl>(Found->getTargetDecl())->getTypeForDecl(), 0)
: *getTrailingObjects<QualType>();
: *getTrailingObjects();
}

QualType MacroQualifiedType::desugar() const { return getUnderlyingType(); }
Expand Down Expand Up @@ -4146,7 +4145,7 @@ PackIndexingType::PackIndexingType(QualType Canonical, QualType Pattern,
Pattern(Pattern), IndexExpr(IndexExpr), Size(Expansions.size()),
FullySubstituted(FullySubstituted) {

llvm::uninitialized_copy(Expansions, getTrailingObjects<QualType>());
llvm::uninitialized_copy(Expansions, getTrailingObjects());
}

UnsignedOrNone PackIndexingType::getSelectedIndex() const {
Expand Down Expand Up @@ -4369,7 +4368,7 @@ SubstTemplateTypeParmType::SubstTemplateTypeParmType(QualType Replacement,
SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType =
Replacement != getCanonicalTypeInternal();
if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType)
*getTrailingObjects<QualType>() = Replacement;
*getTrailingObjects() = Replacement;

SubstTemplateTypeParmTypeBits.Index = Index;
SubstTemplateTypeParmTypeBits.Final = Final;
Expand Down
Loading