aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorAlex Sepkowski <alexsepkowski@gmail.com>2025-07-09 16:13:28 -0700
committerGitHub <noreply@github.com>2025-07-09 16:13:28 -0700
commit7c16a31aa593b9cc750e61b260c27ade74edb1dd (patch)
tree6628e4804b3e91a3d0a63100ba1a565f51c9c12b /clang/lib/AST/ExprConstant.cpp
parentddf9b91f9fed8654c4649881f7db51f1e474701f (diff)
downloadllvm-7c16a31aa593b9cc750e61b260c27ade74edb1dd.zip
llvm-7c16a31aa593b9cc750e61b260c27ade74edb1dd.tar.gz
llvm-7c16a31aa593b9cc750e61b260c27ade74edb1dd.tar.bz2
Address a handful of C4146 compiler warnings where literals can be replaced with std::numeric_limits (#147623)
This PR addresses instances of compiler warning C4146 that can be replaced with std::numeric_limits. Specifically, these are cases where a literal such as '-1ULL' was used to assign a value to a uint64_t variable. The intent is much cleaner if we use the appropriate std::numeric_limits value<Type>::max() for these cases. Addresses #147439
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index fc6e884..e23e843 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1428,11 +1428,11 @@ namespace {
}
bool destroy(bool RunDestructors = true) {
bool OK = cleanup(Info, RunDestructors, OldStackSize);
- OldStackSize = -1U;
+ OldStackSize = std::numeric_limits<unsigned>::max();
return OK;
}
~ScopeRAII() {
- if (OldStackSize != -1U)
+ if (OldStackSize != std::numeric_limits<unsigned>::max())
destroy(false);
// Body moved to a static method to encourage the compiler to inline away
// instances of this class.