We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 876fd51 commit e981a7fCopy full SHA for e981a7f
lib/SILOptimizer/Differentiation/ADContext.cpp
@@ -62,10 +62,8 @@ ADContext::ADContext(SILModuleTransform &transform)
62
63
/// Get the source file for the given `SILFunction`.
64
static SourceFile &getSourceFile(SILFunction *f) {
65
- if (f->hasLocation())
66
- if (auto *declContext = f->getLocation().getAsDeclContext())
67
- if (auto *parentSourceFile = declContext->getParentSourceFile())
68
- return *parentSourceFile;
+ if (SourceFile *file = f->getSourceFile())
+ return *file;
69
for (auto *file : f->getModule().getSwiftModule()->getFiles())
70
if (auto *sourceFile = dyn_cast<SourceFile>(file))
71
return *sourceFile;
0 commit comments