Skip to content

Commit 112014b

Browse files
authored
[Clang][NFC] Use temporary instead of one use local variable when creating APValue (#137029)
Static analysis flagged this code b/c we should have been using std::move when passing by value since the value is not used anymore. In this case the simpler fix is just to use a temporary value as many of the other cases where we simply use MakeIntValue to then create an APValue result from it.
1 parent ff36508 commit 112014b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,9 +6147,8 @@ static APValue EvaluateSizeTTypeTrait(Sema &S, TypeTrait Kind,
61476147
S.Diag(KWLoc, diag::err_arg_is_not_destructurable) << T << ArgRange;
61486148
return APValue();
61496149
}
6150-
llvm::APSInt V =
6151-
S.getASTContext().MakeIntValue(*Size, S.getASTContext().getSizeType());
6152-
return APValue{V};
6150+
return APValue(
6151+
S.getASTContext().MakeIntValue(*Size, S.getASTContext().getSizeType()));
61536152
break;
61546153
}
61556154
default:

0 commit comments

Comments
 (0)