Using bitmask enums simplifies and clarifies the code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM aside from a tiny naming nit. Thank you for the cleanup!
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
896–897 | Alternatively, you can get rid of the local variable entirely. |
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
225–228 | Oh dear, I was to replace log2 with bitWidth and I only did half the job. Thanks for spotting! |
LGTM again, this time for real.
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
225–228 | Yeah, it was a great catch -- the code would have worked, but been space inefficient, which likely would have been a head scratcher for somebody later wondering why the code was written that way. :-) |
@jolanta.jensen, I was on vacation last week and missed my opportunity to comment on this. I know the change has already landed, but I added a few comments anyway.
clang/include/clang/Basic/TargetInfo.h | ||
---|---|---|
226–227 | I believe this can be simplified to: : llvm::BitWidth<FloatModeKind>; (It should never be necessary to reach directly into a "detail" namespace from user code) | |
896 | This again directly uses the "detail" namespace. I think this would be better written as: return (FloatModeKind)RealTypeUsesObjCFPRetMask & T; | |
clang/lib/Basic/Targets/X86.h | ||
423–425 | Since RealTypeUsesObjCFPRetMask is declared as unsigned, it would be best to cast to unsigned instead of int here. | |
703 | Likewise, cast to unsigned here. |
@tahonermann, I addressed your comments in https://reviews.llvm.org/D129373. I just need to remove a tab that crept in and it seems to be more difficult than I thought as my code does not seem to have any tab and reformatting the code does not change the file.
I believe this can be simplified to:
(It should never be necessary to reach directly into a "detail" namespace from user code)