mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 12:46:08 +00:00

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 https://github.com/llvm/llvm-project/issues/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