Skip to content

Commit 14b9ca3

Browse files
[Sema] Fix a warning
This patch fixes: clang/lib/Sema/SemaHLSL.cpp:2225:32: error: absolute value function 'abs' given an argument of type 'int64_t' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
1 parent b336310 commit 14b9ca3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
22222222
Expr *OffsetExpr = TheCall->getArg(1);
22232223
std::optional<llvm::APSInt> Offset =
22242224
OffsetExpr->getIntegerConstantExpr(SemaRef.getASTContext());
2225-
if (!Offset.has_value() || abs(Offset->getExtValue()) != 1) {
2225+
if (!Offset.has_value() || std::abs(Offset->getExtValue()) != 1) {
22262226
SemaRef.Diag(TheCall->getArg(1)->getBeginLoc(),
22272227
diag::err_hlsl_expect_arg_const_int_one_or_neg_one)
22282228
<< 1;

0 commit comments

Comments
 (0)