[clang] [Clang] Prevent null pointer dereference in designated initializer check (PR #97220)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 16 11:31:27 PDT 2024
================
@@ -3206,9 +3206,11 @@ ExprResult SemaObjC::BuildInstanceMessage(
}
if (!isDesignatedInitChain) {
const ObjCMethodDecl *InitMethod = nullptr;
+ auto *CurMD = SemaRef.getCurMethodDecl();
+ if (!CurMD)
+ return ExprResult((Expr *)nullptr);
----------------
smanna12 wrote:
Thank you @tahonermann for review and feedback. I have added an assert.
https://github.com/llvm/llvm-project/pull/97220
More information about the cfe-commits
mailing list