[PATCH] D83120: [Analyzer][StreamChecker] Using BugType::SuppressOnSink at resource leak report.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 13:23:45 PDT 2020


NoQ added a comment.

Before i forget again: commit messages (and, therefore, review titles) are traditionally written in imperative mood, i.e. "Using" -> "Use" as if you ask git to change something in the project.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:207
   BugType BT_StreamEof{this, "Stream already in EOF", "Stream handling error"};
-  BugType BT_ResourceLeak{this, "Resource leak", "Stream handling error"};
+  BugType BT_ResourceLeak{this, "Resource leak", "Stream handling error", true};
 
----------------
Pls add a comment about what "true" means so that was easier to read, i.e. `/*SuppressOnSink =*/ true`.


================
Comment at: clang/test/Analysis/stream.c:274-284
 // Check that "location uniqueing" works.
 // This results in reporting only one occurence of resource leak for a stream.
 void check_leak_noreturn_2() {
   FILE *F1 = tmpfile();
   if (!F1)
     return;
   if (Test == 1) {
----------------
balazske wrote:
> Szelethus wrote:
> > Why did this change? Is there a sink in the return branch?
> The change is probably because D83115. Because the "uniqueing" one resource leak is reported from the two possible, and the order changes somehow (probably not the shortest is found first).
The shortest should still be found first. I strongly suggest debugging this. Looks like a bug in suppress-on-sink.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83120/new/

https://reviews.llvm.org/D83120





More information about the cfe-commits mailing list