mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
Avoid loading serialized extensions for nominals in SourceFile
Looking up serialized extensions for a nested nominal type requires computing its mangled name, which may kick semantic requests. Ensure we don't do this for nominals in parsed SourceFiles such that we don't end up kicking this during extension binding.
This commit is contained in:
@@ -1723,6 +1723,13 @@ bool MemoryBufferSerializedModuleLoader::unregisterMemoryBuffer(
|
||||
|
||||
void SerializedModuleLoaderBase::loadExtensions(NominalTypeDecl *nominal,
|
||||
unsigned previousGeneration) {
|
||||
// Nominals in parsed SourceFiles can't have extensions provided by imported
|
||||
// serialized modules. This is necessary to avoid triggering semantic requests
|
||||
// from extension binding since looking up extensions may need to compute the
|
||||
// mangled name.
|
||||
if (nominal->getParentSourceFile())
|
||||
return;
|
||||
|
||||
for (auto &modulePair : LoadedModuleFiles) {
|
||||
if (modulePair.second <= previousGeneration)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user