Skip to content

Commit 9731048

Browse files
committed
Swift: remove an assert from swift headers
An interesting byproduct was finding a problematic `assert` in the Swift headers. An incomplete `FallthroughStmt` was asserting on having a destination. I did not find any other sensible way of getting rid of the crash when running in debug mode than to patch the header.
1 parent fda9d19 commit 9731048

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

misc/bazel/workspace.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def codeql_workspace(repository_name = "codeql"):
2222
_swift_prebuilt_version,
2323
repo_arch,
2424
),
25+
patches = [
26+
"@%s//swift/third_party/swift-llvm-support:patches/remove_getFallthrougDest_assert.patch" % repository_name,
27+
],
28+
patch_args = ["-p1"],
2529
build_file = "@%s//swift/third_party/swift-llvm-support:BUILD.swift-prebuilt.bazel" % repository_name,
2630
sha256 = sha256,
2731
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff -ru a/include/swift/AST/Stmt.h b/include/swift/AST/Stmt.h
2+
--- a/include/swift/AST/Stmt.h 2022-09-21 12:56:54.000000000 +0200
3+
+++ b/include/swift/AST/Stmt.h 2022-11-04 14:39:18.407971007 +0100
4+
@@ -920,7 +920,6 @@
5+
/// Get the CaseStmt block to which the fallthrough transfers control.
6+
/// Set during Sema.
7+
CaseStmt *getFallthroughDest() const {
8+
- assert(FallthroughDest && "fallthrough dest is not set until Sema");
9+
return FallthroughDest;
10+
}
11+
void setFallthroughDest(CaseStmt *C) {

0 commit comments

Comments
 (0)