[PATCH] D45166: [ELF] - Introduce helper for iterating over linker commands.
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 3 14:05:06 PDT 2018
espindola added inline comments.
================
Comment at: ELF/LinkerScript.h:317
+template <class CmdType> static auto filter(ArrayRef<BaseCommand *> V) {
+ struct Iter
----------------
s/static/inline, no?
Using auto as a return type is c++14 according to clang.
This could probably use a map + filter:
template <class CmdType>
using Foo = llvm::filter_iterator<ArrayRef<BaseCommand *>::iterator,
decltype(&dynCastToCmdType<CmdType>)>;
template <class CmdType>
using Bar =
llvm::mapped_iterator<Foo<CmdType>, decltype(dynCastToCmdType<CmdType>) *>;
template <class CmdType>
llvm::iterator_range<Bar<CmdType>> filter(ArrayRef<BaseCommand *> V) {
But it feels like some of this code should be in LLVM. In particular, LLVM should probably have
* a make_mapped_range function
* type alias for filter_iterator_range
https://reviews.llvm.org/D45166
More information about the llvm-commits
mailing list