[PATCH] D67647: [Consumed] Refactor handleCall to take function argument list. NFC.

Nicholas Allegra via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 18:05:05 PDT 2019


comex added a comment.

In D67647#1674773 <https://reviews.llvm.org/D67647#1674773>, @dblaikie wrote:

> I wasn't expecting it to involve all this work - but instead to change "arguments()" to return ArrayRef. Though perhaps you didn't go that route to allow future fixes to the strict aliasing (by having an adapting iterator - or perhaps arguments() already uses such an iterator that doesn't hit the strict aliasing issue?) needing to do even more cleaunp work?


Yeah, `arguments()` returns an adapting iterator.

>> - Add an `operator[]` implementation to `iterator_range`.
> 
> I'm not sure that's appropriate - not all types with begin() and end() (even those with random access iterators) would have op[], so it doesn't seem appropriate to add it/depend on it?

Random access iterators are supposed to have `operator[]`, according to:
http://www.cplusplus.com/reference/iterator/RandomAccessIterator/

But the use of a template ensures that it doesn't cause an error with types that don't have `operator[]`, whether they are marked as random-access or not.

I checked the spec for "real" C++20 ranges... it seems that random access ranges don't always have `operator[]`, but "view_interface" (which is a type of range) does:
https://eel.is/c++draft/view.interface

Anyway, I don't think it hurts to have it on this little imitation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67647/new/

https://reviews.llvm.org/D67647





More information about the cfe-commits mailing list