[Lldb-commits] [lldb] r106450 - in /lldb/trunk: include/lldb/Core/Address.h include/lldb/Core/AddressRange.h include/lldb/Symbol/Symbol.h source/Core/Address.cpp source/Core/AddressRange.cpp source/Symbol/Symbol.cpp
Greg Clayton
gclayton at apple.com
Mon Jun 21 14:49:04 PDT 2010
Thanks Benjamin,
There should be plenty more of these to go around. A little background to explain why: we used to export all classes that were in lldb_private and gcc (on MacOSX at least) wasn't exporting inlined functions, so we tended to put a lot of the simple accessor functions into the cpp files. Now we only export the lldb::SB* functions so we are free to now inlined as much as we want in the classes in the lldb_private namespace. Feel free to make more similar changes to any classes in the lldb_private namespace, but not in the lldb namespace.
Greg Clayton
On Jun 21, 2010, at 12:26 PM, Benjamin Kramer wrote:
> Author: d0k
> Date: Mon Jun 21 14:26:54 2010
> New Revision: 106450
>
> URL: http://llvm.org/viewvc/llvm-project?rev=106450&view=rev
> Log:
> Move a bunch of trivial methods into the header. These compile down to 1-2
> instructions so it's really profitable to inline them.
>
> Modified:
> lldb/trunk/include/lldb/Core/Address.h
> lldb/trunk/include/lldb/Core/AddressRange.h
> lldb/trunk/include/lldb/Symbol/Symbol.h
> lldb/trunk/source/Core/Address.cpp
> lldb/trunk/source/Core/AddressRange.cpp
> lldb/trunk/source/Symbol/Symbol.cpp
>
> Modified: lldb/trunk/include/lldb/Core/Address.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Core/Address.h (original)
> +++ lldb/trunk/include/lldb/Core/Address.h Mon Jun 21 14:26:54 2010
> @@ -133,11 +133,6 @@
> Address (lldb::addr_t file_addr, const SectionList * section_list);
>
> //------------------------------------------------------------------
> - /// Destructor.
> - //------------------------------------------------------------------
> - ~Address ();
> -
> - //------------------------------------------------------------------
> /// Assignment operator.
> ///
> /// Copies the address value from another Address object \a rhs
> @@ -283,7 +278,7 @@
> /// doesn't contain a valid offset.
> //------------------------------------------------------------------
> lldb::addr_t
> - GetOffset () const;
> + GetOffset () const { return m_offset; }
>
> //------------------------------------------------------------------
> /// Check if an address is section offset.
> @@ -362,7 +357,7 @@
> /// offset in, or NULL if this address is absolute.
> //------------------------------------------------------------------
> const Section*
> - GetSection() const;
> + GetSection() const { return m_section; }
>
> //------------------------------------------------------------------
> /// Set accessor for the offset.
> @@ -385,7 +380,7 @@
> /// any section.
> //------------------------------------------------------------------
> void
> - SetSection (const Section* section);
> + SetSection (const Section* section) { m_section = section; }
>
> //------------------------------------------------------------------
> /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
>
> Modified: lldb/trunk/include/lldb/Core/AddressRange.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/AddressRange.h?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Core/AddressRange.h (original)
> +++ lldb/trunk/include/lldb/Core/AddressRange.h Mon Jun 21 14:26:54 2010
> @@ -227,7 +227,7 @@
> /// A reference to the base address object.
> //------------------------------------------------------------------
> Address &
> - GetBaseAddress();
> + GetBaseAddress() { return m_base_addr; }
>
> //------------------------------------------------------------------
> /// Get const accessor for the base address of the range.
> @@ -236,7 +236,7 @@
> /// A const reference to the base address object.
> //------------------------------------------------------------------
> const Address &
> - GetBaseAddress() const;
> + GetBaseAddress() const { return m_base_addr; }
>
> //------------------------------------------------------------------
> /// Get accessor for the byte size of this range.
> @@ -245,7 +245,7 @@
> /// The size in bytes of this address range.
> //------------------------------------------------------------------
> lldb::addr_t
> - GetByteSize () const;
> + GetByteSize () const { return m_byte_size; }
>
> //------------------------------------------------------------------
> /// Get the memory cost of this object.
> @@ -254,7 +254,11 @@
> /// The number of bytes that this object occupies in memory.
> //------------------------------------------------------------------
> size_t
> - MemorySize () const;
> + MemorySize () const {
> + // Noting special for the memory size of a single AddressRange object,
> + // it is just the size of itself.
> + return sizeof(AddressRange);
> + }
>
> //------------------------------------------------------------------
> /// Set accessor for the byte size of this range.
> @@ -263,7 +267,7 @@
> /// The new size in bytes of this address range.
> //------------------------------------------------------------------
> void
> - SetByteSize (lldb::addr_t byte_size);
> + SetByteSize (lldb::addr_t byte_size) { m_byte_size = byte_size; }
>
> protected:
> //------------------------------------------------------------------
>
> Modified: lldb/trunk/include/lldb/Symbol/Symbol.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Symbol/Symbol.h (original)
> +++ lldb/trunk/include/lldb/Symbol/Symbol.h Mon Jun 21 14:26:54 2010
> @@ -68,88 +68,88 @@
> GetAddressRangePtr () const;
>
> AddressRange &
> - GetAddressRangeRef();
> + GetAddressRangeRef() { return m_addr_range; }
>
> const AddressRange &
> - GetAddressRangeRef() const;
> + GetAddressRangeRef() const { return m_addr_range; }
>
> Mangled&
> - GetMangled ();
> + GetMangled () { return m_mangled; }
>
> const Mangled&
> - GetMangled () const;
> + GetMangled () const { return m_mangled; }
>
> bool
> - GetSizeIsSibling () const;
> + GetSizeIsSibling () const { return m_size_is_sibling; }
>
> bool
> - GetSizeIsSynthesized() const;
> + GetSizeIsSynthesized() const { return m_size_is_synthesized; }
>
> uint32_t
> GetSiblingIndex () const;
>
> uint32_t
> - GetByteSize () const;
> + GetByteSize () const { return m_addr_range.GetByteSize(); }
>
> lldb::SymbolType
> - GetType () const;
> + GetType () const { return m_type; }
>
> void
> - SetType (lldb::SymbolType type);
> + SetType (lldb::SymbolType type) { m_type = type; }
>
> const char *
> GetTypeAsString () const;
>
> uint32_t
> - GetFlags () const;
> + GetFlags () const { return m_flags; }
>
> void
> - SetFlags (uint32_t flags);
> + SetFlags (uint32_t flags) { m_flags = flags; }
>
> Function *
> GetFunction ();
>
> Address &
> - GetValue ();
> + GetValue () { return m_addr_range.GetBaseAddress(); }
>
> const Address &
> - GetValue () const;
> + GetValue () const { return m_addr_range.GetBaseAddress(); }
>
> bool
> - IsSynthetic () const;
> + IsSynthetic () const { return m_is_synthetic; }
>
> void
> - SetIsSynthetic (bool b);
> + SetIsSynthetic (bool b) { m_is_synthetic = b; }
>
> void
> - SetSizeIsSynthesized(bool b);
> + SetSizeIsSynthesized(bool b) { m_size_is_synthesized = b; }
>
> bool
> - IsDebug () const;
> + IsDebug () const { return m_is_debug; }
>
> void
> - SetDebug (bool b);
> + SetDebug (bool b) { m_is_debug = b; }
>
> bool
> - IsExternal () const;
> + IsExternal () const { return m_is_external; }
>
> void
> - SetExternal (bool b);
> + SetExternal (bool b) { m_is_external = b; }
>
> bool
> IsTrampoline () const;
>
> void
> - SetByteSize (uint32_t size);
> + SetByteSize (uint32_t size) { m_addr_range.SetByteSize(size); }
>
> void
> - SetSizeIsSibling (bool b);
> + SetSizeIsSibling (bool b) { m_size_is_sibling = b; }
>
> void
> - SetValue (Address &value);
> + SetValue (Address &value) { m_addr_range.GetBaseAddress() = value; }
>
> void
> - SetValue (const AddressRange &range);
> + SetValue (const AddressRange &range) { m_addr_range = range; }
>
> void
> SetValue (lldb::addr_t value);
>
> Modified: lldb/trunk/source/Core/Address.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/Address.cpp (original)
> +++ lldb/trunk/source/Core/Address.cpp Mon Jun 21 14:26:54 2010
> @@ -247,11 +247,6 @@
> ResolveAddressUsingFileSections(address, sections);
> }
>
> -Address::~Address ()
> -{
> -}
> -
> -
> const Address&
> Address::operator= (const Address& rhs)
> {
> @@ -321,13 +316,6 @@
> return NULL;
> }
>
> -const Section*
> -Address::GetSection () const
> -{
> - return m_section;
> -}
> -
> -
> //addr_t
> //Address::Address() const
> //{
> @@ -381,12 +369,6 @@
> return m_offset;
> }
>
> -addr_t
> -Address::GetOffset () const
> -{
> - return m_offset;
> -}
> -
> bool
> Address::SetOffset (addr_t offset)
> {
> @@ -396,12 +378,6 @@
> }
>
> void
> -Address::SetSection (const Section* section)
> -{
> - m_section = section;
> -}
> -
> -void
> Address::Clear()
> {
> m_section = NULL;
>
> Modified: lldb/trunk/source/Core/AddressRange.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressRange.cpp?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/AddressRange.cpp (original)
> +++ lldb/trunk/source/Core/AddressRange.cpp Mon Jun 21 14:26:54 2010
> @@ -42,30 +42,6 @@
> {
> }
>
> -Address &
> -AddressRange::GetBaseAddress()
> -{
> - return m_base_addr;
> -}
> -
> -const Address &
> -AddressRange::GetBaseAddress() const
> -{
> - return m_base_addr;
> -}
> -
> -addr_t
> -AddressRange::GetByteSize() const
> -{
> - return m_byte_size;
> -}
> -
> -void
> -AddressRange::SetByteSize(addr_t byte_size)
> -{
> - m_byte_size = byte_size;
> -}
> -
> //bool
> //AddressRange::Contains (const Address &addr) const
> //{
> @@ -204,14 +180,6 @@
> {
> s->Printf("%.*p: AddressRange section = %*p, offset = 0x%16.16llx, byte_size = 0x%16.16llx\n", (int)sizeof(void*) * 2, this, (int)sizeof(void*) * 2, m_base_addr.GetSection(), m_base_addr.GetOffset(), GetByteSize());
> }
> -
> -size_t
> -AddressRange::MemorySize () const
> -{
> - // Noting special for the memory size of a single AddressRange object,
> - // it is just the size of itself.
> - return sizeof(AddressRange);
> -}
> //
> //bool
> //lldb::operator== (const AddressRange& lhs, const AddressRange& rhs)
>
> Modified: lldb/trunk/source/Symbol/Symbol.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=106450&r1=106449&r2=106450&view=diff
> ==============================================================================
> --- lldb/trunk/source/Symbol/Symbol.cpp (original)
> +++ lldb/trunk/source/Symbol/Symbol.cpp Mon Jun 21 14:26:54 2010
> @@ -139,18 +139,6 @@
> return *this;
> }
>
> -AddressRange &
> -Symbol::GetAddressRangeRef()
> -{
> - return m_addr_range;
> -}
> -
> -const AddressRange &
> -Symbol::GetAddressRangeRef() const
> -{
> - return m_addr_range;
> -}
> -
> AddressRange *
> Symbol::GetAddressRangePtr()
> {
> @@ -167,115 +155,18 @@
> return NULL;
> }
>
> -bool
> -Symbol::GetSizeIsSibling() const
> -{
> - return m_size_is_sibling;
> -}
> -
> -bool
> -Symbol::GetSizeIsSynthesized() const
> -{
> - return m_size_is_synthesized;
> -}
> -
> uint32_t
> Symbol::GetSiblingIndex() const
> {
> return m_size_is_sibling ? m_addr_range.GetByteSize() : 0;
> }
>
> -uint32_t
> -Symbol::GetFlags() const
> -{
> - return m_flags;
> -}
> -
> -void
> -Symbol::SetFlags (uint32_t flags)
> -{
> - m_flags = flags;
> -}
> -
> -SymbolType
> -Symbol::GetType() const
> -{
> - return m_type;
> -}
> -
> -void
> -Symbol::SetType(SymbolType type)
> -{
> - m_type = type;
> -}
> -
> -bool
> -Symbol::IsSynthetic () const
> -{
> - return m_is_synthetic;
> -}
> -
> -void
> -Symbol::SetIsSynthetic (bool b)
> -{
> - m_is_synthetic = b;
> -}
> -
> -void
> -Symbol::SetSizeIsSynthesized(bool b)
> -{
> - m_size_is_synthesized = b;
> -}
> -
> -
> -bool
> -Symbol::IsDebug() const
> -{
> - return m_is_debug;
> -}
> -
> -void
> -Symbol::SetDebug (bool b)
> -{
> - m_is_debug = b;
> -}
> -
> -bool
> -Symbol::IsExternal() const
> -{
> - return m_is_external;
> -}
> -
> -void
> -Symbol::SetExternal(bool b)
> -{
> - m_is_external = b;
> -}
> -
> bool
> Symbol::IsTrampoline () const
> {
> return m_type == eSymbolTypeTrampoline;
> }
>
> -uint32_t
> -Symbol::GetByteSize() const
> -{
> - return m_addr_range.GetByteSize();
> -}
> -
> -void
> -Symbol::SetByteSize (uint32_t size)
> -{
> - m_addr_range.SetByteSize(size);
> -}
> -
> -void
> -Symbol::SetSizeIsSibling (bool b)
> -{
> - m_size_is_sibling = b;
> -}
> -
> void
> Symbol::Dump(Stream *s, Process *process, uint32_t index) const
> {
> @@ -322,36 +213,6 @@
> }
> }
>
> -const Mangled&
> -Symbol::GetMangled() const
> -{
> - return m_mangled;
> -}
> -
> -Mangled&
> -Symbol::GetMangled()
> -{
> - return m_mangled;
> -}
> -
> -Address &
> -Symbol::GetValue()
> -{
> - return m_addr_range.GetBaseAddress();
> -}
> -
> -const Address &
> -Symbol::GetValue() const
> -{
> - return m_addr_range.GetBaseAddress();
> -}
> -
> -void
> -Symbol::SetValue (Address &value)
> -{
> - m_addr_range.GetBaseAddress() = value;
> -}
> -
> Function *
> Symbol::GetFunction ()
> {
> @@ -397,13 +258,6 @@
> }
>
> void
> -Symbol::SetValue (const AddressRange &range)
> -{
> - m_addr_range = range;
> -}
> -
> -
> -void
> Symbol::SetValue(addr_t value)
> {
> m_addr_range.GetBaseAddress().SetSection(NULL);
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list