diff options
author | Tom Honermann <tom.honermann@intel.com> | 2025-03-06 15:12:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-06 18:12:20 -0500 |
commit | 813325e5d44c01f50aaca035629fcba8157fd5c0 (patch) | |
tree | 3e752638d27e0662aa3066706e5bd500d8d8d709 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 93f0f3d33be596321730e9194cf24a73a75ce702 (diff) | |
download | llvm-813325e5d44c01f50aaca035629fcba8157fd5c0.zip llvm-813325e5d44c01f50aaca035629fcba8157fd5c0.tar.gz llvm-813325e5d44c01f50aaca035629fcba8157fd5c0.tar.bz2 |
[Clang][NFC] Change uses of getAs() to castAs() where the target type is assured. (#130188)
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.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
0 files changed, 0 insertions, 0 deletions