[PATCH] D67382: [analyzer] NFC: Move getStmt() and createEndOfPath() out of PathDiagnostic.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 9 16:53:49 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, zzheng, szepet, kristof.beyls.
Herald added a project: clang.
These static functions deal with `ExplodedNode`s which is something i don't want the `PathDiagnostic` interface to know anything about, as it's planned to be moved out of `libStaticAnalyzer`.
`PathDiagnosticLocation::getStmt(N)`, a function commonly used in bug visitors, is now known as `ExplodedNode::getStmtForDiagnostics()`. Because it contains a hack that allows it to avoid body-farmed locations, it should only be used for diagnostics and is useless for most other purposes, hence the name. I added a few FIXMEs in places where this may be already causing problems. `PathDiagnosticLocation::getNextStmt(N)` and a couple of helper functions from `BugReporter.cpp` now live nearby.
`PathDiagnosticLocation::createEndOfPath(N)` has a similar purpose but is more sophisticated and is used mostly by end-of-path visitors. I removed this function entirely in favor of using `PathSensitiveBugReport::getLocation()` instead, which is literally the same thing as long as `N` is the bug node, which is always true. This creates a certain problem in `RetainCountChecker` (surprise!!~) because it has its own `PathSensitiveBugReport` sub-class that overrides `getLocation()` to not be equal to end of path, but still needs to obtain the end-of-path location in the visitor. I worked around that by giving it a separate method.
Repository:
rC Clang
https://reviews.llvm.org/D67382
Files:
clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.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/MacOSKeychainAPIChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
clang/lib/StaticAnalyzer/Checkers/Taint.cpp
clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporter.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67382.219455.patch
Type: text/x-patch
Size: 30655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190909/0e83fed8/attachment-0001.bin>
More information about the cfe-commits
mailing list