diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2024-06-27 12:27:04 +0100 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2024-06-27 12:29:55 +0100 |
commit | 286955caa32b5b9fd959176c85ffb925e8093a0d (patch) | |
tree | f44b08365e822cc04f2095ac03c82280a8c5b31b | |
parent | 06079233f86325cb27a8197975a2bf351652e190 (diff) | |
download | llvm-286955caa32b5b9fd959176c85ffb925e8093a0d.zip llvm-286955caa32b5b9fd959176c85ffb925e8093a0d.tar.gz llvm-286955caa32b5b9fd959176c85ffb925e8093a0d.tar.bz2 |
[Sema] HLSLCompareFloatingRank - don't dereference getAs<> results
Use castAs<> to assert the cast is valid to help avoid null dereferences
Fixes static analyser warning
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index db77e5c..ee921c8 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -4372,8 +4372,8 @@ HLSLCompareFloatingRank(QualType LHS, QualType RHS) { if (const auto *VT = RHS->getAs<VectorType>()) RHS = VT->getElementType(); - const auto L = LHS->getAs<BuiltinType>()->getKind(); - const auto R = RHS->getAs<BuiltinType>()->getKind(); + const auto L = LHS->castAs<BuiltinType>()->getKind(); + const auto R = RHS->castAs<BuiltinType>()->getKind(); if (L == R) return ImplicitConversionSequence::Indistinguishable; return L < R ? ImplicitConversionSequence::Better |