Skip to content

Commit 286955c

Browse files
committed
[Sema] HLSLCompareFloatingRank - don't dereference getAs<> results
Use castAs<> to assert the cast is valid to help avoid null dereferences Fixes static analyser warning
1 parent 0607923 commit 286955c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,8 +4372,8 @@ HLSLCompareFloatingRank(QualType LHS, QualType RHS) {
43724372
if (const auto *VT = RHS->getAs<VectorType>())
43734373
RHS = VT->getElementType();
43744374

4375-
const auto L = LHS->getAs<BuiltinType>()->getKind();
4376-
const auto R = RHS->getAs<BuiltinType>()->getKind();
4375+
const auto L = LHS->castAs<BuiltinType>()->getKind();
4376+
const auto R = RHS->castAs<BuiltinType>()->getKind();
43774377
if (L == R)
43784378
return ImplicitConversionSequence::Indistinguishable;
43794379
return L < R ? ImplicitConversionSequence::Better

0 commit comments

Comments
 (0)