Skip to content

Swift: move patches from extractor code #3

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
merged 1 commit into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions swift-build-system.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,31 @@ index 4d77e374deb..88b6645a811 100644
# These clang header options conflict with 'clang-builtin-headers'.
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-resource-dir-symlink")
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-builtin-headers-in-clang-resource-dir")
diff --git a/include/swift/AST/Stmt.h b/include/swift/AST/Stmt.h
index 532e038c386..f013eee2f98 100644
--- a/include/swift/AST/Stmt.h
+++ b/include/swift/AST/Stmt.h
@@ -920,7 +920,6 @@ public:
/// 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) {
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 75b99a22e73..09115678a82 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -1725,7 +1725,10 @@ StringRef PatternBindingEntry::getInitStringRepresentation(

SourceRange PatternBindingDecl::getSourceRange() const {
SourceLoc startLoc = getStartLoc();
- SourceLoc endLoc = getPatternList().back().getSourceRange().End;
+ SourceLoc endLoc = startLoc;
+ if (!getPatternList().empty()) {
+ endLoc = getPatternList().back().getSourceRange().End;
+ }
if (startLoc.isValid() != endLoc.isValid()) return SourceRange();
return { startLoc, endLoc };
}
Comment on lines +73 to +100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might actually be good to split this diff in multiple patch files with a header in each explaining why the change was needed, also to aid resolving possible future conflicts. The assertion removal btw is because that assertion might get hit on compilation errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, let's split these next time we have to touch the patches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a draft of this change without rebuilding everything, just for the record for the next time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafting the change would require a build, otherwise we can just break something? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revise it when we work on the bootstrapping, it would likely require some more changes/patches so it's a perfect time to improve this.