Static analysis identified two uses of `getAs()` for which the result pointer was unconditionally dereferenced. Source code inspection confirmed that the target type is assured by prior checks. This change replaces these uses of `getAs()` with `castAs()`. The first case, in `clang/lib/CodeGen/Targets/AArch64.cpp`, performs a cast to `BuiltinType` following a check for `isBuiltinType()`. The second case, in `clang/lib/Sema/SemaTemplateVariadic.cpp`, performs a cast to `PackExpansionType` on the result of a call to `getAsType()` on an object of type `TemplateArgument` following confirmation that `isPackExpansion()` returned true and that `getKind()` returned `TemplateArgument::Type`. Inspection of `isPackExpansion()` revealed that it only returns true when the template argument kind is `TemplateArgument::Type` if `isa<PackExpansionType>(getAsType())` is true.
51 KiB
51 KiB