Skip to content

Commit 6352399

Browse files
committed
Swift: fix all upstream headers for C++20
1 parent 9c5aff3 commit 6352399

File tree

4 files changed

+51
-3
lines changed

4 files changed

+51
-3
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ repos:
55
rev: v3.2.0
66
hooks:
77
- id: trailing-whitespace
8-
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
8+
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
99
- id: end-of-file-fixer
10-
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
10+
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
1111

1212
- repo: https://github.com/pre-commit/mirrors-clang-format
1313
rev: v13.0.1

swift/third_party/load.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ def load_dependencies(workspace_name):
4343
build_file = _build(workspace_name, "swift-llvm-support"),
4444
sha256 = sha256,
4545
patch_args = ["-p1"],
46-
patches = ["@%s//swift/third_party/swift-llvm-support:patches/remove-result-of.patch" % workspace_name],
46+
patches = [
47+
"@%s//swift/third_party/swift-llvm-support:patches/%s.patch" % (workspace_name, patch_name)
48+
for patch_name in (
49+
"remove-result-of",
50+
"remove-redundant-operators",
51+
"add-constructor-to-Compilation",
52+
)
53+
],
4754
)
4855

4956
_github_archive(
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
In C++20 aggregate initialization on classes with user-declared constructor is not
2+
available, while in C++11-C++17 it was available if they were defaulted or deleted.
3+
4+
diff --git a/include/swift/Driver/Compilation.h b/include/swift/Driver/Compilation.h
5+
index ee76f92e0de..bd987157593 100644
6+
--- a/include/swift/Driver/Compilation.h
7+
+++ b/include/swift/Driver/Compilation.h
8+
@@ -89,6 +89,9 @@ public:
9+
/// This data is used for cross-module module dependencies.
10+
fine_grained_dependencies::ModuleDepGraph depGraph;
11+
12+
+ Result(bool hadAbnormalExit = false, int exitCode = 0, fine_grained_dependencies::ModuleDepGraph depGraph = {})
13+
+ : hadAbnormalExit{hadAbnormalExit}, exitCode{exitCode}, depGraph{std::move(depGraph)} {}
14+
+
15+
Result(const Result &) = delete;
16+
Result &operator=(const Result &) = delete;
17+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
In C++20 the removed operators are available via operator rewriting and
2+
implicit constructors, providing them leads to ambiguity.
3+
4+
diff --git a/include/swift/SIL/SILValue.h b/include/swift/SIL/SILValue.h
5+
index 378ca039c7e..37c119c50c1 100644
6+
--- a/include/swift/SIL/SILValue.h
7+
+++ b/include/swift/SIL/SILValue.h
8+
@@ -271,16 +271,6 @@ struct ValueOwnershipKind {
9+
10+
explicit operator bool() const { return value != OwnershipKind::Any; }
11+
12+
- bool operator==(ValueOwnershipKind other) const {
13+
- return value == other.value;
14+
- }
15+
- bool operator!=(ValueOwnershipKind other) const {
16+
- return !(value == other.value);
17+
- }
18+
-
19+
- bool operator==(innerty other) const { return value == other; }
20+
- bool operator!=(innerty other) const { return !(value == other); }
21+
-
22+
/// We merge by moving down the lattice.
23+
ValueOwnershipKind merge(ValueOwnershipKind rhs) const {
24+
return value.meet(rhs.value);

0 commit comments

Comments
 (0)