From 1c2239e9b165aa1d7cfe51f8a1a8522644de0822 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 18 Apr 2011 22:47:04 +0000 Subject: [PATCH] Add SelectorTable::getTotalMemory() to allow clients to query how much memory is used by selectors. llvm-svn: 129728 --- clang/include/clang/Basic/IdentifierTable.h | 3 +++ clang/lib/Basic/IdentifierTable.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index d566fbba48c3..5e5097df155e 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -624,6 +624,9 @@ public: return Selector(ID, 0); } + /// Return the total amount of memory allocated for managing selectors. + size_t getTotalMemory() const; + /// constructSetterName - Return the setter name for the given /// identifier, i.e. "set" + Name where the initial character of Name /// has been capitalized. diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index bbea23ab8da7..cb1f55b75773 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -433,6 +433,10 @@ static SelectorTableImpl &getSelectorTableImpl(void *P) { return *static_cast(P); } +size_t SelectorTable::getTotalMemory() const { + SelectorTableImpl &SelTabImpl = getSelectorTableImpl(Impl); + return SelTabImpl.Allocator.getTotalMemory(); +} Selector SelectorTable::getSelector(unsigned nKeys, IdentifierInfo **IIV) { if (nKeys < 2)