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

Conversation

AlexDenisov
Copy link
Contributor

No description provided.

AlexDenisov added a commit to github/codeql that referenced this pull request Nov 30, 2022
AlexDenisov added a commit to github/codeql that referenced this pull request Nov 30, 2022
Comment on lines +73 to +100
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 };
}
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.

@AlexDenisov AlexDenisov marked this pull request as ready for review December 1, 2022 16:17
@AlexDenisov AlexDenisov merged commit 96a5813 into main Dec 1, 2022
@AlexDenisov AlexDenisov deleted the alexdenisov/patch-swift branch December 1, 2022 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants