[lldb-dev] [PATCH] Fix compile warnings about casting away const

Steve Pucci spucci at google.com
Fri Jan 17 08:18:44 PST 2014


This is the third piece of the separation of the previously submitted
patch.  This is just fixing constness in several places.

Compiled and passed lldb tests on Linux Ubuntu 12.04 and gcc 4.8.2.

Thanks,
  Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140117/31a1bb25/attachment.html>
-------------- next part --------------
diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h
index 80d249d..4b77ff1 100644
--- a/include/lldb/Core/MappedHash.h
+++ b/include/lldb/Core/MappedHash.h
@@ -382,9 +382,9 @@ public:
             lldb::offset_t offset = m_header.Read (data, 0);
             if (offset != LLDB_INVALID_OFFSET && IsValid ())
             {
-                m_hash_indexes = (uint32_t *)data.GetData (&offset, m_header.bucket_count * sizeof(uint32_t));
-                m_hash_values  = (uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
-                m_hash_offsets = (uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
+                m_hash_indexes = (const uint32_t *)data.GetData (&offset, m_header.bucket_count * sizeof(uint32_t));
+                m_hash_values  = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
+                m_hash_offsets = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
             }
         }
         
@@ -542,9 +542,9 @@ public:
     protected:
         // Implementation agnostic information
         HeaderType m_header;
-        uint32_t *m_hash_indexes;
-        uint32_t *m_hash_values;
-        uint32_t *m_hash_offsets;
+        const uint32_t *m_hash_indexes;
+        const uint32_t *m_hash_values;
+        const uint32_t *m_hash_offsets;
     };
     
 };
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
index fce995e..d6c580c 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -53,7 +53,7 @@ public:
     bool                ExtractValue(const lldb_private::DWARFDataExtractor& data,
                                      lldb::offset_t* offset_ptr,
                                      const DWARFCompileUnit* cu);
-    bool                IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (uint8_t*)m_value.value.cstr; }
+    bool                IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (const uint8_t*)m_value.value.cstr; }
     const uint8_t*      BlockData() const;
     uint64_t            Reference(const DWARFCompileUnit* cu) const;
     uint64_t            Reference (dw_offset_t offset) const;


More information about the lldb-dev mailing list