[PATCH] D45166: [ELF] - Introduce helper for iterating over linker commands.

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 03:29:25 PDT 2018


arichardson added inline comments.


================
Comment at: ELF/LinkerScript.h:320
+template <class CmdType> CmdType *castToCmdType(BaseCommand *Cmd) {
+  return cast<CmdType>(Cmd);
+}
----------------
This wrapper function could also be replaced with
```
template<typename CmdType>
using CastCmdType = CmdType *(*)(BaseCommand*);
```
And then using `static_cast<CastCmdType<CmdType>>(&llvm::cast<CmdType, BaseCommand>)` instead of `castToCmdType<CmdType>`.

However, I'm not sure that's any easier to understand.


https://reviews.llvm.org/D45166





More information about the llvm-commits mailing list