Skip to content

[NFC] Adopt TypeBase-isms for GenericSignature #27436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2019
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
6 changes: 3 additions & 3 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ class ASTContext final {
/// Register the given generic signature builder to be used as the canonical
/// generic signature builder for the given signature, if we don't already
/// have one.
void registerGenericSignatureBuilder(GenericSignature *sig,
void registerGenericSignatureBuilder(GenericSignature sig,
GenericSignatureBuilder &&builder);
friend class GenericSignatureBuilder;

Expand All @@ -876,8 +876,8 @@ class ASTContext final {
CanGenericSignature getExistentialSignature(CanType existential,
ModuleDecl *mod);

GenericSignature *getOverrideGenericSignature(const ValueDecl *base,
const ValueDecl *derived);
GenericSignature getOverrideGenericSignature(const ValueDecl *base,
const ValueDecl *derived);

enum class OverrideGenericSignatureReqCheck {
/// Base method's generic requirements are satisifed by derived method
Expand Down
16 changes: 8 additions & 8 deletions include/swift/AST/ASTMangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,20 @@ class ASTMangler : public Mangler {
ModuleDecl *Module);

std::string mangleKeyPathGetterThunkHelper(const AbstractStorageDecl *property,
GenericSignature *signature,
GenericSignature signature,
CanType baseType,
SubstitutionMap subs,
ResilienceExpansion expansion);
std::string mangleKeyPathSetterThunkHelper(const AbstractStorageDecl *property,
GenericSignature *signature,
GenericSignature signature,
CanType baseType,
SubstitutionMap subs,
ResilienceExpansion expansion);
std::string mangleKeyPathEqualsHelper(ArrayRef<CanType> indices,
GenericSignature *signature,
GenericSignature signature,
ResilienceExpansion expansion);
std::string mangleKeyPathHashHelper(ArrayRef<CanType> indices,
GenericSignature *signature,
GenericSignature signature,
ResilienceExpansion expansion);

std::string mangleTypeForDebugger(Type decl, const DeclContext *DC);
Expand Down Expand Up @@ -289,8 +289,8 @@ class ASTMangler : public Mangler {
///
/// \returns \c true if a generic signature was appended, \c false
/// if it was empty.
bool appendGenericSignature(const GenericSignature *sig,
GenericSignature *contextSig = nullptr);
bool appendGenericSignature(GenericSignature sig,
GenericSignature contextSig = nullptr);

void appendRequirement(const Requirement &reqt);

Expand All @@ -316,8 +316,8 @@ class ASTMangler : public Mangler {
void appendBackingInitializerEntity(const VarDecl *var);

CanType getDeclTypeForMangling(const ValueDecl *decl,
GenericSignature *&genericSig,
GenericSignature *&parentGenericSig);
GenericSignature &genericSig,
GenericSignature &parentGenericSig);

void appendDeclType(const ValueDecl *decl, bool isFunctionMangling = false);

Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/ASTTypeIDZone.def
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

SWIFT_TYPEID(AncestryFlags)
SWIFT_TYPEID(CtorInitializerKind)
SWIFT_TYPEID(GenericSignature)
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
SWIFT_TYPEID(PropertyWrapperTypeInfo)
SWIFT_TYPEID(Requirement)
Expand All @@ -26,7 +27,6 @@ SWIFT_TYPEID(TypePair)
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
SWIFT_TYPEID_NAMED(Decl *, Decl)
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
SWIFT_TYPEID_NAMED(GenericSignature *, GenericSignature)
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/AnyFunctionRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class AnyFunctionRef {
llvm_unreachable("unexpected AnyFunctionRef representation");
}

GenericSignature *getGenericSignature() const {
GenericSignature getGenericSignature() const {
if (auto afd = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
return afd->getGenericSignature();
}
Expand Down
10 changes: 5 additions & 5 deletions include/swift/AST/Attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1279,27 +1279,27 @@ class SpecializeAttr : public DeclAttribute {

private:
TrailingWhereClause *trailingWhereClause;
GenericSignature *specializedSignature;
GenericSignature specializedSignature;

SpecializeAttr(SourceLoc atLoc, SourceRange Range,
TrailingWhereClause *clause, bool exported,
SpecializationKind kind,
GenericSignature *specializedSignature);
GenericSignature specializedSignature);

public:
static SpecializeAttr *create(ASTContext &Ctx, SourceLoc atLoc,
SourceRange Range, TrailingWhereClause *clause,
bool exported, SpecializationKind kind,
GenericSignature *specializedSignature
GenericSignature specializedSignature
= nullptr);

TrailingWhereClause *getTrailingWhereClause() const;

GenericSignature *getSpecializedSgnature() const {
GenericSignature getSpecializedSgnature() const {
return specializedSignature;
}

void setSpecializedSignature(GenericSignature *newSig) {
void setSpecializedSignature(GenericSignature newSig) {
specializedSignature = newSig;
}

Expand Down
12 changes: 6 additions & 6 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ class alignas(8) _GenericContext {
TrailingWhereClause *TrailingWhere = nullptr;

/// The generic signature of this declaration.
llvm::PointerIntPair<GenericSignature *, 1, bool> GenericSigAndBit;
llvm::PointerIntPair<GenericSignature, 1, bool> GenericSigAndBit;
};

class GenericContext : private _GenericContext, public DeclContext {
Expand Down Expand Up @@ -1541,7 +1541,7 @@ class GenericContext : private _GenericContext, public DeclContext {
}

/// Retrieve the generic signature for this context.
GenericSignature *getGenericSignature() const;
GenericSignature getGenericSignature() const;

/// Retrieve the generic context for this context.
GenericEnvironment *getGenericEnvironment() const;
Expand All @@ -1553,7 +1553,7 @@ class GenericContext : private _GenericContext, public DeclContext {
ArrayRef<Requirement> getGenericRequirements() const;

/// Set the generic signature of this context.
void setGenericSignature(GenericSignature *genericSig);
void setGenericSignature(GenericSignature genericSig);

/// Retrieve the position of any where clause for this context's
/// generic parameters.
Expand Down Expand Up @@ -2857,7 +2857,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
/// The generic signature of the opaque interface to the type. This is the
/// outer generic signature with an added generic parameter representing the
/// underlying type.
GenericSignature *OpaqueInterfaceGenericSignature;
GenericSignature OpaqueInterfaceGenericSignature;

/// The generic parameter that represents the underlying type.
GenericTypeParamType *UnderlyingInterfaceType;
Expand All @@ -2874,7 +2874,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
OpaqueTypeDecl(ValueDecl *NamingDecl,
GenericParamList *GenericParams,
DeclContext *DC,
GenericSignature *OpaqueInterfaceGenericSignature,
GenericSignature OpaqueInterfaceGenericSignature,
GenericTypeParamType *UnderlyingInterfaceType);

ValueDecl *getNamingDecl() const { return NamingDecl; }
Expand All @@ -2890,7 +2890,7 @@ class OpaqueTypeDecl : public GenericTypeDecl {
/// function could also be the getter of a storage declaration.
bool isOpaqueReturnTypeOfFunction(const AbstractFunctionDecl *func) const;

GenericSignature *getOpaqueInterfaceGenericSignature() const {
GenericSignature getOpaqueInterfaceGenericSignature() const {
return OpaqueInterfaceGenericSignature;
}

Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/DeclContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {

/// Retrieve the innermost generic signature of this context or any
/// of its parents.
GenericSignature *getGenericSignatureOfContext() const;
GenericSignature getGenericSignatureOfContext() const;

/// Retrieve the innermost archetypes of this context or any
/// of its parents.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/FileUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class LoadedFile : public FileUnit {
/// \returns \c true if this module file supports retrieving all of the
/// generic signatures, \c false otherwise.
virtual bool getAllGenericSignatures(
SmallVectorImpl<GenericSignature*> &genericSignatures) {
SmallVectorImpl<GenericSignature> &genericSignatures) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions include/swift/AST/GenericEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class QueryInterfaceTypeSubstitutions {
///
class alignas(1 << DeclAlignInBits) GenericEnvironment final
: private llvm::TrailingObjects<GenericEnvironment, Type> {
GenericSignature *Signature = nullptr;
GenericSignature Signature = GenericSignature();
GenericSignatureBuilder *Builder = nullptr;

friend TrailingObjects;
Expand All @@ -74,7 +74,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
/// generic signature.
ArrayRef<Type> getContextTypes() const;

GenericEnvironment(GenericSignature *signature,
GenericEnvironment(GenericSignature signature,
GenericSignatureBuilder *builder);

friend ArchetypeType;
Expand All @@ -85,7 +85,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
friend QueryInterfaceTypeSubstitutions;

public:
GenericSignature *getGenericSignature() const {
GenericSignature getGenericSignature() const {
return Signature;
}

Expand All @@ -94,7 +94,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
/// Create a new, "incomplete" generic environment that will be populated
/// by calls to \c addMapping().
static
GenericEnvironment *getIncomplete(GenericSignature *signature,
GenericEnvironment *getIncomplete(GenericSignature signature,
GenericSignatureBuilder *builder);

/// Add a mapping of a generic parameter to a specific type (which may be
Expand Down
Loading