[Lldb-commits] [lldb] cbd0822 - [lldb] Remove ConstString::StaticMemorySize
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 26 09:16:06 PST 2022
Author: Jonas Devlieghere
Date: 2022-01-26T09:13:46-08:00
New Revision: cbd0822f2730e2b0d5f1c44b645609fe9554f58e
URL: https://github.com/llvm/llvm-project/commit/cbd0822f2730e2b0d5f1c44b645609fe9554f58e
DIFF: https://github.com/llvm/llvm-project/commit/cbd0822f2730e2b0d5f1c44b645609fe9554f58e.diff
LOG: [lldb] Remove ConstString::StaticMemorySize
Remove ConstString::StaticMemorySize as it is unused and superseded by
GetMemoryStats. It is referenced in a bunch of doc comments but I don't
really understand why. My best guess it that the comments were
copy-pasted from ConstString::MemorySize() even though it didn't make
sense there either. The implementation of StaticMemorySize was being
called on the MemoryPool, not on the ConstString itself.
Differential revision: https://reviews.llvm.org/D118091
Added:
Modified:
lldb/include/lldb/Core/Declaration.h
lldb/include/lldb/Core/FileSpecList.h
lldb/include/lldb/Core/Mangled.h
lldb/include/lldb/Symbol/Function.h
lldb/include/lldb/Utility/ConstString.h
lldb/include/lldb/Utility/FileSpec.h
lldb/source/Utility/ConstString.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Declaration.h b/lldb/include/lldb/Core/Declaration.h
index 67ab09f21c8d..6ae21eb65eb3 100644
--- a/lldb/include/lldb/Core/Declaration.h
+++ b/lldb/include/lldb/Core/Declaration.h
@@ -152,8 +152,6 @@ class Declaration {
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
/// Set accessor for the declaration file specification.
diff --git a/lldb/include/lldb/Core/FileSpecList.h b/lldb/include/lldb/Core/FileSpecList.h
index cab8e9b9b43f..117c6b691498 100644
--- a/lldb/include/lldb/Core/FileSpecList.h
+++ b/lldb/include/lldb/Core/FileSpecList.h
@@ -152,8 +152,6 @@ class FileSpecList {
///
/// \return
/// The number of bytes that this object occupies in memory.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
bool IsEmpty() const { return m_files.empty(); }
diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h
index 35705b0319ab..4e4f75e18e34 100644
--- a/lldb/include/lldb/Core/Mangled.h
+++ b/lldb/include/lldb/Core/Mangled.h
@@ -183,8 +183,6 @@ class Mangled {
///
/// \return
/// The number of bytes that this object occupies in memory.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
/// Set the string value in this object.
diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h
index b703617773ff..83f9979c3c52 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -110,8 +110,6 @@ class FunctionInfo {
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
- ///
- /// \see ConstString::StaticMemorySize ()
virtual size_t MemorySize() const;
protected:
@@ -238,8 +236,6 @@ class InlineFunctionInfo : public FunctionInfo {
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const override;
private:
@@ -595,8 +591,6 @@ class Function : public UserID, public SymbolContextScope {
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
/// Get whether compiler optimizations were enabled for this function
diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h
index 937f8271a9a8..31887d7f6115 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -394,20 +394,8 @@ class ConstString {
///
/// \return
/// The number of bytes that this object occupies in memory.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const { return sizeof(ConstString); }
- /// Get the size in bytes of the current global string pool.
- ///
- /// Reports the size in bytes of all shared C string values, containers and
- /// any other values as a byte size for the entire string pool.
- ///
- /// \return
- /// The number of bytes that the global string pool occupies
- /// in memory.
- static size_t StaticMemorySize();
-
struct MemoryStats {
size_t GetBytesTotal() const { return bytes_total; }
size_t GetBytesUsed() const { return bytes_used; }
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index 305cd04f95c0..ec473a2afeec 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -334,8 +334,6 @@ class FileSpec {
///
/// \return
/// The number of bytes that this object occupies in memory.
- ///
- /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
/// Change the file specified with a new path.
diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp
index 76270e3f53b9..142c335ddbbe 100644
--- a/lldb/source/Utility/ConstString.cpp
+++ b/lldb/source/Utility/ConstString.cpp
@@ -159,18 +159,6 @@ class Pool {
return nullptr;
}
- // Return the size in bytes that this object and any items in its collection
- // of uniqued strings + data count values takes in memory.
- size_t MemorySize() const {
- size_t mem_size = sizeof(Pool);
- for (const auto &pool : m_string_pools) {
- llvm::sys::SmartScopedReader<false> rlock(pool.m_mutex);
- for (const auto &entry : pool.m_string_map)
- mem_size += sizeof(StringPoolEntryType) + entry.getKey().size();
- }
- return mem_size;
- }
-
ConstString::MemoryStats GetMemoryStats() const {
ConstString::MemoryStats stats;
for (const auto &pool : m_string_pools) {
@@ -338,11 +326,6 @@ void ConstString::SetTrimmedCStringWithLength(const char *cstr,
m_string = StringPool().GetConstTrimmedCStringWithLength(cstr, cstr_len);
}
-size_t ConstString::StaticMemorySize() {
- // Get the size of the static string pool
- return StringPool().MemorySize();
-}
-
ConstString::MemoryStats ConstString::GetMemoryStats() {
return StringPool().GetMemoryStats();
}
More information about the lldb-commits
mailing list