[clang] [Clang] Prevent potential null pointer dereferences (PR #117176)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 08:29:30 PST 2024
================
@@ -627,7 +627,7 @@ class Analyzer {
IsNoexcept = isNoexcept(FD);
} else if (auto *BD = dyn_cast<BlockDecl>(D)) {
if (auto *TSI = BD->getSignatureAsWritten()) {
- auto *FPT = TSI->getType()->getAs<FunctionProtoType>();
+ auto *FPT = TSI->getType()->castAs<FunctionProtoType>();
----------------
Fznamznon wrote:
I'm not sure that if we have a signature, we're guaranteed to have the FunctionProtoType. Perhaps we should leave `getAs` and check that returned value is not null before working with it.
@AaronBallman , any change you can help to clarify that?
https://github.com/llvm/llvm-project/pull/117176
More information about the cfe-commits
mailing list