Skip to content

Commit 7149702

Browse files
committed
Rename @_predatesConcurrency to @preconcurrency.
Introduce the `@preconcurrency` attribute name for `@_predatesConcurrency`, which has been the favored name in the pitch thread so far. Retain the old name for now to help smooth migration.
1 parent c7a5049 commit 7149702

31 files changed

+120
-105
lines changed

include/swift/AST/ASTMangler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ASTMangler : public Mangler {
7070
/// Whether the mangling predates concurrency, and therefore shouldn't
7171
/// include concurrency features such as global actors or @Sendable
7272
/// function types.
73-
bool PredatesConcurrency = false;
73+
bool Preconcurrency = false;
7474

7575
public:
7676
using SymbolicReferent = llvm::PointerUnion<const NominalTypeDecl *,

include/swift/AST/Attr.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,9 @@ SIMPLE_DECL_ATTR(_noAllocation, NoAllocation,
688688
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
689689
124)
690690

691-
SIMPLE_DECL_ATTR(_predatesConcurrency, PredatesConcurrency,
691+
SIMPLE_DECL_ATTR(preconcurrency, Preconcurrency,
692692
OnFunc | OnConstructor | OnProtocol | OnGenericType | OnVar | OnSubscript |
693-
OnEnumElement | OnImport | UserInaccessible |
693+
OnEnumElement | OnImport |
694694
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
695695
125)
696696

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
898898
void setHoisted(bool hoisted = true) { Bits.Decl.Hoisted = hoisted; }
899899

900900
/// Whether this declaration predates the introduction of concurrency.
901-
bool predatesConcurrency() const;
901+
bool preconcurrency() const;
902902

903903
public:
904904
bool escapedFromIfConfig() const {

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ ERROR(sil_inst_autodiff_invalid_witness_generic_signature,PointsToFirstBadToken,
17421742
(StringRef, StringRef))
17431743

17441744
WARNING(warn_attr_unsafe_removed,none,
1745-
"'%0' attribute has been removed in favor of @_predatesConcurrency",
1745+
"'%0' attribute has been removed in favor of @preconcurrency",
17461746
(StringRef))
17471747

17481748
//------------------------------------------------------------------------------

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,11 +1958,11 @@ NOTE(add_nominal_sendable_conformance,none,
19581958
"consider making %0 %1 conform to the 'Sendable' protocol",
19591959
(DescriptiveDeclKind, DeclName))
19601960
REMARK(add_predates_concurrency_import,none,
1961-
"add '@_predatesConcurrency' to %select{suppress|treat}0 "
1961+
"add '@preconcurrency' to %select{suppress|treat}0 "
19621962
"'Sendable'-related %select{warnings|errors}0 from module %1"
19631963
"%select{| as warnings}0", (bool, Identifier))
19641964
REMARK(remove_predates_concurrency_import,none,
1965-
"'@_predatesConcurrency' attribute on module %0 is unused", (Identifier))
1965+
"'@preconcurrency' attribute on module %0 is unused", (Identifier))
19661966
WARNING(public_decl_needs_sendable,none,
19671967
"public %0 %1 does not specify whether it is 'Sendable' or not",
19681968
(DescriptiveDeclKind, DeclName))

include/swift/AST/Import.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ enum class ImportFlags {
8282

8383
/// The module is imported assuming that the module itself predates
8484
/// concurrency.
85-
PredatesConcurrency = 0x20,
85+
Preconcurrency = 0x20,
8686

8787
/// Used for DenseMap.
8888
Reserved = 0x80
@@ -566,17 +566,17 @@ struct AttributedImport {
566566
/// Names of explicitly imported SPI groups.
567567
ArrayRef<Identifier> spiGroups;
568568

569-
/// When the import declaration has a `@_predatesConcurrency` annotation, this
569+
/// When the import declaration has a `@preconcurrency` annotation, this
570570
/// is the source range covering the annotation.
571-
SourceRange predatesConcurrencyRange;
571+
SourceRange preconcurrencyRange;
572572

573573
AttributedImport(ModuleInfo module, SourceLoc importLoc = SourceLoc(),
574574
ImportOptions options = ImportOptions(),
575575
StringRef filename = {}, ArrayRef<Identifier> spiGroups = {},
576-
SourceRange predatesConcurrencyRange = {})
576+
SourceRange preconcurrencyRange = {})
577577
: module(module), importLoc(importLoc), options(options),
578578
sourceFileArg(filename), spiGroups(spiGroups),
579-
predatesConcurrencyRange(predatesConcurrencyRange) {
579+
preconcurrencyRange(preconcurrencyRange) {
580580
assert(!(options.contains(ImportFlags::Exported) &&
581581
options.contains(ImportFlags::ImplementationOnly)) ||
582582
options.contains(ImportFlags::Reserved));
@@ -586,7 +586,7 @@ struct AttributedImport {
586586
AttributedImport(ModuleInfo module, AttributedImport<OtherModuleInfo> other)
587587
: AttributedImport(module, other.importLoc, other.options,
588588
other.sourceFileArg, other.spiGroups,
589-
other.predatesConcurrencyRange) { }
589+
other.preconcurrencyRange) { }
590590

591591
friend bool operator==(const AttributedImport<ModuleInfo> &lhs,
592592
const AttributedImport<ModuleInfo> &rhs) {

include/swift/AST/SourceFile.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class SourceFile final : public FileUnit {
8484
/// This is \c None until it is filled in by the import resolution phase.
8585
Optional<ArrayRef<AttributedImport<ImportedModule>>> Imports;
8686

87-
/// Which imports have made use of @_predatesConcurrency.
87+
/// Which imports have made use of @preconcurrency.
8888
llvm::SmallDenseSet<AttributedImport<ImportedModule>>
89-
PredatesConcurrencyImportsUsed;
89+
PreconcurrencyImportsUsed;
9090

9191
/// A unique identifier representing this file; used to mark private decls
9292
/// within the file to keep them from conflicting with other files in the
@@ -301,12 +301,12 @@ class SourceFile final : public FileUnit {
301301
/// resolution.
302302
void setImports(ArrayRef<AttributedImport<ImportedModule>> imports);
303303

304-
/// Whether the given import has used @_predatesConcurrency.
305-
bool hasImportUsedPredatesConcurrency(
304+
/// Whether the given import has used @preconcurrency.
305+
bool hasImportUsedPreconcurrency(
306306
AttributedImport<ImportedModule> import) const;
307307

308-
/// Note that the given import has used @_predatesConcurrency/
309-
void setImportUsedPredatesConcurrency(
308+
/// Note that the given import has used @preconcurrency/
309+
void setImportUsedPreconcurrency(
310310
AttributedImport<ImportedModule> import);
311311

312312
enum ImportQueryKind {

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ CanType ASTMangler::getDeclTypeForMangling(
30113011
// If this declaration predates concurrency, adjust its type to not
30123012
// contain type features that were not available pre-concurrency. This
30133013
// cannot alter the ABI in any way.
3014-
if (decl->predatesConcurrency()) {
3014+
if (decl->preconcurrency()) {
30153015
ty = ty->stripConcurrency(/*recurse=*/true, /*dropGlobalActor=*/true);
30163016
}
30173017

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ Optional<CustomAttrNominalPair> Decl::getGlobalActorAttr() const {
725725
None);
726726
}
727727

728-
bool Decl::predatesConcurrency() const {
729-
if (getAttrs().hasAttribute<PredatesConcurrencyAttr>())
728+
bool Decl::preconcurrency() const {
729+
if (getAttrs().hasAttribute<PreconcurrencyAttr>())
730730
return true;
731731

732732
// Imported C declarations always predate concurrency.

lib/AST/Module.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,14 +2302,14 @@ SourceFile::setImports(ArrayRef<AttributedImport<ImportedModule>> imports) {
23022302
Imports = getASTContext().AllocateCopy(imports);
23032303
}
23042304

2305-
bool SourceFile::hasImportUsedPredatesConcurrency(
2305+
bool SourceFile::hasImportUsedPreconcurrency(
23062306
AttributedImport<ImportedModule> import) const {
2307-
return PredatesConcurrencyImportsUsed.count(import) != 0;
2307+
return PreconcurrencyImportsUsed.count(import) != 0;
23082308
}
23092309

2310-
void SourceFile::setImportUsedPredatesConcurrency(
2310+
void SourceFile::setImportUsedPreconcurrency(
23112311
AttributedImport<ImportedModule> import) {
2312-
PredatesConcurrencyImportsUsed.insert(import);
2312+
PreconcurrencyImportsUsed.insert(import);
23132313
}
23142314

23152315
bool HasImplementationOnlyImportsRequest::evaluate(Evaluator &evaluator,

0 commit comments

Comments
 (0)