[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 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
Loading
Please sign in to comment