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

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 02:31:46 PST 2016


joerg added a comment.

Otherwise, LGTM.



================
Comment at: ELF/Relocations.h:81
+constexpr uint64_t buildRelExprMask(RelExpr Head, RelExprs... Tail) {
+  return (uint64_t(1) << Head) | buildRelExprMask(Tail...);
+}
----------------
Small item, but please add a static assert that 0 <= Head < 64 here.


================
Comment at: ELF/Relocations.h:90
+bool isRelExprOneOf(RelExpr Expr, RelExprs... Exprs) {
+  return (uint64_t(1) << Expr) & buildRelExprMask(Exprs...);
+}
----------------
...and a run-time assert for for 0<=Expr < 64 here.


https://reviews.llvm.org/D27156





More information about the llvm-commits mailing list