This is an archive of the discontinued LLVM Phabricator instance.

[clang][Analyzer] Track null stream argument in alpha.unix.Stream .
ClosedPublic

Authored by balazske on Jun 21 2021, 6:51 AM.

Details

Summary

The checker contains check for passing a NULL stream argument.
This change should make more easy to identify where the passed pointer
becomes NULL.

Diff Detail

Event Timeline

balazske created this revision.Jun 21 2021, 6:51 AM
balazske requested review of this revision.Jun 21 2021, 6:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2021, 6:51 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
NoQ accepted this revision.Jun 21 2021, 4:01 PM

Yes please!

clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
838

Stream pointer *is* null. There's no doubt about that.

Path notes should look like one big complete sentence: "Assuming pointer value is null on line 83, ... stream pointer might be is null on line 88".

This isn't part of this patch so I'm just spreading awareness^^

This revision is now accepted and ready to land.Jun 21 2021, 4:01 PM

Thanks for the quick accept.
The goal is to make this checker non-alpha.

clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
838

I do not like the messages in this checker but plan to improve it later. I observed that the last . character is removed from the messages, they can be like one sentence but multiple sentences.