Skip to content
Closed
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
15 changes: 8 additions & 7 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2946,7 +2946,7 @@ class AnyFunctionType : public TypeBase {
friend ExtInfo;
friend class AnyFunctionType;
friend class FunctionType;
friend class SILUncommonInfo;
friend class SILCallingConvUncommonInfo;
// We preserve a full clang::Type *, not a clang::FunctionType * as:
// 1. We need to keep sugar in case we need to present an error to the user.
// 2. The actual type being stored is [ignoring sugar] either a
Expand Down Expand Up @@ -3917,7 +3917,7 @@ namespace Lowering {
class TypeConverter;
};

class SILUncommonInfo {
class SILCallingConvUncommonInfo {
friend class SILFunctionType;

// Invariant: The FunctionType is canonical.
Expand All @@ -3926,8 +3926,9 @@ class SILUncommonInfo {
const clang::Type *ClangFunctionType;

bool empty() const { return !ClangFunctionType; }
SILUncommonInfo(const clang::Type *type) : ClangFunctionType(type) {}
SILUncommonInfo(AnyFunctionType::ExtInfo::Uncommon uncommon);
SILCallingConvUncommonInfo(const clang::Type *type)
: ClangFunctionType(type) {}
SILCallingConvUncommonInfo(AnyFunctionType::ExtInfo::Uncommon uncommon);

public:
/// Analog of AnyFunctionType::ExtInfo::Uncommon::printClangFunctionType.
Expand All @@ -3944,7 +3945,7 @@ class SILUncommonInfo {
class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
private llvm::TrailingObjects<SILFunctionType, SILParameterInfo,
SILResultInfo, SILYieldInfo, CanType,
SILUncommonInfo> {
SILCallingConvUncommonInfo> {
friend TrailingObjects;

size_t numTrailingObjects(OverloadToken<SILParameterInfo>) const {
Expand All @@ -3963,7 +3964,7 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
return hasResultCache() ? 2 : 0;
}

size_t numTrailingObjects(OverloadToken<SILUncommonInfo>) const {
size_t numTrailingObjects(OverloadToken<SILCallingConvUncommonInfo>) const {
return Bits.SILFunctionType.HasUncommonInfo ? 1 : 0;
}

Expand Down Expand Up @@ -3992,7 +3993,7 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
unsigned Bits; // Naturally sized for speed.

// For symmetry with AnyFunctionType::Uncommon
using Uncommon = SILUncommonInfo;
using Uncommon = SILCallingConvUncommonInfo;

Uncommon Other;

Expand Down
5 changes: 3 additions & 2 deletions lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3158,13 +3158,14 @@ ArrayRef<Requirement> GenericFunctionType::getRequirements() const {
return Signature->getRequirements();
}

SILUncommonInfo::SILUncommonInfo(AnyFunctionType::ExtInfo::Uncommon uncommon) {
SILCallingConvUncommonInfo::SILCallingConvUncommonInfo(
AnyFunctionType::ExtInfo::Uncommon uncommon) {
auto *ty = uncommon.ClangFunctionType;
ClangFunctionType = ty ? ty->getCanonicalTypeInternal().getTypePtr()
: nullptr;
}

void SILUncommonInfo::printClangFunctionType(
void SILCallingConvUncommonInfo::printClangFunctionType(
ClangModuleLoader *cml, llvm::raw_ostream &os) const {
cml->printClangType(ClangFunctionType, os);
}
Expand Down