[clang] [compiler-rt] [clang][UBSan] Add implicit conversion check for bitfields (PR #75481)
John McCall via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 15:51:44 PST 2024
================
@@ -1097,6 +1112,27 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value *Src, QualType SrcType,
{Src, Dst});
}
+static llvm::Value *EmitIsNegativeTestHelper(Value *V, QualType VType,
+ const char *Name,
+ CGBuilderTy &Builder) {
+ // NOTE: zero value is considered to be non-negative.
+ // Is this value a signed type?
+ bool VSigned = VType->isSignedIntegerOrEnumerationType();
+ llvm::Type *VTy = V->getType();
+ if (!VSigned) {
+ // If the value is unsigned, then it is never negative.
+ // FIXME: can we encounter non-scalar VTy here?
----------------
rjmccall wrote:
No, you cannot.
https://github.com/llvm/llvm-project/pull/75481
More information about the llvm-commits
mailing list