mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #79424 from DougGregor/se-0458-match-proposal
[SE-0458] Bring implementation in line with the latest proposal revision
This commit is contained in:
@@ -1150,6 +1150,14 @@ ExplicitSafety Decl::getExplicitSafety() const {
|
||||
if (auto safety = getExplicitSafetyFromAttrs(this))
|
||||
return *safety;
|
||||
|
||||
// If this declaration is from C, ask the Clang importer.
|
||||
if (auto clangDecl = getClangDecl()) {
|
||||
ASTContext &ctx = getASTContext();
|
||||
return evaluateOrDefault(
|
||||
ctx.evaluator, ClangDeclExplicitSafety({clangDecl, ctx}),
|
||||
ExplicitSafety::Unspecified);
|
||||
}
|
||||
|
||||
// Inference: Check the enclosing context.
|
||||
if (auto enclosingDC = getDeclContext()) {
|
||||
// Is this an extension with @safe or @unsafe on it?
|
||||
|
||||
Reference in New Issue
Block a user