Skip to content

Pre-fix some build failures that we'll see with newer llvm #41550

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 4 commits into from
Mar 2, 2022

Conversation

benlangmuir
Copy link
Contributor

Fixes some build failures on the "next" branch that also seem like generally good changes to take in "main".

  • Include Optional.h and Hashing.h in more places
  • Use std::make_reverse_iterator
  • Remove use of LLVM_LVALUE_FUNCTION
  • Migrate from SmallVector::set_size to resize_for_overwrite (and truncate)

Add a few includes of Optional.h and Hashing.h. These files are failing
ot build in the "next" branch due to changes in llvm's own includes, but
it's general goodness to include them on main as well.
We're using c++14, so no need to use the llvm:: copy of this. The llvm
version is going away, so this fixes build errors on the "next" branch.
We're already using lvalue functions elsewhere in the codebase, so this
isn't adding value. In the "next" branch, this macro has been removed,
so this fixes a build error in that case.
In the "next" branch, set_size has been made protected. Instead, users
can use resize_for_overwrite, optionally followed by truncate, to
handle the same use cases more safely.
@benlangmuir
Copy link
Contributor Author

swiftlang/llvm-project#3995
@swift-ci please test

@benlangmuir benlangmuir requested a review from CodaFi February 24, 2022 23:05
@benlangmuir
Copy link
Contributor Author

swiftlang/llvm-project#3995
@swift-ci please test macOS

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

LGTM

@benlangmuir benlangmuir merged commit 779bdf0 into swiftlang:main Mar 2, 2022
@benlangmuir benlangmuir deleted the make-next-less-sad branch March 2, 2022 17:23
mwyman added a commit to mwyman/swift that referenced this pull request May 20, 2022
PR swiftlang#41550 changed from using `SmallVector::set_size` to `resize_for_overwrite` and `truncate`, but in `sourcekitd-repl` changing from `reserve` changed the size just prior to getting the `end()` of the output array, leading to retrieving the end of the resized array, rather than the array prior to resizing.

The conversion needs to begin at the original output's end, rather than the resized-to-reserve output size.
mwyman added a commit to mwyman/swift that referenced this pull request May 20, 2022
PR swiftlang#41550 changed from using `SmallVector::set_size` to `resize_for_overwrite` and `truncate`, but in `sourcekitd-repl` changing from `reserve` changed the size just prior to getting the `end()` of the output array, leading to retrieving the end of the resized array, rather than the array prior to resizing.

The conversion needs to begin at the original output's end, rather than the resized-to-reserve output size, otherwise the conversion triggers the asserts at lines 101 and 116 (with `res == targetExhausted`).
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