Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APInt] provide a safe API for zext value and sext value.
Currently, APInt::getSExtValue and getZExtValue crashes on values with more than 64 bits. Users may accidently crash the compiler with this setting when the integer may be i128. As shown in #59316 In this patch we provide a trySExtValue and tryZExtValue to return an Optional, the user needs to explictly unwrap it and condsier the possibility where there my no value in it. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D139683
- Loading branch information
1 parent
80f2f1e
commit 5596810
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5596810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch seems to cause:
Would you mind taking a look? Thanks in advance!
5596810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I am fixing it. It's a bug in unit testing. Sorry for the problem.
5596810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed by a3b4fef
5596810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!