[clang] [Clang] Fix potential null pointer dereferences in Sema::AddInitializerToDecl (PR #94368)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 09:40:40 PDT 2024


smanna12 wrote:

> Why add the check here rather than add an assertion at the point of assignation (i.e.
> 
> ```
> Init = Result.getAs<Expr>();
> ```
> 
> Since Init is passed into CheckSelfReference on line 13712 where it's dereferenced the same issue binds there as well

Thanks @feg208 for reviews! I agree with you. I missed the case you mentioned and fixed the patch.

https://github.com/llvm/llvm-project/pull/94368


More information about the cfe-commits mailing list