[PATCH] D67381: [analyzer] NFC: Move stack hints to a side map.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 16:39:41 PDT 2019


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, rnkovacs, Szelethus, baloghadamsoftware, Charusso.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet.
Herald added a project: clang.

Stack hints are attached to `PathDiagnosticEventPiece`s in order to improve path notes at the call site for the call in which the event has occured. For example, they are currently used only by MallocChecker in order to produce the fancy "Returning allocated memory"/"Returning; memory was released" note. By the way, in fact nobody else currently uses this functionality - only MallocChecker.

I want to make the `PathDiagnostic` interface completely ignorant of Static Analyzer specific concepts such as `ExplodedNode` or `SymbolRef`, so i moved this interface to `BugReporter`. Stack hints are now owned by the `PathSensitiveBugReport` object against which the visitor emits event pieces for which it needs stack hints.

I'm open to discuss a better design here. Eg., i thought about making it part of the visitor interface instead, but i don't immediately see how to do this without breaking the logic of "only add the note at the call site in which the event has happened, not every time allocated memory is returned from anywhere".


Repository:
  rC Clang

https://reviews.llvm.org/D67381

Files:
  clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
  clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  clang/lib/StaticAnalyzer/Core/BugReporter.cpp
  clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67381.219451.patch
Type: text/x-patch
Size: 23321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190909/7cef05de/attachment-0001.bin>


More information about the cfe-commits mailing list