[PATCH] D41538: [analyzer] Fix some checker's output plist not containing the checker name #2

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 22 03:14:02 PST 2017


xazax.hun created this revision.
xazax.hun added reviewers: NoQ, dcoughlin, george.karpenkov.
Herald added subscribers: dkrupp, a.sidorin, rnkovacs, szepet, baloghadamsoftware, whisperity.

Unfortunately, currently, the analyzer core sets the checker name after the constructor was already run. So if we set the BugType in the constructor, the output plist will not contain a checker name. Right now the idiomatic solution is to create the BugType lazily. This patch moves the lazy initialization from the checker side to the analyzer core. I also found some bugs, when some checkers were triggered even if they were not enabled or wrong checker name is emitted to the plist.

In the future probably it would be better to alter the signature of the checkers' constructor to set the name in the constructor so it is possible to create the BugType eagerly.

This patch is an alternative approach to https://reviews.llvm.org/D37437.


Repository:
  rC Clang

https://reviews.llvm.org/D41538

Files:
  include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  test/Analysis/malloc.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41538.128002.patch
Type: text/x-patch
Size: 6140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171222/1b44794f/attachment.bin>


More information about the cfe-commits mailing list