Skip to content

Remove IteratorRange in favor of llvm::iterator_range #27574

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

Conversation

jrose-apple
Copy link
Contributor

Now that llvm::iterator_range has empty, there's not enough reason to keep our own version of it in the Swift repo.

No functionality change.

Now that llvm::iterator_range has 'empty', there's not enough reason to
keep our own version of it in the Swift repo.

No functionality change.
@jrose-apple jrose-apple requested review from gottesmm and atrick October 8, 2019 18:26
@jrose-apple
Copy link
Contributor Author

apple/swift-llvm#174
@swift-ci Please smoke test

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Two small nits and a request. We use this a lot. Why not inject this into LLVM.h and strip the llvm::?


/// An iterator that transforms the result of an underlying bidirectional
/// iterator with a given operation.
///
/// Slightly different semantics from llvm::map_iterator, but we should
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the different semantics here? Just seems out of place with the rest of the PR. Can you elaborate in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's something about whether the underlying iterator returns a reference or not. I don't actually remember the details, but I tried to remove it and failed and I want to leave a warning for others to come.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not the purpose of the PR, as you note, so if you object to it going in in this form I'll just drop it.

@@ -667,7 +667,7 @@ class DeclIterator {

/// The range of declarations stored within an iterable declaration
/// context.
typedef IteratorRange<DeclIterator> DeclRange;
typedef llvm::iterator_range<DeclIterator> DeclRange;
Copy link
Contributor

Choose a reason for hiding this comment

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

using?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mostly wasn't updating existing code, but sure.

@jrose-apple
Copy link
Contributor Author

Why not inject this into LLVM.h and strip the llvm::?

Sure, will do.

If we're going to get rid of swift::IteratorRange, let's make
llvm::iterator_range easy to use.

No functionality change.
@jrose-apple
Copy link
Contributor Author

apple/swift-llvm#174
@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor Author

Hm, guess I have to wait until the LLVM change propagates into stable.

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@jrose-apple jrose-apple merged commit 16bb84f into swiftlang:master Oct 9, 2019
@jrose-apple jrose-apple deleted the we-could-have-called-them-iterator-stoves branch October 9, 2019 23:54
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