[PATCH] D48040: Implement constexpr __builtin_*_overflow

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 11 11:47:41 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/AST/ExprConstant.cpp:8260
+      // It won't GROW, since that isn't possible, so use this to allow
+      // TruncOrSelf.
+      APSInt Temp = Result.extOrTrunc(Info.Ctx.getTypeSize(ResultType));
----------------
The comment should explain *why* growth isn't possible (it's because we extended to the max-width type earlier).

I don't think a casual reader is going to understand what you're saying about TruncOrSelf (that APSInt doesn't have such an operation, but that we can safely simulate it with `extOrTrunc` because we'll never do an extension).


Repository:
  rC Clang

https://reviews.llvm.org/D48040





More information about the cfe-commits mailing list