[analyzer] Move out tracking retain count for OSObjects into a separate checker
Allow enabling and disabling tracking of ObjC/CF objects
separately from tracking of OS objects.
Differential Revision: https://reviews.llvm.org/D55400
llvm-svn: 348638
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
index f1ffed5..0f43e8f5 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
@@ -92,7 +92,7 @@
/// See the RefVal::Kind enum for possible values.
unsigned RawKind : 5;
- /// The kind of object being tracked (CF or ObjC), if known.
+ /// The kind of object being tracked (CF or ObjC or OSObject), if known.
///
/// See the RetEffect::ObjKind enum for possible values.
unsigned RawObjectKind : 3;
@@ -268,10 +268,12 @@
mutable bool ShouldResetSummaryLog;
public:
- /// Optional setting to indicate if leak reports should include
- /// the allocation line.
- bool IncludeAllocationLine;
- bool ShouldCheckOSObjectRetainCount;
+
+ /// Track Objective-C and CoreFoundation objects.
+ bool TrackObjCAndCFObjects = false;
+
+ /// Track sublcasses of OSObject.
+ bool TrackOSObjects = false;
RetainCountChecker() : ShouldResetSummaryLog(false) {}
@@ -290,7 +292,7 @@
bool ARCEnabled = (bool)Ctx.getLangOpts().ObjCAutoRefCount;
if (!Summaries) {
Summaries.reset(new RetainSummaryManager(
- Ctx, ARCEnabled, ShouldCheckOSObjectRetainCount));
+ Ctx, ARCEnabled, TrackObjCAndCFObjects, TrackOSObjects));
} else {
assert(Summaries->isARCEnabled() == ARCEnabled);
}