Skip to content

Commit 5941cb9

Browse files
Merge remote-tracking branch 'apple/main' into katei/merge-main-2021-02-12
2 parents 37883a0 + f5e32aa commit 5941cb9

File tree

156 files changed

+6175
-885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+6175
-885
lines changed

cmake/modules/Libdispatch.cmake

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,24 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
3434
endif()
3535

3636
set(DISPATCH_SDKS)
37+
38+
# Build the host libdispatch if needed.
3739
if(SWIFT_BUILD_HOST_DISPATCH)
3840
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
3941
if(NOT "${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_SDKS)
4042
list(APPEND DISPATCH_SDKS "${SWIFT_HOST_VARIANT_SDK}")
4143
endif()
4244
endif()
43-
44-
foreach(sdk ${SWIFT_SDKS})
45-
if(NOT "${sdk}" IN_LIST SWIFT_APPLE_PLATFORMS)
46-
list(APPEND DISPATCH_SDKS "${sdk}")
47-
endif()
48-
endforeach()
4945
endif()
5046

47+
# Build any target libdispatch if needed.
48+
foreach(sdk ${SWIFT_SDKS})
49+
# Apple targets have libdispatch available, do not build it.
50+
if(NOT "${sdk}" IN_LIST SWIFT_APPLE_PLATFORMS)
51+
list(APPEND DISPATCH_SDKS "${sdk}")
52+
endif()
53+
endforeach()
54+
5155
foreach(sdk ${DISPATCH_SDKS})
5256
set(ARCHS ${SWIFT_SDK_${sdk}_ARCHITECTURES})
5357
if(${sdk} STREQUAL "${SWIFT_HOST_VARIANT_SDK}")

include/swift/ABI/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ class alignas(Alignment_DefaultActor) DefaultActor : public HeapObject {
4141

4242
} // end namespace swift
4343

44-
#endif
44+
#endif

include/swift/ABI/TaskStatus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
namespace swift {
2727

28-
/// The abstract base class for all sttatus records.
28+
/// The abstract base class for all status records.
2929
///
3030
/// TaskStatusRecords are typically allocated on the stack (possibly
3131
/// in the task context), partially initialized, and then atomically

include/swift/AST/ASTSynthesis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,4 @@ Type synthesizeType(SynthesisContext &SC, const OptionalSynthesizer<S> &s) {
353353

354354
} // end namespace swift
355355

356-
#endif
356+
#endif

include/swift/AST/AccessNotes.h

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//===--- AccessNotes.h - Access Notes ---------------------------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// Implements access notes, which allow certain modifiers or attributes to be
14+
// added to the declarations in a module.
15+
//
16+
//===----------------------------------------------------------------------===//
17+
18+
#ifndef ACCESSNOTES_H
19+
#define ACCESSNOTES_H
20+
21+
#include "swift/AST/Identifier.h"
22+
#include "swift/AST/StorageImpl.h"
23+
#include "swift/Basic/NullablePtr.h"
24+
#include "llvm/Support/Error.h"
25+
#include "llvm/Support/MemoryBuffer.h"
26+
#include "llvm/Support/raw_ostream.h"
27+
#include <set>
28+
#include <string>
29+
#include <vector>
30+
31+
namespace swift {
32+
class ASTContext;
33+
class ValueDecl;
34+
35+
/// The name of the declaration an access note should be applied to.
36+
///
37+
/// Grammatically, this is equivalent to a \c ParsedDeclName, but supports a
38+
/// subset of that type's features.
39+
class AccessNoteDeclName {
40+
public:
41+
/// The names of the parent/contextual declarations containing the declaration
42+
/// the access note should apply to.
43+
std::vector<Identifier> parentNames;
44+
45+
/// The name of the declaration the access note should be applied to. (For
46+
/// accessors, this is actually the name of the storage it's attached to.)
47+
DeclName name;
48+
49+
/// For accessors, the kind of accessor; for non-accessors, \c None.
50+
Optional<AccessorKind> accessorKind;
51+
52+
AccessNoteDeclName(ASTContext &ctx, StringRef str);
53+
AccessNoteDeclName();
54+
55+
/// If true, an access note with this name should apply to \p VD.
56+
bool matches(ValueDecl *VD) const;
57+
58+
/// If true, the name is empty and invalid.
59+
bool empty() const;
60+
61+
void print(llvm::raw_ostream &os) const;
62+
SWIFT_DEBUG_DUMP;
63+
};
64+
65+
/// An individual access note specifying modifications to a declaration.
66+
class AccessNote {
67+
public:
68+
/// The name of the declaration to modify.
69+
AccessNoteDeclName Name;
70+
71+
/// If \c true, add an @objc attribute; if \c false, delete an @objc
72+
/// attribute; if \c None, do nothing.
73+
Optional<bool> ObjC;
74+
75+
/// If \c true, add a dynamic modifier; if \c false, delete a dynamic
76+
/// modifier; if \c None, do nothing.
77+
Optional<bool> Dynamic;
78+
79+
/// If set, modify an @objc attribute to give it the specified \c ObjCName.
80+
/// If \c ObjC would otherwise be \c None, it will be set to \c true.
81+
Optional<ObjCSelector> ObjCName;
82+
83+
void dump(llvm::raw_ostream &os, int indent = 0) const;
84+
SWIFT_DEBUG_DUMP;
85+
};
86+
87+
/// A set of access notes with module-wide metadata about them.
88+
class AccessNotesFile {
89+
public:
90+
/// A human-readable string describing why the access notes are being applied.
91+
/// Inserted into diagnostics about access notes in the file.
92+
std::string Reason;
93+
94+
/// Access notes to apply to the module.
95+
std::vector<AccessNote> Notes;
96+
97+
/// Load the access notes from \p buffer, or \c None if they cannot be loaded.
98+
/// Diagnoses any parsing issues with the access notes file.
99+
static llvm::Optional<AccessNotesFile>
100+
load(ASTContext &ctx, const llvm::MemoryBuffer *buffer);
101+
102+
/// Look up the access note in this file, if any, which applies to \p VD.
103+
NullablePtr<const AccessNote> lookup(ValueDecl *VD) const;
104+
105+
void dump(llvm::raw_ostream &os) const;
106+
SWIFT_DEBUG_DUMP;
107+
};
108+
109+
}
110+
111+
#endif

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ class alignas(1 << DeclAlignInBits) Decl {
871871
}
872872

873873
/// \returns the unparsed comment attached to this declaration.
874-
RawComment getRawComment(bool SerializedOK = false) const;
874+
RawComment getRawComment(bool SerializedOK = true) const;
875875

876876
Optional<StringRef> getGroupName() const;
877877

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ ERROR(error_mode_cannot_emit_interface,none,
123123
"this mode does not support emitting module interface files", ())
124124
ERROR(error_mode_cannot_emit_module_summary,none,
125125
"this mode does not support emitting module summary files", ())
126+
ERROR(error_mode_cannot_emit_symbol_graph,none,
127+
"this mode does not support emitting symbol graph files", ())
126128
ERROR(cannot_emit_ir_skipping_function_bodies,none,
127129
"the -experimental-skip-*-function-bodies* flags do not support "
128130
"emitting IR", ())
@@ -405,5 +407,16 @@ WARNING(module_incompatible_with_skip_function_bodies,none,
405407
"-experimental-skip-*-function-bodies* flags; they have "
406408
"been automatically disabled", (StringRef))
407409

410+
WARNING(access_notes_file_io_error,none,
411+
"ignored access notes file at '%0' because it cannot be read: %1",
412+
(StringRef, StringRef))
413+
WARNING(error_in_access_notes_file,none,
414+
"ignored access notes file because it cannot be parsed: %0",
415+
(StringRef))
416+
REMARK(warning_in_access_notes_file,none,
417+
"ignored invalid content in access notes file: %0",
418+
(StringRef))
419+
420+
408421
#define UNDEFINE_DIAGNOSTIC_MACROS
409422
#include "DefineDiagnosticMacros.h"

include/swift/AST/DiagnosticsSema.def

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,9 +4274,10 @@ ERROR(actor_isolated_from_escaping_closure,none,
42744274
ERROR(local_function_executed_concurrently,none,
42754275
"concurrently-executed %0 %1 must be marked as '@concurrent'",
42764276
(DescriptiveDeclKind, DeclName))
4277-
ERROR(concurrent_mutation_of_local_capture,none,
4278-
"mutation of captured %0 %1 in concurrently-executing code",
4279-
(DescriptiveDeclKind, DeclName))
4277+
ERROR(concurrent_access_of_local_capture,none,
4278+
"%select{mutation of|reference to}0 captured %1 %2 in "
4279+
"concurrently-executing code",
4280+
(bool, DescriptiveDeclKind, DeclName))
42804281
NOTE(actor_isolated_sync_func,none,
42814282
"calls to %0 %1 from outside of its actor context are "
42824283
"implicitly asynchronous",
@@ -4323,6 +4324,13 @@ ERROR(concurrent_value_outside_source_file,none,
43234324
"conformance 'ConcurrentValue' must occur in the same source file as "
43244325
"%0 %1; use 'UnsafeConcurrentValue' for retroactive conformance",
43254326
(DescriptiveDeclKind, DeclName))
4327+
ERROR(concurrent_value_open_class,none,
4328+
"open class %0 cannot conform to `ConcurrentValue`; "
4329+
"use `UnsafeConcurrentValue`", (DeclName))
4330+
ERROR(concurrent_value_inherit,none,
4331+
"`ConcurrentValue` class %1 cannot inherit from another class"
4332+
"%select{| other than 'NSObject'}0",
4333+
(bool, DeclName))
43264334

43274335
ERROR(actorindependent_let,none,
43284336
"'@actorIndependent' is meaningless on 'let' declarations because "
@@ -5645,5 +5653,35 @@ ERROR(atomics_ordering_must_be_constant, none,
56455653
"ordering argument must be a static method or property of %0",
56465654
(Identifier))
56475655

5656+
//------------------------------------------------------------------------------
5657+
// MARK: access notes
5658+
//------------------------------------------------------------------------------
5659+
5660+
REMARK(attr_added_by_access_note, none,
5661+
"access note for %0 adds %select{attribute|modifier}1 '%2' to this %3",
5662+
(StringRef, bool, StringRef, DescriptiveDeclKind))
5663+
NOTE(fixit_attr_added_by_access_note, none,
5664+
"add %select{attribute|modifier}0 explicitly to silence this warning",
5665+
(bool))
5666+
5667+
REMARK(attr_removed_by_access_note, none,
5668+
"access note for %0 removes %select{attribute|modifier}1 '%2' from "
5669+
"this %3",
5670+
(StringRef, bool, StringRef, DescriptiveDeclKind))
5671+
NOTE(fixit_attr_removed_by_access_note, none,
5672+
"remove %select{attribute|modifier}0 explicitly to silence this warning",
5673+
(bool))
5674+
5675+
REMARK(attr_objc_name_changed_by_access_note, none,
5676+
"access note for %0 changes the '@objc' name of this %1 to %2",
5677+
(StringRef, DescriptiveDeclKind, ObjCSelector))
5678+
NOTE(fixit_attr_objc_name_changed_by_access_note, none,
5679+
"change '@objc' name in source code explicitly to silence this warning",
5680+
())
5681+
REMARK(attr_objc_name_conflicts_with_access_note, none,
5682+
"access note for %0 changes the '@objc' name of this %1 to %2, but "
5683+
"source code specifies %3; the access note will be ignored",
5684+
(StringRef, DescriptiveDeclKind, ObjCSelector, ObjCSelector))
5685+
56485686
#define UNDEFINE_DIAGNOSTIC_MACROS
56495687
#include "DefineDiagnosticMacros.h"

include/swift/AST/Effects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ void simple_display(llvm::raw_ostream &out, FunctionRethrowingKind value);
7474

7575
} // end namespace swift
7676

77-
#endif
77+
#endif

0 commit comments

Comments
 (0)