[Lldb-commits] [lldb] r251470 - Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Core; other minor fixes.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 27 17:18:42 PDT 2015
Author: eugenezelenko
Date: Tue Oct 27 19:18:41 2015
New Revision: 251470
URL: http://llvm.org/viewvc/llvm-project?rev=251470&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Core; other minor fixes.
Modified:
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/AddressRange.h
lldb/trunk/include/lldb/Core/Broadcaster.h
lldb/trunk/include/lldb/Core/Communication.h
lldb/trunk/include/lldb/Core/ConstString.h
lldb/trunk/include/lldb/Core/DataExtractor.h
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Core/Event.h
lldb/trunk/include/lldb/Core/FormatEntity.h
lldb/trunk/include/lldb/Core/IOHandler.h
lldb/trunk/include/lldb/Core/Listener.h
lldb/trunk/include/lldb/Core/MappedHash.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/ModuleList.h
Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Tue Oct 27 19:18:41 2015
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <atomic>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -108,7 +109,6 @@ public:
{
}
-
//------------------------------------------------------------------
/// Copy constructor
///
@@ -176,6 +176,7 @@ public:
const Address&
operator= (const Address& rhs);
#endif
+
//------------------------------------------------------------------
/// Clear the object's state.
///
@@ -216,7 +217,7 @@ public:
class ModulePointerAndOffsetLessThanFunctionObject
{
public:
- ModulePointerAndOffsetLessThanFunctionObject () {}
+ ModulePointerAndOffsetLessThanFunctionObject() = default;
bool
operator() (const Address& a, const Address& b) const
@@ -355,7 +356,7 @@ public:
bool
IsSectionOffset() const
{
- return IsValid() && (GetSection().get() != NULL);
+ return IsValid() && (GetSection().get() != nullptr);
}
//------------------------------------------------------------------
@@ -375,7 +376,6 @@ public:
return m_offset != LLDB_INVALID_ADDRESS;
}
-
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
@@ -508,6 +508,7 @@ public:
{
m_section_wp.reset();
}
+
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
@@ -567,10 +568,8 @@ protected:
//------------------------------------------------------------------
bool
SectionWasDeletedPrivate() const;
-
};
-
//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two
@@ -587,12 +586,9 @@ protected:
//----------------------------------------------------------------------
bool operator< (const Address& lhs, const Address& rhs);
bool operator> (const Address& lhs, const Address& rhs);
-
-
-
bool operator== (const Address& lhs, const Address& rhs);
bool operator!= (const Address& lhs, const Address& rhs);
} // namespace lldb_private
-#endif // liblldb_Address_h_
+#endif // liblldb_Address_h_
Modified: lldb/trunk/include/lldb/Core/AddressRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/AddressRange.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/AddressRange.h (original)
+++ lldb/trunk/include/lldb/Core/AddressRange.h Tue Oct 27 19:18:41 2015
@@ -10,6 +10,10 @@
#ifndef liblldb_AddressRange_h_
#define liblldb_AddressRange_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/Address.h"
namespace lldb_private {
@@ -62,7 +66,7 @@ public:
/// @param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
//------------------------------------------------------------------
- AddressRange (lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list = NULL);
+ AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list = nullptr);
//------------------------------------------------------------------
/// Construct with a Address object address and byte size.
@@ -281,4 +285,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_AddressRange_h_
+#endif // liblldb_AddressRange_h_
Modified: lldb/trunk/include/lldb/Core/Broadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Broadcaster.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Broadcaster.h (original)
+++ lldb/trunk/include/lldb/Core/Broadcaster.h Tue Oct 27 19:18:41 2015
@@ -42,7 +42,7 @@ public:
BroadcastEventSpec (const BroadcastEventSpec &rhs);
- ~BroadcastEventSpec() {}
+ ~BroadcastEventSpec() = default;
const ConstString &GetBroadcasterClass() const
{
@@ -89,7 +89,7 @@ public:
BroadcasterManager ();
- ~BroadcasterManager () {}
+ ~BroadcasterManager() = default;
uint32_t
RegisterListenerForEvents (Listener &listener, BroadcastEventSpec event_spec);
@@ -128,7 +128,7 @@ private:
{
}
- ~BroadcasterClassMatches () {}
+ ~BroadcasterClassMatches() = default;
bool operator() (const event_listener_key input) const
{
@@ -147,7 +147,7 @@ private:
{
}
- ~BroadcastEventSpecMatches () {}
+ ~BroadcastEventSpecMatches() = default;
bool operator() (const event_listener_key input) const
{
@@ -168,7 +168,7 @@ private:
{
}
- ~ListenerMatchesAndSharedBits () {}
+ ~ListenerMatchesAndSharedBits() = default;
bool operator() (const event_listener_key input) const
{
@@ -190,7 +190,7 @@ private:
{
}
- ~ListenerMatches() {}
+ ~ListenerMatches() = default;
bool operator () (const event_listener_key input) const
{
@@ -204,7 +204,6 @@ private:
const Listener *m_listener;
};
-
};
//----------------------------------------------------------------------
@@ -286,10 +285,10 @@ public:
BroadcastEventIfUnique (lldb::EventSP &event_sp);
void
- BroadcastEvent (uint32_t event_type, EventData *event_data = NULL);
+ BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr);
void
- BroadcastEventIfUnique (uint32_t event_type, EventData *event_data = NULL);
+ BroadcastEventIfUnique(uint32_t event_type, EventData *event_data = nullptr);
void
Clear();
@@ -332,7 +331,6 @@ public:
const ConstString &
GetBroadcasterName ();
-
//------------------------------------------------------------------
/// Get the event name(s) for one or more event bits.
///
@@ -364,10 +362,10 @@ public:
const char *
GetEventName (uint32_t event_mask) const
{
- event_names_map::const_iterator pos = m_event_names.find (event_mask);
+ const auto pos = m_event_names.find (event_mask);
if (pos != m_event_names.end())
return pos->second.c_str();
- return NULL;
+ return nullptr;
}
bool
@@ -437,8 +435,6 @@ public:
BroadcasterManager *GetManager();
protected:
-
-
void
PrivateBroadcastEvent (lldb::EventSP &event_sp, bool unique);
Modified: lldb/trunk/include/lldb/Core/Communication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Communication.h (original)
+++ lldb/trunk/include/lldb/Core/Communication.h Tue Oct 27 19:18:41 2015
@@ -155,7 +155,7 @@ public:
/// @see bool Connection::Disconnect ();
//------------------------------------------------------------------
lldb::ConnectionStatus
- Disconnect (Error *error_ptr = NULL);
+ Disconnect(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Check if the connection is valid.
@@ -277,7 +277,7 @@ public:
/// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
//------------------------------------------------------------------
virtual bool
- StartReadThread (Error *error_ptr = NULL);
+ StartReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Stops the read thread by cancelling it.
@@ -287,10 +287,10 @@ public:
/// false otherwise.
//------------------------------------------------------------------
virtual bool
- StopReadThread (Error *error_ptr = NULL);
+ StopReadThread(Error *error_ptr = nullptr);
virtual bool
- JoinReadThread (Error *error_ptr = NULL);
+ JoinReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
@@ -322,7 +322,6 @@ public:
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
-
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
@@ -354,12 +353,6 @@ public:
return GetStaticBroadcasterClass();
}
-private:
- //------------------------------------------------------------------
- // For Communication only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (Communication);
-
protected:
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
@@ -423,6 +416,9 @@ protected:
//------------------------------------------------------------------
size_t
GetCachedBytes (void *dst, size_t dst_len);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN (Communication);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Core/ConstString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConstString.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConstString.h (original)
+++ lldb/trunk/include/lldb/Core/ConstString.h Tue Oct 27 19:18:41 2015
@@ -9,13 +9,14 @@
#ifndef liblldb_ConstString_h_
#define liblldb_ConstString_h_
-#if defined(__cplusplus)
-#include <assert.h>
-
-#include "lldb/lldb-private.h"
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
+// Project includes
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -41,12 +42,11 @@ public:
///
/// Initializes the string to an empty string.
//------------------------------------------------------------------
- ConstString ():
- m_string (NULL)
+ ConstString():
+ m_string(nullptr)
{
}
-
//------------------------------------------------------------------
/// Copy constructor
///
@@ -105,10 +105,7 @@ public:
/// Since constant string values are currently not reference counted,
/// there isn't much to do here.
//------------------------------------------------------------------
- ~ConstString ()
- {
- }
-
+ ~ConstString() = default;
//----------------------------------------------------------------------
/// C string equality binary predicate function object for ConstString
@@ -224,18 +221,16 @@ public:
/// Get the value of the contained string as a NULL terminated C
/// string value.
///
- /// If \a value_if_empty is NULL, then NULL will be returned.
+ /// If \a value_if_empty is nullptr, then nullptr will be returned.
///
/// @return
/// Returns \a value_if_empty if the string is empty, otherwise
/// the C string value contained in this object.
//------------------------------------------------------------------
const char *
- AsCString(const char *value_if_empty = NULL) const
+ AsCString(const char *value_if_empty = nullptr) const
{
- if (IsEmpty())
- return value_if_empty;
- return m_string;
+ return (IsEmpty() ? value_if_empty : m_string);
}
//------------------------------------------------------------------
@@ -256,12 +251,12 @@ public:
///
/// Get the value of the contained string as a NULL terminated C
/// string value. Similar to the ConstString::AsCString() function,
- /// yet this function will always return NULL if the string is not
+ /// yet this function will always return nullptr if the string is not
/// valid. So this function is a direct accessor to the string
/// pointer value.
///
/// @return
- /// Returns NULL the string is invalid, otherwise the C string
+ /// Returns nullptr the string is invalid, otherwise the C string
/// value contained in this object.
//------------------------------------------------------------------
const char *
@@ -270,7 +265,6 @@ public:
return m_string;
}
-
//------------------------------------------------------------------
/// Get the length in bytes of string value.
///
@@ -293,7 +287,7 @@ public:
void
Clear ()
{
- m_string = NULL;
+ m_string = nullptr;
}
//------------------------------------------------------------------
@@ -326,18 +320,18 @@ public:
///
/// Dump the string value to the stream \a s. If the contained string
/// is empty, print \a value_if_empty to the stream instead. If
- /// \a value_if_empty is NULL, then nothing will be dumped to the
+ /// \a value_if_empty is nullptr, then nothing will be dumped to the
/// stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
///
/// @param[in] value_if_empty
- /// The value to dump if the string is empty. If NULL, nothing
+ /// The value to dump if the string is empty. If nullptr, nothing
/// will be output to the stream.
//------------------------------------------------------------------
void
- Dump (Stream *s, const char *value_if_empty = NULL) const;
+ Dump(Stream *s, const char *value_if_empty = nullptr) const;
//------------------------------------------------------------------
/// Dump the object debug description to a stream.
@@ -358,7 +352,7 @@ public:
bool
IsEmpty () const
{
- return m_string == NULL || m_string[0] == '\0';
+ return m_string == nullptr || m_string[0] == '\0';
}
//------------------------------------------------------------------
@@ -473,7 +467,6 @@ public:
{
return sizeof(ConstString);
}
-
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
@@ -503,5 +496,4 @@ Stream& operator << (Stream& s, const Co
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_ConstString_h_
+#endif // liblldb_ConstString_h_
Modified: lldb/trunk/include/lldb/Core/DataExtractor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataExtractor.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/DataExtractor.h (original)
+++ lldb/trunk/include/lldb/Core/DataExtractor.h Tue Oct 27 19:18:41 2015
@@ -9,17 +9,18 @@
#ifndef liblldb_DataExtractor_h_
#define liblldb_DataExtractor_h_
-#if defined (__cplusplus)
-
-
-#include "lldb/lldb-private.h"
-
-#include "llvm/ADT/SmallVector.h"
+// C Includes
#include <limits.h>
#include <stdint.h>
#include <string.h>
-#include <vector>
+
+// C++ Includes
+// Other libraries and framework includes
+#include "llvm/ADT/SmallVector.h"
+
+// Project includes
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -64,6 +65,7 @@ public:
size_t src_len,
uint32_t bytes_per_line,
lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS to not show address at start of line
+
//------------------------------------------------------------------
/// Default constructor.
///
@@ -146,6 +148,7 @@ public:
DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size = 1);
DataExtractor (const DataExtractor& rhs);
+
//------------------------------------------------------------------
/// Assignment operator.
///
@@ -183,14 +186,14 @@ public:
//------------------------------------------------------------------
/// Dumps the binary data as \a type objects to stream \a s (or to
- /// Log() if \a s is NULL) starting \a offset bytes into the data
+ /// Log() if \a s is nullptr) starting \a offset bytes into the data
/// and stopping after dumping \a length bytes. The offset into the
/// data is displayed at the beginning of each line and can be
/// offset by base address \a base_addr. \a num_per_line objects
/// will be displayed on each line.
///
/// @param[in] s
- /// The stream to dump the output to. If NULL the output will
+ /// The stream to dump the output to. If nullptr the output will
/// be dumped to Log().
///
/// @param[in] offset
@@ -212,19 +215,19 @@ public:
///
/// @param[in] type_format
/// The optional format to use for the \a type objects. If this
- /// is NULL, the default format for the \a type will be used.
+ /// is nullptr, the default format for the \a type will be used.
///
/// @return
/// The offset at which dumping ended.
//------------------------------------------------------------------
lldb::offset_t
- PutToLog (Log *log,
- lldb::offset_t offset,
- lldb::offset_t length,
- uint64_t base_addr,
- uint32_t num_per_line,
- Type type,
- const char *type_format = NULL) const;
+ PutToLog(Log *log,
+ lldb::offset_t offset,
+ lldb::offset_t length,
+ uint64_t base_addr,
+ uint32_t num_per_line,
+ Type type,
+ const char *type_format = nullptr) const;
//------------------------------------------------------------------
/// Dumps \a item_count objects into the stream \a s.
@@ -241,7 +244,7 @@ public:
/// item_bit_size and \a item_bit_offset values.
///
/// @param[in] s
- /// The stream to dump the output to. This value can not be NULL.
+ /// The stream to dump the output to. This value can not be nullptr.
///
/// @param[in] offset
/// The offset into the data at which to start dumping.
@@ -287,25 +290,25 @@ public:
/// The offset at which dumping ended.
//------------------------------------------------------------------
lldb::offset_t
- Dump (Stream *s,
- lldb::offset_t offset,
- lldb::Format item_format,
- size_t item_byte_size,
- size_t item_count,
- size_t num_per_line,
- uint64_t base_addr,
- uint32_t item_bit_size,
- uint32_t item_bit_offset,
- ExecutionContextScope *exe_scope = NULL) const;
+ Dump(Stream *s,
+ lldb::offset_t offset,
+ lldb::Format item_format,
+ size_t item_byte_size,
+ size_t item_count,
+ size_t num_per_line,
+ uint64_t base_addr,
+ uint32_t item_bit_size,
+ uint32_t item_bit_offset,
+ ExecutionContextScope *exe_scope = nullptr) const;
//------------------------------------------------------------------
/// Dump a UUID value at \a offset.
///
/// Dump a UUID starting at \a offset bytes into this object's data.
- /// If the stream \a s is NULL, the output will be sent to Log().
+ /// If the stream \a s is nullptr, the output will be sent to Log().
///
/// @param[in] s
- /// The stream to dump the output to. If NULL the output will
+ /// The stream to dump the output to. If nullptr the output will
/// be dumped to Log().
///
/// @param[in] offset
@@ -418,7 +421,7 @@ public:
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the C string is out of bounds,
- /// NULL will be returned.
+ /// nullptr will be returned.
//------------------------------------------------------------------
const char *
GetCStr (lldb::offset_t *offset_ptr) const;
@@ -443,7 +446,7 @@ public:
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the field is out of bounds, or if
- /// the field does not contain a NULL terminator byte, NULL will
+ /// the field does not contain a NULL terminator byte, nullptr will
/// be returned.
const char *
GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const;
@@ -454,7 +457,7 @@ public:
/// Returns a pointer to a bytes in this object's data at the offset
/// pointed to by \a offset_ptr. If \a length is zero or too large,
/// then the offset pointed to by \a offset_ptr will not be updated
- /// and NULL will be returned.
+ /// and nullptr will be returned.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -469,7 +472,7 @@ public:
///
/// @return
/// A pointer to the bytes in this object's data if the offset
- /// and length are valid, or NULL otherwise.
+ /// and length are valid, or nullptr otherwise.
//------------------------------------------------------------------
const void*
GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const
@@ -552,7 +555,7 @@ public:
///
/// @return
/// Returns a pointer to the next byte contained in this
- /// object's data, or NULL of there is no data in this object.
+ /// object's data, or nullptr of there is no data in this object.
//------------------------------------------------------------------
const uint8_t *
GetDataEnd () const
@@ -578,7 +581,7 @@ public:
///
/// @return
/// Returns a pointer to the first byte contained in this
- /// object's data, or NULL of there is no data in this object.
+ /// object's data, or nullptr of there is no data in this object.
//------------------------------------------------------------------
const uint8_t *
GetDataStart () const
@@ -586,7 +589,6 @@ public:
return m_start;
}
-
//------------------------------------------------------------------
/// Extract a float from \a *offset_ptr.
///
@@ -908,7 +910,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -955,7 +957,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1002,7 +1004,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1049,7 +1051,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1113,8 +1115,8 @@ public:
/// An offset into the data.
///
/// @return
- /// A non-NULL C string pointer if \a offset is a valid offset,
- /// NULL otherwise.
+ /// A non-nullptr C string pointer if \a offset is a valid offset,
+ /// nullptr otherwise.
//------------------------------------------------------------------
const char *
PeekCStr (lldb::offset_t offset) const;
@@ -1126,8 +1128,8 @@ public:
/// there are \a length bytes available starting at \a offset.
///
/// @return
- /// A non-NULL data pointer if \a offset is a valid offset and
- /// there are \a length bytes available at that offset, NULL
+ /// A non-nullptr data pointer if \a offset is a valid offset and
+ /// there are \a length bytes available at that offset, nullptr
/// otherwise.
//------------------------------------------------------------------
const uint8_t*
@@ -1135,7 +1137,7 @@ public:
{
if (length > 0 && ValidOffsetForDataOfSize(offset, length))
return m_start + offset;
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1159,7 +1161,7 @@ public:
/// Use data that is owned by the caller when extracting values.
/// The data must stay around as long as this object, or any object
/// that copies a subset of this object's data, is valid. If \a
- /// bytes is NULL, or \a length is zero, this object will contain
+ /// bytes is nullptr, or \a length is zero, this object will contain
/// no data.
///
/// @param[in] bytes
@@ -1317,10 +1319,8 @@ public:
void
Checksum (llvm::SmallVectorImpl<uint8_t> &dest,
uint64_t max_data = 0);
-
protected:
-
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
@@ -1334,5 +1334,4 @@ protected:
} // namespace lldb_private
-#endif // #if defined (__cplusplus)
-#endif // #ifndef liblldb_DataExtractor_h_
+#endif // liblldb_DataExtractor_h_
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Oct 27 19:18:41 2015
@@ -10,8 +10,16 @@
#ifndef liblldb_Debugger_h_
#define liblldb_Debugger_h_
+// C Includes
#include <stdint.h>
+// C++ Includes
+#include <memory>
+#include <map>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/FormatEntity.h"
@@ -51,9 +59,10 @@ class Debugger :
friend class SourceManager; // For GetSourceFileCache.
public:
+ ~Debugger() override;
static lldb::DebuggerSP
- CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
+ CreateInstance(lldb::LogOutputCallback log_callback = nullptr, void *baton = nullptr);
static lldb::TargetSP
FindTargetWithProcessID (lldb::pid_t pid);
@@ -76,8 +85,26 @@ public:
static void
Destroy (lldb::DebuggerSP &debugger_sp);
- ~Debugger() override;
+ static lldb::DebuggerSP
+ FindDebuggerWithID(lldb::user_id_t id);
+ static lldb::DebuggerSP
+ FindDebuggerWithInstanceName(const ConstString &instance_name);
+
+ static size_t
+ GetNumDebuggers();
+
+ static lldb::DebuggerSP
+ GetDebuggerAtIndex(size_t index);
+
+ static bool
+ FormatDisassemblerAddress(const FormatEntity::Entry *format,
+ const SymbolContext *sc,
+ const SymbolContext *prev_sc,
+ const ExecutionContext *exe_ctx,
+ const Address *addr,
+ Stream &s);
+
void Clear();
bool
@@ -220,26 +247,6 @@ public:
const char *
GetIOHandlerHelpPrologue();
- static lldb::DebuggerSP
- FindDebuggerWithID (lldb::user_id_t id);
-
- static lldb::DebuggerSP
- FindDebuggerWithInstanceName (const ConstString &instance_name);
-
- static size_t
- GetNumDebuggers();
-
- static lldb::DebuggerSP
- GetDebuggerAtIndex (size_t index);
-
- static bool
- FormatDisassemblerAddress (const FormatEntity::Entry *format,
- const SymbolContext *sc,
- const SymbolContext *prev_sc,
- const ExecutionContext *exe_ctx,
- const Address *addr,
- Stream &s);
-
void
ClearIOHandlers ();
@@ -385,7 +392,6 @@ public:
Target *GetDummyTarget();
protected:
-
friend class CommandInterpreter;
friend class REPL;
@@ -475,7 +481,6 @@ protected:
};
private:
-
// Use Debugger::CreateInstance() to get a shared pointer to a new
// debugger object
Debugger (lldb::LogOutputCallback m_log_callback, void *baton);
Modified: lldb/trunk/include/lldb/Core/Event.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Event.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Event.h (original)
+++ lldb/trunk/include/lldb/Core/Event.h Tue Oct 27 19:18:41 2015
@@ -12,7 +12,7 @@
// C Includes
// C++ Includes
-#include <list>
+#include <memory>
#include <string>
// Other libraries and framework includes
@@ -123,10 +123,9 @@ class Event
friend class EventData;
public:
+ Event(Broadcaster *broadcaster, uint32_t event_type, EventData *data = nullptr);
- Event (Broadcaster *broadcaster, uint32_t event_type, EventData *data = NULL);
-
- Event (uint32_t event_type, EventData *data = NULL);
+ Event(uint32_t event_type, EventData *data = nullptr);
~Event ();
@@ -198,7 +197,6 @@ private:
m_broadcaster = broadcaster;
}
-
Broadcaster * m_broadcaster; // The broadcaster that sent this event
uint32_t m_type; // The bit describing this event
std::unique_ptr<EventData> m_data_ap; // User specific data for this event
Modified: lldb/trunk/include/lldb/Core/FormatEntity.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatEntity.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatEntity.h (original)
+++ lldb/trunk/include/lldb/Core/FormatEntity.h Tue Oct 27 19:18:41 2015
@@ -9,18 +9,21 @@
#ifndef liblldb_FormatEntity_h_
#define liblldb_FormatEntity_h_
-#if defined(__cplusplus)
+// C Includes
+// C++ Includes
#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Error.h"
namespace llvm
{
class StringRef;
-}
+} // namespace llvm
namespace lldb_private
{
@@ -109,13 +112,13 @@ namespace lldb_private
bool keep_separator;
};
- Entry (Type t = Type::Invalid,
- const char *s = NULL,
- const char *f = NULL) :
+ Entry(Type t = Type::Invalid,
+ const char *s = nullptr,
+ const char *f = nullptr) :
string (s ? s : ""),
printf_format (f ? f : ""),
children (),
- definition (NULL),
+ definition (nullptr),
type (t),
fmt (lldb::eFormatDefault),
number (0),
@@ -147,7 +150,7 @@ namespace lldb_private
string.clear();
printf_format.clear();
children.clear();
- definition = NULL;
+ definition = nullptr;
type = Type::Invalid;
fmt = lldb::eFormatDefault;
number = 0;
@@ -253,12 +256,10 @@ namespace lldb_private
static bool
FormatFileSpec (const FileSpec &file, Stream &s, llvm::StringRef elements, llvm::StringRef element_format);
protected:
-
static Error
ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint32_t depth);
};
+} // namespace lldb_private
-}
-#endif // #if defined(__cplusplus)
-#endif // liblldb_FormatEntity_h_
+#endif // liblldb_FormatEntity_h_
Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Tue Oct 27 19:18:41 2015
@@ -10,10 +10,16 @@
#ifndef liblldb_IOHandler_h_
#define liblldb_IOHandler_h_
+// C Includes
#include <string.h>
-#include <stack>
+// C++ Includes
+#include <memory>
+#include <string>
+#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ConstString.h"
@@ -124,7 +130,7 @@ namespace lldb_private {
GetPrompt ()
{
// Prompt support isn't mandatory
- return NULL;
+ return nullptr;
}
virtual bool
@@ -143,13 +149,13 @@ namespace lldb_private {
virtual const char *
GetCommandPrefix ()
{
- return NULL;
+ return nullptr;
}
virtual const char *
GetHelpPrologue()
{
- return NULL;
+ return nullptr;
}
int
@@ -307,7 +313,7 @@ namespace lldb_private {
virtual const char *
IOHandlerGetFixIndentationCharacters ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -393,13 +399,13 @@ namespace lldb_private {
virtual const char *
IOHandlerGetCommandPrefix ()
{
- return NULL;
+ return nullptr;
}
virtual const char *
IOHandlerGetHelpPrologue ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -703,11 +709,10 @@ namespace lldb_private {
class IOHandlerStack
{
public:
-
IOHandlerStack () :
m_stack(),
m_mutex(Mutex::eMutexTypeRecursive),
- m_top (NULL)
+ m_top (nullptr)
{
}
@@ -763,10 +768,8 @@ namespace lldb_private {
sp->SetPopped (true);
}
// Set m_top the non-locking IsTop() call
- if (m_stack.empty())
- m_top = NULL;
- else
- m_top = m_stack.back().get();
+
+ m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
}
Mutex &
@@ -786,36 +789,27 @@ namespace lldb_private {
{
Mutex::Locker locker (m_mutex);
const size_t num_io_handlers = m_stack.size();
- if (num_io_handlers >= 2 &&
- m_stack[num_io_handlers-1]->GetType() == top_type &&
- m_stack[num_io_handlers-2]->GetType() == second_top_type)
- {
- return true;
- }
- return false;
+ return (num_io_handlers >= 2 &&
+ m_stack[num_io_handlers-1]->GetType() == top_type &&
+ m_stack[num_io_handlers-2]->GetType() == second_top_type);
}
+
ConstString
GetTopIOHandlerControlSequence (char ch)
{
- if (m_top)
- return m_top->GetControlSequence(ch);
- return ConstString();
+ return ((m_top != nullptr) ? m_top->GetControlSequence(ch) : ConstString());
}
const char *
GetTopIOHandlerCommandPrefix()
{
- if (m_top)
- return m_top->GetCommandPrefix();
- return NULL;
+ return ((m_top != nullptr) ? m_top->GetCommandPrefix() : nullptr);
}
const char *
GetTopIOHandlerHelpPrologue()
{
- if (m_top)
- return m_top->GetHelpPrologue();
- return NULL;
+ return ((m_top != nullptr) ? m_top->GetHelpPrologue() : nullptr);
}
void
Modified: lldb/trunk/include/lldb/Core/Listener.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Listener.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Listener.h (original)
+++ lldb/trunk/include/lldb/Core/Listener.h Tue Oct 27 19:18:41 2015
@@ -14,11 +14,9 @@
// C++ Includes
#include <list>
#include <map>
-#include <set>
#include <string>
#include <vector>
-
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -118,13 +116,12 @@ public:
HandleBroadcastEvent (lldb::EventSP &event_sp);
private:
-
//------------------------------------------------------------------
// Classes that inherit from Listener can see and modify these
//------------------------------------------------------------------
struct BroadcasterInfo
{
- BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = NULL, void *ud = NULL) :
+ BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = nullptr, void *ud = nullptr) :
event_mask (mask),
callback (cb),
callback_user_data (ud)
@@ -141,28 +138,28 @@ private:
typedef std::vector<BroadcasterManager *> broadcaster_manager_collection;
bool
- FindNextEventInternal (Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
- uint32_t num_sources,
- uint32_t event_type_mask,
- lldb::EventSP &event_sp,
- bool remove);
+ FindNextEventInternal(Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources,
+ uint32_t event_type_mask,
+ lldb::EventSP &event_sp,
+ bool remove);
+
+ bool
+ GetNextEventInternal(Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources,
+ uint32_t event_type_mask,
+ lldb::EventSP &event_sp);
bool
- GetNextEventInternal (Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
+ WaitForEventsInternal(const TimeValue *timeout,
+ Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
uint32_t num_sources,
uint32_t event_type_mask,
lldb::EventSP &event_sp);
- bool
- WaitForEventsInternal (const TimeValue *timeout,
- Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
- uint32_t num_sources,
- uint32_t event_type_mask,
- lldb::EventSP &event_sp);
-
std::string m_name;
broadcaster_collection m_broadcasters;
Mutex m_broadcasters_mutex; // Protects m_broadcasters
@@ -191,4 +188,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Select_h_
+#endif // liblldb_Select_h_
Modified: lldb/trunk/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/MappedHash.h (original)
+++ lldb/trunk/include/lldb/Core/MappedHash.h Tue Oct 27 19:18:41 2015
@@ -1,30 +1,38 @@
+//===-- MappedHash.h --------------------------------------------*- C++ -*-===//
//
-// MappedHash.h
+// The LLVM Compiler Infrastructure
//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
#ifndef liblldb_MappedHash_h_
#define liblldb_MappedHash_h_
+// C Includes
#include <assert.h>
#include <stdint.h>
+// C++ Includes
+#include <algorithm>
#include <functional>
#include <map>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Stream.h"
class MappedHash
{
public:
-
enum HashFunctionType
{
eHashFunctionDJB = 0u // Daniel J Bernstein hash function that is also used by the ELF GNU_HASH sections
};
-
static uint32_t
HashStringUsingDJB (const char *s)
{
@@ -51,7 +59,6 @@ public:
return 0;
}
-
static const uint32_t HASH_MAGIC = 0x48415348u;
static const uint32_t HASH_CIGAM = 0x48534148u;
@@ -78,11 +85,9 @@ public:
header_data ()
{
}
-
+
virtual
- ~Header()
- {
- }
+ ~Header() = default;
size_t
GetByteSize() const
@@ -255,8 +260,7 @@ public:
header.bucket_count = num_unique_hashes;
if (header.bucket_count == 0)
header.bucket_count = 1;
-
-
+
std::vector<HashToHashData> hash_buckets;
std::vector<uint32_t> hash_indexes (header.bucket_count, 0);
std::vector<uint32_t> hash_values;
@@ -346,10 +350,12 @@ public:
}
}
}
+
protected:
typedef std::vector<Entry> collection;
collection m_entries;
};
+
// A class for reading and using a saved hash table from a block of data
// in memory
template <typename __KeyType, class __HeaderType, class __HashData>
@@ -376,9 +382,9 @@ public:
MemoryTable (lldb_private::DataExtractor &data) :
m_header (),
- m_hash_indexes (NULL),
- m_hash_values (NULL),
- m_hash_offsets (NULL)
+ m_hash_indexes (nullptr),
+ m_hash_values (nullptr),
+ m_hash_offsets (nullptr)
{
lldb::offset_t offset = m_header.Read (data, 0);
if (offset != LLDB_INVALID_OFFSET && IsValid ())
@@ -388,12 +394,10 @@ public:
m_hash_offsets = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
}
}
-
+
virtual
- ~MemoryTable ()
- {
- }
-
+ ~MemoryTable() = default;
+
bool
IsValid () const
{
@@ -484,7 +488,6 @@ public:
// subclass and return a valie "const char *" given a "key". The value
// could also be a C string pointer, in which case just returning "key"
// will suffice.
-
virtual const char *
GetStringForKeyType (KeyType key) const = 0;
@@ -507,7 +510,6 @@ public:
// should be returned. If anything else goes wrong during parsing,
// return "eResultError" and the corresponding "Find()" function will
// be canceled and return false.
-
virtual Result
GetHashDataForName (const char *name,
lldb::offset_t* hash_data_offset_ptr,
@@ -519,7 +521,6 @@ public:
return m_header;
}
-
void
ForEach (std::function <bool(const HashData &hash_data)> const &callback) const
{
@@ -547,7 +548,6 @@ public:
const uint32_t *m_hash_values;
const uint32_t *m_hash_offsets;
};
-
};
-#endif // #ifndef liblldb_MappedHash_h_
+#endif // liblldb_MappedHash_h_
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Oct 27 19:18:41 2015
@@ -10,8 +10,14 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_
+// C Includes
+// C++ Includes
#include <atomic>
+#include <string>
+#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UUID.h"
@@ -88,11 +94,11 @@ public:
/// module within a module (.a files and modules that contain
/// multiple architectures).
//------------------------------------------------------------------
- Module (const FileSpec& file_spec,
- const ArchSpec& arch,
- const ConstString *object_name = NULL,
- lldb::offset_t object_offset = 0,
- const TimeValue *object_mod_time_ptr = NULL);
+ Module(const FileSpec& file_spec,
+ const ArchSpec& arch,
+ const ConstString *object_name = nullptr,
+ lldb::offset_t object_offset = 0,
+ const TimeValue *object_mod_time_ptr = nullptr);
Module (const ModuleSpec &module_spec);
@@ -226,7 +232,7 @@ public:
///
/// @return
/// Returns a valid symbol pointer if a symbol was found,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
const Symbol *
FindFirstSymbolWithNameAndType (const ConstString &name,
@@ -646,10 +652,10 @@ public:
IsLoadedInTarget (Target *target);
bool
- LoadScriptingResourceInTarget (Target *target,
- Error& error,
- Stream* feedback_stream = NULL);
-
+ LoadScriptingResourceInTarget(Target *target,
+ Error& error,
+ Stream* feedback_stream = nullptr);
+
//------------------------------------------------------------------
/// Get the number of compile units for this module.
///
@@ -682,7 +688,7 @@ public:
/// @return
/// If Module::m_file does not exist, or no plug-in was found
/// that can parse the file, or the object file doesn't contain
- /// the current architecture in Module::m_arch, NULL will be
+ /// the current architecture in Module::m_arch, nullptr will be
/// returned, else a valid object file interface will be
/// returned. The returned pointer is owned by this object and
/// remains valid as long as the object is around.
@@ -730,7 +736,7 @@ public:
/// process.
///
/// @return
- /// The object file loaded from memory or NULL, if the operation
+ /// The object file loaded from memory or nullptr, if the operation
/// failed (see the `error` for more information in that case).
//------------------------------------------------------------------
ObjectFile *
@@ -747,20 +753,20 @@ public:
///
/// @return
/// If this module does not have a valid object file, or no
- /// plug-in can be found that can use the object file, NULL will
+ /// plug-in can be found that can use the object file, nullptr will
/// be returned, else a valid symbol vendor plug-in interface
/// will be returned. The returned pointer is owned by this
/// object and remains valid as long as the object is around.
//------------------------------------------------------------------
virtual SymbolVendor*
GetSymbolVendor(bool can_create = true,
- lldb_private::Stream *feedback_strm = NULL);
+ lldb_private::Stream *feedback_strm = nullptr);
//------------------------------------------------------------------
/// Get accessor the type list for this module.
///
/// @return
- /// A valid type list pointer, or NULL if there is no valid
+ /// A valid type list pointer, or nullptr if there is no valid
/// symbol vendor for this module.
//------------------------------------------------------------------
TypeList*
Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=251470&r1=251469&r2=251470&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Tue Oct 27 19:18:41 2015
@@ -10,10 +10,14 @@
#ifndef liblldb_ModuleList_h_
#define liblldb_ModuleList_h_
-#include <vector>
-#include <list>
+// C Includes
+// C++ Includes
#include <functional>
+#include <list>
+#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Utility/Iterable.h"
@@ -30,10 +34,12 @@ namespace lldb_private {
class ModuleList
{
public:
-
class Notifier
{
public:
+ virtual
+ ~Notifier() = default;
+
virtual void
ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0;
virtual void
@@ -43,10 +49,6 @@ public:
const lldb::ModuleSP& new_module_sp) = 0;
virtual void
WillClearList (const ModuleList& module_list) = 0;
-
- virtual
- ~Notifier ()
- {}
};
//------------------------------------------------------------------
@@ -144,6 +146,7 @@ public:
//------------------------------------------------------------------
void
Destroy();
+
//------------------------------------------------------------------
/// Dump the description of each module contained in this list.
///
@@ -209,7 +212,7 @@ public:
/// An index into this module collection.
///
/// @return
- /// A pointer to a Module which can by NULL if \a idx is out
+ /// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
/// @see ModuleList::GetSize()
@@ -226,7 +229,7 @@ public:
/// An index into this module collection.
///
/// @return
- /// A pointer to a Module which can by NULL if \a idx is out
+ /// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
/// @see ModuleList::GetSize()
@@ -534,10 +537,10 @@ public:
GetSize () const;
bool
- LoadScriptingResourcesInTarget (Target *target,
- std::list<Error>& errors,
- Stream* feedback_stream = NULL,
- bool continue_on_error = true);
+ LoadScriptingResourcesInTarget(Target *target,
+ std::list<Error>& errors,
+ Stream* feedback_stream = nullptr,
+ bool continue_on_error = true);
static bool
ModuleIsInCache (const Module *module_ptr);
@@ -606,9 +609,8 @@ public:
{
return ModuleIterableNoLocking(m_modules);
}
-
};
} // namespace lldb_private
-#endif // liblldb_ModuleList_h_
+#endif // liblldb_ModuleList_h_
More information about the lldb-commits
mailing list