[PATCH] D118315: [ADT] Refactor comparison operator in APSInt by compareValues

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 22:21:05 PST 2022


ChuanqiXu created this revision.
ChuanqiXu added reviewers: dexonsmith, bkramer, craig.topper, rjmccall.
ChuanqiXu added a project: clang.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Now the comparison operator in APSInt would require the signedness of the operands are the same, otherwise the compiler would crash. It is really annoying that I found my code crash at `A == B` due to the mismatched signedness.

Then I found there is interface called `compareValues` which handled the mismatched signedness. So I think we should use `compareValues` to refactor the comparison operator. Both of them do comparison and they should have similar semantics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118315

Files:
  llvm/include/llvm/ADT/APSInt.h
  llvm/unittests/ADT/APSIntTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118315.403501.patch
Type: text/x-patch
Size: 4213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/f5f9e16c/attachment.bin>


More information about the llvm-commits mailing list