Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
894 | Why not just cast directly to bool? |
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
894 | Yes, it will work. But as int is the underlying type I find this way a bit clearer. I hope to be forgiven if I keep it. |
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
894 | I'm ok in either case. It wasn't clear to me what the rationale was for casting to int; your explanation was helpful. Since the underlying type of an enumeration tends to not be well understood (I had to go look up the rules again), it would be nice if we could use C++23 std::to_underlying(): return std::to_underlying((FloatModeKind)RealTypeUsesObjCFPRetMask & T); LLVM's BitmaskEnum.h has Underlying(), but only exposed in the detail namespace and I don't think it is worth changing just for this. We could do: return static_cast<std::underlying_type_t<FloatModeKind>>((FloatModeKind)RealTypeUsesObjCFPRetMask & T); But I personally don't find that to be an improvement in this case. I think the code is fine as is. |
Why not just cast directly to bool?