This is an archive of the discontinued LLVM Phabricator instance.

Handle null dereference
AbandonedPublic

Authored by akshaykhadse on Apr 11 2023, 12:27 AM.

Details

Summary

Add assertes to ensure that we don't derefernce a nullptr

Diff Detail

Event Timeline

akshaykhadse created this revision.Apr 11 2023, 12:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 12:27 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
akshaykhadse requested review of this revision.Apr 11 2023, 12:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 12:27 AM
skan added inline comments.Apr 11 2023, 12:39 AM
llvm/lib/CodeGen/WinEHPrepare.cpp
254

https://llvm.org/docs/CodingStandards.html#assert-liberally

put some kind of error message in the assertion statement,

craig.topper added inline comments.Apr 11 2023, 1:03 AM
llvm/lib/CodeGen/WinEHPrepare.cpp
254

Use cast instead of dyn_cast. cast has an internal assert

Use cast instead of dyn_cast

akshaykhadse marked 2 inline comments as done.Apr 11 2023, 1:44 AM
skan accepted this revision.Apr 11 2023, 4:15 AM

LGTM

This revision is now accepted and ready to land.Apr 11 2023, 4:15 AM
LuoYuanke added inline comments.Apr 11 2023, 4:41 AM
llvm/lib/CodeGen/WinEHPrepare.cpp
321–322

Did you use "git commit --amend"?

skan added inline comments.Apr 11 2023, 6:40 AM
llvm/lib/CodeGen/WinEHPrepare.cpp
321–322

Did you use "git commit --amend"?

Good point. I didn't notice that :-(

Address review comments

akshaykhadse marked 2 inline comments as done.Apr 11 2023, 10:29 PM
skan added a comment.Apr 11 2023, 10:51 PM

This patch is duplicated with D147923

akshaykhadse added a comment.EditedApr 11 2023, 11:28 PM

This patch is duplicated with D147923

I think we can abandon the current one in that case

akshaykhadse abandoned this revision.Apr 11 2023, 11:28 PM