[PATCH] D113592: [analyzer][NFC] Demonstrate the use of CallDescriptionSet
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 19 09:33:16 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9ad0a90baa8c: [analyzer][NFC] Demonstrate the use of CallDescriptionSet (authored by steakhal).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113592/new/
https://reviews.llvm.org/D113592
Files:
clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
Index: clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -534,10 +534,12 @@
namespace {
class CFRetainReleaseChecker : public Checker<check::PreCall> {
mutable APIMisuse BT{this, "null passed to CF memory management function"};
- CallDescription CFRetain{"CFRetain", 1},
- CFRelease{"CFRelease", 1},
- CFMakeCollectable{"CFMakeCollectable", 1},
- CFAutorelease{"CFAutorelease", 1};
+ const CallDescriptionSet ModelledCalls = {
+ {"CFRetain", 1},
+ {"CFRelease", 1},
+ {"CFMakeCollectable", 1},
+ {"CFAutorelease", 1},
+ };
public:
void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
@@ -551,8 +553,7 @@
return;
// Check if we called CFRetain/CFRelease/CFMakeCollectable/CFAutorelease.
-
- if (!matchesAny(Call, CFRetain, CFRelease, CFMakeCollectable, CFAutorelease))
+ if (!ModelledCalls.contains(Call))
return;
// Get the argument's value.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113592.388535.patch
Type: text/x-patch
Size: 1184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211119/29284314/attachment.bin>
More information about the cfe-commits
mailing list