From 3f912adeae348cf230795c2c9d83165e7d854d43 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 19 Feb 2011 01:59:21 +0000 Subject: [PATCH] Add ImmutableMap methods 'manualRetain()', 'manualRelease()', and 'getRootWithoutRetain()' to help more aggressively reclaim memory in the static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126011 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ImmutableMap.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h index 7a517b43f8c..e439a099482 100644 --- a/include/llvm/ADT/ImmutableMap.h +++ b/include/llvm/ADT/ImmutableMap.h @@ -134,11 +134,23 @@ public: return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root; } - TreeTy* getRoot() const { + TreeTy *getRoot() const { if (Root) { Root->retain(); } return Root; } + TreeTy *getRootWithoutRetain() const { + return Root; + } + + void manualRetain() { + if (Root) Root->retain(); + } + + void manualRelease() { + if (Root) Root->release(); + } + bool isEmpty() const { return !Root; } //===--------------------------------------------------===// -- 2.34.1