[PATCH] D145069: [analyzer][NFC] Split the no state change logic and bug report suppression into two visitors
Gábor Spaits via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 1 07:20:52 PST 2023
spaits created this revision.
spaits added reviewers: NoQ, steakhal, Szelethus.
Herald added subscribers: manas, ASDenysPetrov, martong, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
spaits requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
As discussed in my previous patch (D142354 <https://reviews.llvm.org/D142354>) the analyzer can understand std::variant and std::any through regular inlining. However warnings coming from these classes were suppressed by NoStateChangeFuncVisitor, more specificly by an instance of NoStoreFuncVisitor. The reason behind that is that we suppress bug reports when a system header function was supposed to initialize its parameter but failed to (as you can read about it in a comment block visible in this patch).
Now the problem is that these bug report were suppressed, but they had nothing to do with uninitialized values. In a follow up patch I intend to fix that and see how this suppression logic works as it was meant to be, but my initial testing shows that they no longer falsely suppress reports like this:
std::variant<int, std::string> v = 0;
int i = std::get<int>(v);
10/i; // FIXME: This should warn for division by zero!
In this patch I only separated these two functionalities because I don't think this suppression should be implemented in a NoStateChangeVisitor but in it's own.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145069
Files:
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145069.501500.patch
Type: text/x-patch
Size: 4126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230301/3d1ebe2b/attachment.bin>
More information about the cfe-commits
mailing list