[PATCH] D157948: [NFC]Fix possibly deref nullptr
Kan Shengchen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 07:40:51 PDT 2023
skan added a comment.
In D157948#4588131 <https://reviews.llvm.org/D157948#4588131>, @XinWang10 wrote:
> In D157948#4587733 <https://reviews.llvm.org/D157948#4587733>, @skan wrote:
>
>> In D157948#4587327 <https://reviews.llvm.org/D157948#4587327>, @XinWang10 wrote:
>>
>>> In D157948#4587289 <https://reviews.llvm.org/D157948#4587289>, @skan wrote:
>>>
>>>> Is this a NFC change or a bug fix? If NFC, shouldn't we use assert?
>>>
>>> cast could use assert internally, I think it's same to explicit assert.
>>
>> Then how about others?
>
> OK, the other two places are in same function, line 432 shows
>
> MMI = MMIWP ? &MMIWP->getMMI() : nullptr;
>
> So MMI could be nullptr, I just add add condition for those could deref this MMI, no func change.
No, if `MMI` could be nullptr, then it's not a NFC change. If we never crash at this point, assert should be used instead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157948/new/
https://reviews.llvm.org/D157948
More information about the llvm-commits
mailing list