Skip to content

Commit c76c637

Browse files
committed
Sema: Adopt SemanticAvailableAttr in ExprAvailabilityWalker.
1 parent 51ae094 commit c76c637

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,10 +3860,9 @@ class ExprAvailabilityWalker : public BaseDiagnosticWalker {
38603860
DeclAvailabilityFlags flags = std::nullopt) const;
38613861

38623862
private:
3863-
bool diagnoseIncDecRemoval(const ValueDecl *D, SourceRange R,
3864-
const AvailableAttr *Attr) const;
3863+
bool diagnoseIncDecRemoval(const ValueDecl *D, SourceRange R) const;
38653864
bool diagnoseMemoryLayoutMigration(const ValueDecl *D, SourceRange R,
3866-
const AvailableAttr *Attr,
3865+
SemanticAvailableAttr,
38673866
const ApplyExpr *call) const;
38683867

38693868
/// Walks up from a potential callee to the enclosing ApplyExpr.
@@ -4099,11 +4098,10 @@ bool ExprAvailabilityWalker::diagnoseDeclRefAvailability(
40994098
return false;
41004099

41014100
if (auto attr = D->getUnavailableAttr()) {
4102-
auto parsedAttr = attr->getParsedAttr();
4103-
if (diagnoseIncDecRemoval(D, R, parsedAttr))
4101+
if (diagnoseIncDecRemoval(D, R))
41044102
return true;
41054103
if (isa_and_nonnull<ApplyExpr>(call) &&
4106-
diagnoseMemoryLayoutMigration(D, R, parsedAttr, cast<ApplyExpr>(call)))
4104+
diagnoseMemoryLayoutMigration(D, R, *attr, cast<ApplyExpr>(call)))
41074105
return true;
41084106
}
41094107

@@ -4363,8 +4361,7 @@ static bool isIntegerOrFloatingPointType(Type ty) {
43634361
/// If this is a call to an unavailable ++ / -- operator, try to diagnose it
43644362
/// with a fixit hint and return true. If not, or if we fail, return false.
43654363
bool
4366-
ExprAvailabilityWalker::diagnoseIncDecRemoval(const ValueDecl *D, SourceRange R,
4367-
const AvailableAttr *Attr) const {
4364+
ExprAvailabilityWalker::diagnoseIncDecRemoval(const ValueDecl *D, SourceRange R) const {
43684365
// We can only produce a fixit if we're talking about ++ or --.
43694366
bool isInc = D->getBaseName() == "++";
43704367
if (!isInc && D->getBaseName() != "--")
@@ -4423,7 +4420,7 @@ ExprAvailabilityWalker::diagnoseIncDecRemoval(const ValueDecl *D, SourceRange R,
44234420
bool
44244421
ExprAvailabilityWalker::diagnoseMemoryLayoutMigration(const ValueDecl *D,
44254422
SourceRange R,
4426-
const AvailableAttr *Attr,
4423+
SemanticAvailableAttr Attr,
44274424
const ApplyExpr *call) const {
44284425

44294426
if (!D->getModuleContext()->isStdlibModule())
@@ -4446,7 +4443,7 @@ ExprAvailabilityWalker::diagnoseMemoryLayoutMigration(const ValueDecl *D,
44464443
if (!subject)
44474444
return false;
44484445

4449-
EncodedDiagnosticMessage EncodedMessage(Attr->Message);
4446+
EncodedDiagnosticMessage EncodedMessage(Attr.getMessage());
44504447
auto diag =
44514448
Context.Diags.diagnose(
44524449
R.Start, diag::availability_decl_unavailable, D, true, "",

0 commit comments

Comments
 (0)