Skip to content

Commit b3c062c

Browse files
committed
[AST] NFC: Inline isActuallyCanonicalOrNull()
This is on the very hot path for Release+Assert builds.
1 parent 87afaaf commit b3c062c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/swift/AST/Types.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5262,7 +5262,13 @@ inline CanType CanType::getWithoutSpecifierTypeImpl(CanType type) {
52625262
inline CanType CanType::getNominalParent() const {
52635263
return cast<NominalOrBoundGenericNominalType>(*this).getParent();
52645264
}
5265-
5265+
5266+
inline bool CanType::isActuallyCanonicalOrNull() const {
5267+
return getPointer() == nullptr ||
5268+
getPointer() == llvm::DenseMapInfo<TypeBase *>::getTombstoneKey() ||
5269+
getPointer()->isCanonical();
5270+
}
5271+
52665272
inline Type TupleTypeElt::getVarargBaseTy() const {
52675273
TypeBase *T = getType().getPointer();
52685274
if (auto *AT = dyn_cast<ArraySliceType>(T))

lib/AST/Type.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ void *TypeBase::operator new(size_t bytes, const ASTContext &ctx,
102102
return ctx.Allocate(bytes, alignment, arena);
103103
}
104104

105-
bool CanType::isActuallyCanonicalOrNull() const {
106-
return getPointer() == nullptr ||
107-
getPointer() == llvm::DenseMapInfo<TypeBase *>::getTombstoneKey() ||
108-
getPointer()->isCanonical();
109-
}
110-
111105
NominalTypeDecl *CanType::getAnyNominal() const {
112106
return dyn_cast_or_null<NominalTypeDecl>(getAnyGeneric());
113107
}

0 commit comments

Comments
 (0)