This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Initialize member pointer and avoid potential null dereference
ClosedPublic

Authored by schittir on Aug 24 2023, 1:51 PM.

Diff Detail

Event Timeline

schittir created this revision.Aug 24 2023, 1:51 PM
Herald added a project: Restricted Project. · View Herald Transcript
schittir requested review of this revision.Aug 24 2023, 1:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 1:51 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaronpuchert added inline comments.
clang/lib/Analysis/ThreadSafety.cpp
2243

It seems to me that CurrentMethod is unconditionally assigned a value here, before it is being read anywhere.

aaron.ballman accepted this revision.Aug 25 2023, 5:11 AM

LGTM though I can take or leave the changes to ThreadSafety.cpp.

clang/lib/Analysis/ThreadSafety.cpp
2243

It is, but this isn't the ThreadSafetyAnalyzer constructor, so there's a window for misuse. So I think this is a false positive, but still a reasonable enough change to make.

This revision is now accepted and ready to land.Aug 25 2023, 5:11 AM

Thank you for the reviews, Aaron and Aaron!
All tests pass. Landing the patch now.