Skip to content

Commit a2174da

Browse files
committed
review: use c++ style casting
1 parent ff0791f commit a2174da

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
@@ -743,14 +743,14 @@ std::optional<float> RootSignatureParser::parseFloatParam() {
743743
std::optional<uint32_t> UInt = handleUIntLiteral();
744744
if (!UInt.has_value())
745745
return std::nullopt;
746-
return (float)UInt.value();
746+
return float(UInt.value());
747747
}
748748

749749
if (Negated && tryConsumeExpectedToken(TokenKind::int_literal)) {
750750
std::optional<int32_t> Int = handleIntLiteral(Negated);
751751
if (!Int.has_value())
752752
return std::nullopt;
753-
return (float)Int.value();
753+
return float(Int.value());
754754
}
755755

756756
if (tryConsumeExpectedToken(TokenKind::float_literal)) {
@@ -905,8 +905,7 @@ std::optional<int32_t> RootSignatureParser::handleIntLiteral(bool Negated) {
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.
908-
int64_t MaxMagnitude =
909-
-static_cast<int64_t>(std::numeric_limits<int32_t>::min());
908+
int64_t MaxMagnitude = -int64_t(std::numeric_limits<int32_t>::min());
910909
if (Literal.GetIntegerValue(Val) || MaxMagnitude < Val.getExtValue()) {
911910
// Report that the value has overflowed
912911
PP.getDiagnostics().Report(CurToken.TokLoc,
@@ -918,7 +917,7 @@ std::optional<int32_t> RootSignatureParser::handleIntLiteral(bool Negated) {
918917
if (Negated)
919918
Val = -Val;
920919

921-
return static_cast<int32_t>(Val.getExtValue());
920+
return int32_t(Val.getExtValue());
922921
}
923922

924923
std::optional<float> RootSignatureParser::handleFloatLiteral(bool Negated) {

0 commit comments

Comments
 (0)