mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Don't crash when computing identifier for an invalid extension.
This commit is contained in:
@@ -67,7 +67,8 @@ static std::string identifierForContext(const DeclContext *DC) {
|
|||||||
|
|
||||||
const auto *ext = cast<ExtensionDecl>(DC);
|
const auto *ext = cast<ExtensionDecl>(DC);
|
||||||
auto fp = ext->getBodyFingerprint().value_or(Fingerprint::ZERO());
|
auto fp = ext->getBodyFingerprint().value_or(Fingerprint::ZERO());
|
||||||
auto typeStr = Mangler.mangleTypeAsContextUSR(ext->getExtendedNominal());
|
const auto *nominal = ext->getExtendedNominal();
|
||||||
|
auto typeStr = nominal ? Mangler.mangleTypeAsContextUSR(nominal) : "";
|
||||||
return (typeStr + "@" + fp.getRawValue()).str();
|
return (typeStr + "@" + fp.getRawValue()).str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user