mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
NFC: Add GenericSignature::getCanonicalSignature. (#29105)
Motivation: `GenericSignatureImpl::getCanonicalSignature` crashes for `GenericSignature` with underlying `nullptr`. This led to verbose workarounds when computing `CanGenericSignature` from `GenericSignature`. Solution: `GenericSignature::getCanonicalSignature` is a wrapper around `GenericSignatureImpl::getCanonicalSignature` that returns the canonical signature, or `nullptr` if the underlying pointer is `nullptr`. Rewrite all verbose workarounds using `GenericSignature::getCanonicalSignature`.
This commit is contained in:
@@ -93,6 +93,7 @@ public:
|
||||
SWIFT_DEBUG_DUMP;
|
||||
};
|
||||
|
||||
class CanGenericSignature;
|
||||
class GenericSignatureImpl;
|
||||
class GenericTypeParamType;
|
||||
|
||||
@@ -140,6 +141,10 @@ public:
|
||||
SWIFT_DEBUG_DUMP;
|
||||
std::string getAsString() const;
|
||||
|
||||
/// Returns the canonical generic signature, or \c nullptr if the underlying
|
||||
/// pointer is \c nullptr. The result is cached.
|
||||
CanGenericSignature getCanonicalSignature() const;
|
||||
|
||||
// Support for FoldingSet.
|
||||
void Profile(llvm::FoldingSetNodeID &id) const;
|
||||
|
||||
@@ -300,8 +305,8 @@ public:
|
||||
bool isCanonical() const;
|
||||
|
||||
ASTContext &getASTContext() const;
|
||||
|
||||
/// Canonicalize the components of a generic signature.
|
||||
|
||||
/// Returns the canonical generic signature. The result is cached.
|
||||
CanGenericSignature getCanonicalSignature() const;
|
||||
|
||||
/// Retrieve the generic signature builder for the given generic signature.
|
||||
|
||||
Reference in New Issue
Block a user