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.
This commit is contained in:
Paolo Tranquilli
2022-11-08 11:35:01 +01:00
parent fda9d19a97
commit 9731048836
2 changed files with 15 additions and 0 deletions

View File

@@ -22,6 +22,10 @@ def codeql_workspace(repository_name = "codeql"):
_swift_prebuilt_version,
repo_arch,
),
patches = [
"@%s//swift/third_party/swift-llvm-support:patches/remove_getFallthrougDest_assert.patch" % repository_name,
],
patch_args = ["-p1"],
build_file = "@%s//swift/third_party/swift-llvm-support:BUILD.swift-prebuilt.bazel" % repository_name,
sha256 = sha256,
)

View File

@@ -0,0 +1,11 @@
diff -ru a/include/swift/AST/Stmt.h b/include/swift/AST/Stmt.h
--- a/include/swift/AST/Stmt.h 2022-09-21 12:56:54.000000000 +0200
+++ b/include/swift/AST/Stmt.h 2022-11-04 14:39:18.407971007 +0100
@@ -920,7 +920,6 @@
/// Get the CaseStmt block to which the fallthrough transfers control.
/// Set during Sema.
CaseStmt *getFallthroughDest() const {
- assert(FallthroughDest && "fallthrough dest is not set until Sema");
return FallthroughDest;
}
void setFallthroughDest(CaseStmt *C) {