-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[move-only] A group of batched changes #65353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gottesmm
merged 11 commits into
swiftlang:main
from
gottesmm:pr-7fddccd1df47d4c57c27121727562d691b9f2397
Apr 25, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b957fbb
[generic-spec] Add an option -sil-generic-dump-functions-after-specia…
gottesmm c577055
[move-only] Instead of using AccessUseVisitor to visit addresses use …
gottesmm 9252d5e
[move-only] Eliminate dead code that was not removed when re-projecte…
gottesmm 438974a
[move-only] When emitting borrows for move only types, use a load [co…
gottesmm b585a18
[move-only] If we diagnose an invalid escaping capture, turn off nonc…
gottesmm 9a0b966
[move-only] When emitting accesses to let boxes containing a noncopya…
gottesmm af8a097
[move-only] Add a large SILGen/-verify test that checks captures of e…
gottesmm e3054a0
[move-only] Clone all __owned tests into consuming tests.
gottesmm 7e992ce
[move-only] When emitting exclusivity diagnostics for move only types…
gottesmm 739417f
[move-only] Convert __shared to borrowing in move only tests.
gottesmm 9c8d224
Update test for changes in https://github.com/apple/swift/pull/65377
gottesmm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===--- NoDiscard.h ------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SWIFT_BASIC_NODISCARD_H | ||
#define SWIFT_BASIC_NODISCARD_H | ||
|
||
#if __cplusplus > 201402l && __has_cpp_attribute(nodiscard) | ||
#define SWIFT_NODISCARD [[nodiscard]] | ||
#elif __has_cpp_attribute(clang::warn_unused_result) | ||
#define SWIFT_NODISCARD [[clang::warn_unused_result]] | ||
#else | ||
#define SWIFT_NODISCARD | ||
#endif | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===--- AddressUseKind.h -------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SWIFT_SIL_ADDRESSUSEKIND_H | ||
#define SWIFT_SIL_ADDRESSUSEKIND_H | ||
|
||
namespace swift { | ||
|
||
enum class AddressUseKind { NonEscaping, PointerEscape, Unknown }; | ||
|
||
inline AddressUseKind meet(AddressUseKind lhs, AddressUseKind rhs) { | ||
return (lhs > rhs) ? lhs : rhs; | ||
} | ||
|
||
} // namespace swift | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//===--- AddressWalker.h --------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// | ||
/// This header defines a walker for SIL addresses that is guaranteed by the | ||
/// language to be able to traverse the SIL from an address def to all of its | ||
/// transitive uses. This is validated by the SIL optimizer. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SWIFT_SIL_ADDRESSWALKER_H | ||
#define SWIFT_SIL_ADDRESSWALKER_H | ||
|
||
#include "swift/SIL/AddressUseKind.h" | ||
#include "swift/SIL/SILValue.h" | ||
|
||
namespace swift { | ||
|
||
/// A state structure for findTransitiveUsesForAddress. Intended to be only used | ||
/// a single time. Please always use a new one for every call to | ||
/// findTransitiveUsesForAddress. | ||
/// | ||
/// Validated by the SIL verifier as always being able to visit all addresses | ||
/// derived from alloc_stack, ref_element_addr, project_box, ref_tail_addr and | ||
/// all other address roots. | ||
class TransitiveAddressWalker { | ||
/// Whether we could tell if this address use didn't escape, did have a | ||
/// pointer escape, or unknown if we failed to understand something. | ||
AddressUseKind result = AddressUseKind::NonEscaping; | ||
|
||
unsigned didInvalidate = false; | ||
|
||
public: | ||
virtual ~TransitiveAddressWalker() {} | ||
|
||
protected: | ||
/// Customization point for visiting uses. Returns true if we should continue | ||
/// visiting. | ||
/// | ||
/// NOTE: Do not call this directly from within | ||
/// findTransitiveUsesForAddress. Please call callVisitUse. This is intended | ||
/// just for subclasses to override. | ||
virtual bool visitUse(Operand *use) { return true; } | ||
|
||
virtual void onError(Operand *use) {} | ||
|
||
void meet(AddressUseKind other) { | ||
assert(!didInvalidate); | ||
result = swift::meet(result, other); | ||
} | ||
|
||
private: | ||
/// Shim that actually calls visitUse and changes early exit. | ||
void callVisitUse(Operand *use) { | ||
assert(!didInvalidate); | ||
if (!visitUse(use)) | ||
result = AddressUseKind::Unknown; | ||
} | ||
|
||
public: | ||
AddressUseKind walk(SILValue address) &&; | ||
}; | ||
|
||
/// The algorithm that is used to determine what the verifier will consider to | ||
/// be transitive uses of the given address. Used to implement \see | ||
/// findTransitiveUses. | ||
/// | ||
/// Returns \p AccessUseKind::Unknown on error. | ||
AddressUseKind findTransitiveUsesForAddress(SILValue address, | ||
TransitiveAddressWalker &visitor); | ||
|
||
} // namespace swift | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.