llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)

<details>
<summary>Changes</summary>

This method is only non-const because it lazily computes the information and 
caches it. This means users of Symbol must otherwise carry around a pointer or 
reference to a mutable Symbol. I would like to minimize the places that need a 
mutable pointer/reference to Symbols if possible.

---
Full diff: https://github.com/llvm/llvm-project/pull/176459.diff


2 Files Affected:

- (modified) lldb/include/lldb/Symbol/Symbol.h (+4-4) 
- (modified) lldb/source/Symbol/Symbol.cpp (+1-1) 


``````````diff
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 1f9d222b6ab29..648703591fc36 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -221,7 +221,7 @@ class Symbol : public SymbolContextScope {
 
   // If m_type is "Code" or "Function" then this will return the prologue size
   // in bytes, else it will return zero.
-  uint32_t GetPrologueByteSize();
+  uint32_t GetPrologueByteSize() const;
 
   bool GetDemangledNameIsSynthesized() const {
     return m_demangled_is_synthesized;
@@ -320,9 +320,9 @@ class Symbol : public SymbolContextScope {
 
   uint32_t m_uid = LLDB_INVALID_SYMBOL_ID; // User ID (usually the original
                                            // symbol table index)
-  uint16_t m_type_data = 0; // data specific to m_type
-  uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has
-                                     // already been calculated
+  mutable uint16_t m_type_data = 0;        // data specific to m_type
+  mutable uint16_t m_type_data_resolved : 1, // True if the data in m_type_data
+                                             // has already been calculated
       m_is_synthetic : 1, // non-zero if this symbol is not actually in the
                           // symbol table, but synthesized from other info in
                           // the object file.
diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index 40497dbccc5c3..45118b49becf4 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -310,7 +310,7 @@ void Symbol::Dump(Stream *s, Target *target, uint32_t index,
   }
 }
 
-uint32_t Symbol::GetPrologueByteSize() {
+uint32_t Symbol::GetPrologueByteSize() const {
   if (m_type == eSymbolTypeCode || m_type == eSymbolTypeResolver) {
     if (!m_type_data_resolved) {
       m_type_data_resolved = true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/176459
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to