Skip to content

Commit e60ec79

Browse files
committed
review: initialize directly
1 parent a2174da commit e60ec79

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/Parse/ParseHLSLRootSignature.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ std::optional<uint32_t> RootSignatureParser::handleUIntLiteral() {
878878
assert(Literal.isIntegerLiteral() &&
879879
"NumSpelling can only consist of digits");
880880

881-
llvm::APSInt Val = llvm::APSInt(32, /*IsUnsigned=*/true);
881+
llvm::APSInt Val(32, /*IsUnsigned=*/true);
882882
if (Literal.GetIntegerValue(Val)) {
883883
// Report that the value has overflowed
884884
PP.getDiagnostics().Report(CurToken.TokLoc,
@@ -901,7 +901,7 @@ std::optional<int32_t> RootSignatureParser::handleIntLiteral(bool Negated) {
901901
assert(Literal.isIntegerLiteral() &&
902902
"NumSpelling can only consist of digits");
903903

904-
llvm::APSInt Val = llvm::APSInt(32, /*IsUnsigned=*/true);
904+
llvm::APSInt Val(32, /*IsUnsigned=*/true);
905905
// GetIntegerValue will overwrite Val from the parsed Literal and return
906906
// true if it overflows as a 32-bit unsigned int. Then check that it also
907907
// doesn't overflow as a signed 32-bit int.
@@ -937,9 +937,8 @@ std::optional<float> RootSignatureParser::handleFloatLiteral(bool Negated) {
937937
auto DXCSemantics = llvm::APFloat::Semantics::S_IEEEdouble;
938938
auto DXCRoundingMode = llvm::RoundingMode::NearestTiesToEven;
939939

940-
llvm::APFloat Val =
941-
llvm::APFloat(llvm::APFloat::EnumToSemantics(DXCSemantics));
942-
llvm::APFloat::opStatus Status = Literal.GetFloatValue(Val, DXCRoundingMode);
940+
llvm::APFloat Val(llvm::APFloat::EnumToSemantics(DXCSemantics));
941+
llvm::APFloat::opStatus Status(Literal.GetFloatValue(Val, DXCRoundingMode));
943942

944943
// Note: we do not error when opStatus::opInexact by itself as this just
945944
// denotes that rounding occured but not that it is invalid

0 commit comments

Comments
 (0)