[PATCH] D55351: [analyzer] Fix an infinite recursion bug while checking parent methods in RetainCountChecker
George Karpenkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 6 14:09:55 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL348531: [analyzer] Fix an infinite recursion bug while checking parent methods in… (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D55351?vs=176920&id=177042#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55351/new/
https://reviews.llvm.org/D55351
Files:
cfe/trunk/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
cfe/trunk/test/Analysis/osobject-retain-release.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
@@ -730,7 +730,7 @@
if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
for (const auto *OD : MD->overridden_methods()) {
const ParmVarDecl *OP = OD->parameters()[parm_idx];
- if (applyFunctionParamAnnotationEffect(OP, parm_idx, MD, AF, Template))
+ if (applyFunctionParamAnnotationEffect(OP, parm_idx, OD, AF, Template))
return true;
}
}
Index: cfe/trunk/test/Analysis/osobject-retain-release.cpp
===================================================================
--- cfe/trunk/test/Analysis/osobject-retain-release.cpp
+++ cfe/trunk/test/Analysis/osobject-retain-release.cpp
@@ -45,6 +45,8 @@
OSObject *identity() override;
+ virtual OSObject *generateObject(OSObject *input);
+
virtual void consumeReference(OS_CONSUME OSArray *other);
static OSArray *generateArrayHasCode() {
@@ -68,6 +70,8 @@
void consumeReference(OSArray *other) override;
OSObject *identity() override;
+
+ OSObject *generateObject(OSObject *input) override;
};
struct OtherStruct {
@@ -79,6 +83,14 @@
static OSObject *safeMetaCast(const OSObject *inst, const OSMetaClass *meta);
};
+void test_no_infinite_check_recursion(MyArray *arr) {
+ OSObject *input = new OSObject;
+ OSObject *o = arr->generateObject(input);
+ o->release();
+ input->release();
+}
+
+
void check_param_attribute_propagation(MyArray *parent) {
OSArray *arr = new OSArray;
parent->consumeReference(arr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55351.177042.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181206/55ff0d5b/attachment.bin>
More information about the llvm-commits
mailing list