[PATCH] D128182: [NFC] Switch FloatModeKind enum class to use bitmask enums

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 11:47:18 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a tiny naming nit. Thank you for the cleanup!



================
Comment at: clang/include/clang/Basic/TargetInfo.h:895-896
   bool useObjCFPRetForRealType(FloatModeKind T) const {
-    assert(T <= FloatModeKind::Last &&
-           "T value is larger than RealTypeUsesObjCFPRetMask can handle");
-    return RealTypeUsesObjCFPRetMask & (1 << (int)T);
+    int val = llvm::BitmaskEnumDetail::Underlying(T);
+    return RealTypeUsesObjCFPRetMask & val;
   }
----------------
Alternatively, you can get rid of the local variable entirely.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128182/new/

https://reviews.llvm.org/D128182



More information about the cfe-commits mailing list