[clang] [Clang] Prevent potential null pointer dereferences (PR #117176)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 07:34:39 PST 2024
================
@@ -1908,9 +1908,9 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
return true;
// ensure both args have 3 elements
int NumElementsArg1 =
- TheCall->getArg(0)->getType()->getAs<VectorType>()->getNumElements();
+ TheCall->getArg(0)->getType()->casAs<VectorType>()->getNumElements();
----------------
s-perron wrote:
```suggestion
TheCall->getArg(0)->getType()->castAs<VectorType>()->getNumElements();
```
https://github.com/llvm/llvm-project/pull/117176
More information about the cfe-commits
mailing list