[PATCH] D27156: Add `isRelExprOneOf` helper (alternative to D27145).

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 23:43:06 PST 2016


silvas added a comment.

In https://reviews.llvm.org/D27156#608816, @ruiu wrote:

> I agree that at the call side this looks better, but after reviewing the previous one again, I think I still prefer the previous one, because recursive templates are more complicated than the original simple-minded constexpr containing a for-loop. In practice, static_assert'ing on R_END would be enough as a protection.


Unfortunately the R_END approach causes "unhandled case in switch" warnings in getSymVA. What do you think? I like the safety of these switch warnings.



================
Comment at: ELF/Relocations.h:81
+constexpr uint64_t buildRelExprMask(RelExpr Head, RelExprs... Tail) {
+  return (uint64_t(1) << Head) | buildRelExprMask(Tail...);
+}
----------------
joerg wrote:
> Small item, but please add a static assert that 0 <= Head < 64 here.
Sadly it seems like static_assert is not allowed inside constexpr functions :(


https://reviews.llvm.org/D27156





More information about the llvm-commits mailing list