Skip to content

Commit 5b7ae4c

Browse files
committed
Sema: Minor clean up a few @_originallyDefinedIn diagnostics.
1 parent 0ac53e3 commit 5b7ae4c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,10 +1603,11 @@ NOTE(option_set_empty_set_init,none,
16031603
"use [] to silence this warning", ())
16041604

16051605
ERROR(originally_definedin_topleve_decl,none,
1606-
"@%0 is only applicable to top-level decl", (StringRef))
1606+
"'%0' is only applicable to top-level decl", (DeclAttribute))
16071607

16081608
ERROR(originally_definedin_must_not_before_available_version,none,
1609-
"symbols are moved to the current module before they were available in the OSs", (StringRef))
1609+
"symbols are moved to the current module before they were available in "
1610+
"the OSs", ())
16101611

16111612
// Alignment attribute
16121613
ERROR(alignment_not_power_of_two,none,

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,8 +3473,6 @@ void AttributeChecker::checkOriginalDefinedInAttrs(
34733473
// Attrs are in the reverse order of the source order. We need to visit them
34743474
// in source order to diagnose the later attribute.
34753475
for (auto *Attr: Attrs) {
3476-
static StringRef AttrName = "_originallyDefinedIn";
3477-
34783476
if (!Attr->isActivePlatform(Ctx))
34793477
continue;
34803478

@@ -3492,7 +3490,7 @@ void AttributeChecker::checkOriginalDefinedInAttrs(
34923490
return;
34933491
}
34943492
if (!D->getDeclContext()->isModuleScopeContext()) {
3495-
diagnose(AtLoc, diag::originally_definedin_topleve_decl, AttrName);
3493+
diagnose(AtLoc, diag::originally_definedin_topleve_decl, Attr);
34963494
return;
34973495
}
34983496

@@ -3502,8 +3500,7 @@ void AttributeChecker::checkOriginalDefinedInAttrs(
35023500
auto IntroVer = D->getIntroducedOSVersion(Platform);
35033501
if (IntroVer.getValue() > Attr->MovedVersion) {
35043502
diagnose(AtLoc,
3505-
diag::originally_definedin_must_not_before_available_version,
3506-
AttrName);
3503+
diag::originally_definedin_must_not_before_available_version);
35073504
return;
35083505
}
35093506
}

test/Sema/diag_originally_definedin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public func foo() {}
88
@available(macOS 10.13, *)
99
@_originallyDefinedIn(module: "original", OSX 10.12) // expected-error {{symbols are moved to the current module before they were available in the OSs}}
1010
public class C {
11-
@_originallyDefinedIn(module: "original", OSX 10.13) // expected-error {{@_originallyDefinedIn is only applicable to top-level decl}}
11+
@_originallyDefinedIn(module: "original", OSX 10.13) // expected-error {{'@_originallyDefinedIn' is only applicable to top-level decl}}
1212
public func foo() {}
1313
}
1414

0 commit comments

Comments
 (0)