mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AutoDiff] Add generated implicit declarations to SynthesizedFileUnit.
Add implicit declarations generated by the differentiation transform to a `SynthesizedFileUnit` instead of an ad-hoc pre-existing `SourceFile`. Resolves TF-1232: type reconstruction for AutoDiff-generated declarations. Previously, type reconstruction failed because retroactively adding declarations to a `SourceFile` did not update name lookup caches.
This commit is contained in:
@@ -1180,6 +1180,8 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc,
|
||||
// The Builtin module declares no operators.
|
||||
return nullptr;
|
||||
case FileUnitKind::Synthesized:
|
||||
// Synthesized files currently declare no operators.
|
||||
return nullptr;
|
||||
case FileUnitKind::Source:
|
||||
break;
|
||||
case FileUnitKind::SerializedAST:
|
||||
@@ -1527,6 +1529,9 @@ StringRef ModuleDecl::getModuleFilename() const {
|
||||
Result = LF->getFilename();
|
||||
continue;
|
||||
}
|
||||
// Skip synthesized files.
|
||||
if (auto *SFU = dyn_cast<SynthesizedFileUnit>(F))
|
||||
continue;
|
||||
return StringRef();
|
||||
}
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user