Skip to content

Commit d9dafa1

Browse files
authored
Merge pull request #68149 from gottesmm/send-non-sendable-fixes
[send-non-sendable] Some small bug fixes/cleanups/updates to use LLVM data structures
2 parents 3c8c1d7 + 68564f1 commit d9dafa1

File tree

4 files changed

+290
-191
lines changed

4 files changed

+290
-191
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,14 @@ class SILFunction
14221422
return getArguments().back();
14231423
}
14241424

1425+
/// Like getSelfArgument() except it returns a nullptr if we do not have a
1426+
/// selfparam.
1427+
const SILArgument *maybeGetSelfArgument() const {
1428+
if (!hasSelfParam())
1429+
return nullptr;
1430+
return getArguments().back();
1431+
}
1432+
14251433
const SILArgument *getDynamicSelfMetadata() const {
14261434
assert(hasDynamicSelfMetadata() && "This method can only be called if the "
14271435
"SILFunction has a self-metadata parameter");

lib/SIL/Parser/SILParserFunctionBuilder.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ class LLVM_LIBRARY_VISIBILITY SILParserFunctionBuilder {
3131
IsNotTransparent, IsNotSerialized, IsNotDynamic, IsNotDistributed,
3232
IsNotRuntimeAccessible);
3333
result->setDebugScope(new (builder.mod) SILDebugScope(loc, result));
34+
35+
// If we did not have a declcontext set, as a fallback set the parent module
36+
// of our SILFunction to the parent module of our SILModule.
37+
//
38+
// DISCUSSION: This ensures that we can perform protocol conformance checks.
39+
if (!result->getDeclContext()) {
40+
result->setParentModule(result->getModule().getSwiftModule());
41+
}
42+
3443
return result;
3544
}
3645
};

0 commit comments

Comments
 (0)