From: Ted Kremenek Date: Mon, 18 Apr 2011 22:47:04 +0000 (+0000) Subject: Add SelectorTable::getTotalMemory() to allow clients to query how much memory is... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=97f55d6ffd548d1777d790c84b358030682f9de2;p=clang Add SelectorTable::getTotalMemory() to allow clients to query how much memory is used by selectors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129728 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index d566fbba48..5e5097df15 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/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/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index bbea23ab8d..cb1f55b757 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/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)