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:
Doug Gregor
2025-02-16 19:15:27 -08:00
committed by GitHub
22 changed files with 397 additions and 119 deletions

View File

@@ -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?