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

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 07:33:24 PST 2016


joerg added inline comments.


================
Comment at: ELF/Relocations.h:90
+bool isRelExprOneOf(RelExpr Expr, RelExprs... Exprs) {
+  return (uint64_t(1) << Expr) & buildRelExprMask(Exprs...);
+}
----------------
ruiu wrote:
> joerg wrote:
> > ...and a run-time assert for for 0<=Expr < 64 here.
> Maybe we should instead define `R_END` at end of `RelExpr` and statically assert R_END < 64;
One motivation for doing the asserts here is that there is a good chance it will get copied to other places. So getting it right the first time helps avoiding surprises in other places where the constraints are not that obvious.


https://reviews.llvm.org/D27156





More information about the llvm-commits mailing list