aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2019-01-10 18:15:04 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2019-01-10 18:15:04 +0000
commit3c7cc149a65a6025c4dbc611426cc4c922c2a85d (patch)
tree0766479ea7a143a44600680b0c3d8474831d4202
parent343a38646a56b7167a779489ac5f01875609ef02 (diff)
[analyzer] [RetainCountChecker] [NFC] Another minor cleanup
Differential Revision: https://reviews.llvm.org/D56224 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350863 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/StaticAnalyzer/Core/RetainSummaryManager.h30
-rw-r--r--lib/StaticAnalyzer/Core/RetainSummaryManager.cpp1
2 files changed, 15 insertions, 16 deletions
diff --git a/include/clang/StaticAnalyzer/Core/RetainSummaryManager.h b/include/clang/StaticAnalyzer/Core/RetainSummaryManager.h
index 65648e44d4..04e5d6a0ba 100644
--- a/include/clang/StaticAnalyzer/Core/RetainSummaryManager.h
+++ b/include/clang/StaticAnalyzer/Core/RetainSummaryManager.h
@@ -38,17 +38,20 @@ namespace ento {
/// Determines the object kind of a tracked object.
enum class ObjKind {
- /// Indicates that the tracked object is a CF object. This is
- /// important between GC and non-GC code.
+ /// Indicates that the tracked object is a CF object.
CF,
+
/// Indicates that the tracked object is an Objective-C object.
ObjC,
+
/// Indicates that the tracked object could be a CF or Objective-C object.
AnyObj,
+
/// Indicates that the tracked object is a generalized object.
Generalized,
- /// A descendant of OSObject.
+ /// Indicates that the tracking object is a descendant of a
+ /// referenced-counted OSObject, used in the Darwin kernel.
OS
};
@@ -60,20 +63,17 @@ enum ArgEffectKind {
/// the referenced object.
Autorelease,
- /// The argument is treated as if an -dealloc message had been sent to
- /// the referenced object.
+ /// The argument is treated as if the referenced object was deallocated.
Dealloc,
- /// The argument has its reference count decreased by 1. This is as
- /// if CFRelease has been called on the argument.
+ /// The argument has its reference count decreased by 1.
DecRef,
/// The argument has its reference count decreased by 1 to model
/// a transferred bridge cast under ARC.
DecRefBridgedTransferred,
- /// The argument has its reference count increased by 1. This is as
- /// if CFRetain has been called on the argument.
+ /// The argument has its reference count increased by 1.
IncRef,
/// The argument is a pointer to a retain-counted object; on exit, the new
@@ -139,18 +139,19 @@ public:
/// Indicates that no retain count information is tracked for
/// the return value.
NoRet,
+
/// Indicates that the returned value is an owned (+1) symbol.
OwnedSymbol,
+
/// Indicates that the returned value is an object with retain count
/// semantics but that it is not owned (+0). This is the default
/// for getters, etc.
NotOwnedSymbol,
- /// Indicates that the object is not owned and controlled by the
- /// Garbage collector.
- GCNotOwnedSymbol,
+
/// Indicates that the return value is an owned object when the
/// receiver is also a tracked object.
OwnedWhenTrackedReceiver,
+
// Treat this function as returning a non-tracked symbol even if
// the function has been inlined. This is used where the call
// site summary is more precise than the summary indirectly produced
@@ -158,7 +159,6 @@ public:
NoRetHard
};
-
private:
Kind K;
ObjKind O;
@@ -192,9 +192,6 @@ public:
static RetEffect MakeNotOwned(ObjKind o) {
return RetEffect(NotOwnedSymbol, o);
}
- static RetEffect MakeGCNotOwned() {
- return RetEffect(GCNotOwnedSymbol, ObjKind::ObjC);
- }
static RetEffect MakeNoRet() {
return RetEffect(NoRet);
}
@@ -372,6 +369,7 @@ public:
ArgEffect getReceiverEffect() const { return Receiver; }
/// \return the effect on the "this" receiver of the method call.
+ /// This is only meaningful if the summary applies to CXXMethodDecl*.
ArgEffect getThisEffect() const { return This; }
/// Set the effect of the method on "this".
diff --git a/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp b/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
index a0fe2fefde..d50601f524 100644
--- a/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
+++ b/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
@@ -38,6 +38,7 @@ constexpr static bool isOneOf() {
namespace {
+/// Fake attribute class for RC* attributes.
struct GeneralizedReturnsRetainedAttr {
static bool classof(const Attr *A) {
if (auto AA = dyn_cast<AnnotateAttr>(A))