================
@@ -1939,7 +1941,7 @@ static CharUnits computeOffsetHint(ASTContext &astContext,
       // If the path contains a virtual base class we can't give any hint.
       // -1: no hint.
       if (pathElement.Base->isVirtual())
-        return CharUnits::fromQuantity(-1ULL);
+        return CharUnits::fromQuantity( std::numeric_limits<uint64_t>::max());
----------------
andykaylor wrote:

>From https://github.com/llvm/llvm-project/issues/147439:

> While some uses of this pattern are technically correct—such as using -1ULL 
> to represent a binary value of all 1s—these cases are often clearer and more 
> intentional when written using alternatives like ~0ULL or 
> std::numeric_limits::max(). These forms improve readability and reduce the 
> risk of misinterpretation by reviewers and static analysis tools.

The use of `-1ULL` here is intended to represent `-1`, not an all 1s value. 
Something to watch out for as you clean up more of these.

https://github.com/llvm/llvm-project/pull/178225
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to