[clang] [compiler-rt] [clang][UBSan] Add implicit conversion check for bitfields (PR #75481)

John McCall via cfe-commits cfe-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.
----------------
rjmccall wrote:

This is self-evident and does not need to be in a comment.  Actually, most of the comments in this function are pretty unnecessary; you can just say something like "If the type is unsigned, the value is never negative." and leave everything else self-documenting.

https://github.com/llvm/llvm-project/pull/75481


More information about the cfe-commits mailing list