[Lldb-commits] [lldb] r251416 - Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/DataFormatters, Breakpoint and Utility; other minor fixes.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 27 10:20:33 PDT 2015
Author: eugenezelenko
Date: Tue Oct 27 12:20:33 2015
New Revision: 251416
URL: http://llvm.org/viewvc/llvm-project?rev=251416&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/DataFormatters, Breakpoint and Utility; other minor fixes.
Modified:
lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h
lldb/trunk/include/lldb/DataFormatters/DataVisualization.h
lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h
lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
lldb/trunk/include/lldb/DataFormatters/FormatManager.h
lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
lldb/trunk/include/lldb/DataFormatters/TypeCategory.h
lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h
lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
lldb/trunk/include/lldb/Utility/Iterable.h
lldb/trunk/include/lldb/Utility/SharingPtr.h
Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue Oct 27 12:20:33 2015
@@ -12,7 +12,10 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
#include <unordered_set>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -81,7 +84,6 @@ class Breakpoint:
public Stoppoint
{
public:
-
static const ConstString &
GetEventIdentifier ();
@@ -142,7 +144,6 @@ public:
GetEventDataFromEvent (const Event *event_sp);
private:
-
lldb::BreakpointEventType m_breakpoint_event;
lldb::BreakpointSP m_new_breakpoint_sp;
BreakpointLocationCollection m_locations;
@@ -153,7 +154,7 @@ public:
class BreakpointPrecondition
{
public:
- virtual ~BreakpointPrecondition() {}
+ virtual ~BreakpointPrecondition() = default;
virtual bool
EvaluatePrecondition(StoppointCallbackContext &context);
@@ -287,8 +288,8 @@ public:
/// Returns a pointer to the new location.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
- AddLocation (const Address &addr,
- bool *new_location = NULL);
+ AddLocation(const Address &addr,
+ bool *new_location = nullptr);
//------------------------------------------------------------------
/// Find a breakpoint location by Address.
@@ -297,7 +298,7 @@ public:
/// The Address specifying the location.
/// @return
/// Returns a shared pointer to the location at \a addr. The pointer
- /// in the shared pointer will be NULL if there is no location at that address.
+ /// in the shared pointer will be nullptr if there is no location at that address.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindLocationByAddress (const Address &addr);
@@ -321,7 +322,7 @@ public:
/// The ID specifying the location.
/// @return
/// Returns a shared pointer to the location with ID \a bp_loc_id. The pointer
- /// in the shared pointer will be NULL if there is no location with that ID.
+ /// in the shared pointer will be nullptr if there is no location with that ID.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindLocationByID (lldb::break_id_t bp_loc_id);
@@ -334,7 +335,7 @@ public:
///
/// @return
/// Returns a shared pointer to the location with index \a
- /// index. The shared pointer might contain NULL if \a index is
+ /// index. The shared pointer might contain nullptr if \a index is
/// greater than then number of actual locations.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -482,7 +483,7 @@ public:
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
- /// Pass in NULL to clear the condition.
+ /// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition (const char *condition);
@@ -490,7 +491,7 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText () const;
@@ -552,7 +553,7 @@ public:
/// Return the "kind" description for a breakpoint.
///
/// @return
- /// The breakpoint kind, or NULL if none is set.
+ /// The breakpoint kind, or nullptr if none is set.
//------------------------------------------------------------------
const char *GetBreakpointKind () const
{
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue Oct 27 12:20:33 2015
@@ -11,12 +11,10 @@
#define liblldb_BreakpointLocation_h_
// C Includes
-
// C++ Includes
-#include <list>
+#include <memory>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/StoppointLocation.h"
@@ -172,11 +170,11 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *
- GetConditionText (size_t *hash = NULL) const;
+ GetConditionText(size_t *hash = nullptr) const;
bool
ConditionSaysStop (ExecutionContext &exe_ctx, Error &error);
@@ -459,7 +457,7 @@ private:
bool m_is_indirect;
Address m_address; ///< The address defining this location.
Breakpoint &m_owner; ///< The breakpoint that produced this object.
- std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
+ std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, nullptr if we're using our breakpoint's options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Tue Oct 27 12:20:33 2015
@@ -12,8 +12,9 @@
// C Includes
// C++ Includes
-#include <vector>
#include <map>
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -56,7 +57,7 @@ public:
/// The address to look for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
@@ -70,7 +71,7 @@ public:
/// The breakpoint location ID to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -116,7 +117,7 @@ public:
/// The breakpoint location index to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -130,7 +131,7 @@ public:
/// The breakpoint location index to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
@@ -216,7 +217,6 @@ public:
lldb::DescriptionLevel level);
protected:
-
//------------------------------------------------------------------
/// This is the standard constructor.
///
@@ -246,9 +246,9 @@ protected:
StopRecordingNewLocations();
lldb::BreakpointLocationSP
- AddLocation (const Address &addr,
- bool resolve_indirect_symbols,
- bool *new_location = NULL);
+ AddLocation(const Address &addr,
+ bool resolve_indirect_symbols,
+ bool *new_location = nullptr);
void
SwapLocation (lldb::BreakpointLocationSP to_location_sp, lldb::BreakpointLocationSP from_location_sp);
@@ -273,16 +273,17 @@ protected:
mutable Mutex m_mutex;
lldb::break_id_t m_next_id;
BreakpointLocationCollection *m_new_location_recorder;
+
public:
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationIterable;
+
BreakpointLocationIterable
BreakpointLocations()
{
return BreakpointLocationIterable(m_locations);
}
-
};
} // namespace lldb_private
-#endif // liblldb_BreakpointLocationList_h_
+#endif // liblldb_BreakpointLocationList_h_
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue Oct 27 12:20:33 2015
@@ -12,6 +12,9 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -183,10 +186,10 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
- const char *GetConditionText (size_t *hash = NULL) const;
+ const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// Enabled/Ignore Count
@@ -256,10 +259,10 @@ public:
}
//------------------------------------------------------------------
- /// Return the current thread spec for this option. This will return NULL if the no thread
+ /// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
- /// The thread specification pointer for this option, or NULL if none has
+ /// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
@@ -306,10 +309,8 @@ public:
{
}
- ~CommandData ()
- {
- }
-
+ ~CommandData() = default;
+
StringList user_source;
std::string script_source;
bool stop_on_error;
@@ -326,7 +327,7 @@ public:
~CommandBaton() override
{
delete ((CommandData *)m_data);
- m_data = NULL;
+ m_data = nullptr;
}
void
Modified: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Tue Oct 27 12:20:33 2015
@@ -11,13 +11,11 @@
#define liblldb_Watchpoint_h_
// C Includes
-
// C++ Includes
-#include <list>
+#include <memory>
#include <string>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
@@ -33,7 +31,6 @@ class Watchpoint :
public StoppointLocation
{
public:
-
class WatchpointEventData :
public EventData
{
@@ -68,7 +65,6 @@ public:
GetEventDataFromEvent (const Event *event_sp);
private:
-
lldb::WatchpointEventType m_watchpoint_event;
lldb::WatchpointSP m_new_watchpoint_sp;
@@ -76,6 +72,7 @@ public:
};
Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const CompilerType *type, bool hardware = true);
+
~Watchpoint() override;
void
@@ -109,7 +106,7 @@ public:
void GetDescription (Stream *s, lldb::DescriptionLevel level);
void Dump (Stream *s) const override;
- void DumpSnapshots (Stream *s, const char * prefix = NULL) const;
+ void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
Target &GetTarget() { return m_target; }
const Error &GetError() { return m_error; }
@@ -171,7 +168,7 @@ public:
///
/// @param[in] condition
/// The condition expression to evaluate when the watchpoint is hit.
- /// Pass in NULL to clear the condition.
+ /// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition (const char *condition);
@@ -179,7 +176,7 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText () const;
Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h Tue Oct 27 12:20:33 2015
@@ -12,6 +12,9 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -149,10 +152,10 @@ public:
const Baton *GetBaton () const;
//------------------------------------------------------------------
- /// Return the current thread spec for this option. This will return NULL if the no thread
+ /// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
- /// The thread specification pointer for this option, or NULL if none has
+ /// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
@@ -204,10 +207,8 @@ public:
{
}
- ~CommandData ()
- {
- }
-
+ ~CommandData() = default;
+
StringList user_source;
std::string script_source;
bool stop_on_error;
@@ -224,7 +225,7 @@ public:
~CommandBaton() override
{
delete ((CommandData *)m_data);
- m_data = NULL;
+ m_data = nullptr;
}
void
Modified: lldb/trunk/include/lldb/DataFormatters/DataVisualization.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/DataVisualization.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/DataVisualization.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/DataVisualization.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- DataVisualization.h ----------------------------------------*- C++ -*-===//
+//===-- DataVisualization.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -28,7 +28,6 @@ namespace lldb_private {
class DataVisualization
{
public:
-
// use this call to force the FM to consider itself updated even when there is no apparent reason for that
static void
ForceUpdate();
@@ -83,8 +82,8 @@ public:
AnyMatches(ConstString type_name,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
class NamedSummaryFormats
{
@@ -111,7 +110,6 @@ public:
class Categories
{
public:
-
static bool
GetCategory (const ConstString &category,
lldb::TypeCategoryImplSP &entry,
@@ -166,7 +164,6 @@ public:
};
};
-
} // namespace lldb_private
-#endif // lldb_DataVisualization_h_
+#endif// lldb_DataVisualization_h_
Modified: lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- DumpValueObjectOptions.h ---------------------------------------*- C++ -*-===//
+//===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,7 @@
// C Includes
// C++ Includes
+#include <string>
// Other libraries and framework includes
// Project includes
@@ -60,7 +61,6 @@ public:
const DumpValueObjectOptions &,
Stream&)> DeclPrintingHelper;
-public:
static const DumpValueObjectOptions
DefaultOptions()
{
@@ -124,7 +124,7 @@ public:
SetSummary (lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
DumpValueObjectOptions&
- SetRootValueObjectName (const char* name = NULL);
+ SetRootValueObjectName(const char* name = nullptr);
DumpValueObjectOptions&
SetHideRootType (bool hide_root_type = false);
@@ -150,7 +150,6 @@ public:
DumpValueObjectOptions&
SetAllowOnelinerMode (bool oneliner = false);
-public:
uint32_t m_max_depth = UINT32_MAX;
lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
uint32_t m_omit_summary_depth = 0;
@@ -174,8 +173,8 @@ public:
bool m_use_type_display_name : 1;
bool m_allow_oneliner_mode : 1;
bool m_hide_pointer_value : 1;
-
};
+
} // namespace lldb_private
-#endif // lldb_DumpValueObjectOptions_h_
+#endif // lldb_DumpValueObjectOptions_h_
Modified: lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatClasses.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatClasses.h Tue Oct 27 12:20:33 2015
@@ -10,12 +10,14 @@
#ifndef lldb_FormatClasses_h_
#define lldb_FormatClasses_h_
+// C Includes
// C++ Includes
+#include <functional>
+#include <memory>
#include <string>
#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
@@ -47,7 +49,6 @@ public:
class FormattersMatchCandidate
{
public:
-
FormattersMatchCandidate (ConstString name,
uint32_t reason,
bool strip_ptr,
@@ -60,10 +61,9 @@ public:
m_stripped_typedef(strip_tydef)
{
}
-
- ~FormattersMatchCandidate ()
- {}
-
+
+ ~FormattersMatchCandidate() = default;
+
ConstString
GetTypeName () const
{
@@ -195,7 +195,7 @@ public:
{
if (m_type.m_type_name.size())
return m_type.m_type_name.c_str();
- return NULL;
+ return nullptr;
}
lldb::TypeSP
@@ -230,12 +230,11 @@ private:
TypePair m_type_pair;
};
TypeOrName m_type;
-
-
+
private:
DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
};
} // namespace lldb_private
-#endif // lldb_FormatClasses_h_
+#endif // lldb_FormatClasses_h_
Modified: lldb/trunk/include/lldb/DataFormatters/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatManager.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormatManager.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatManager.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- FormatManager.h -------------------------------------------*- C++ -*-===//
+//===-- FormatManager.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,10 @@
// C Includes
// C++ Includes
+#include <atomic>
+#include <initializer_list>
+#include <map>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -25,10 +29,6 @@
#include "lldb/DataFormatters/TypeCategory.h"
#include "lldb/DataFormatters/TypeCategoryMap.h"
-#include <atomic>
-#include <functional>
-#include <memory>
-
namespace lldb_private {
// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
@@ -41,13 +41,14 @@ class FormatManager : public IFormatChan
typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
public:
-
typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer> LanguageCategories;
typedef TypeCategoryMap::CallbackType CategoryCallback;
- FormatManager ();
+ FormatManager();
+ ~FormatManager() override = default;
+
NamedSummariesMap&
GetNamedSummaryContainer ()
{
@@ -142,8 +143,8 @@ public:
LoopThroughCategories (CategoryCallback callback, void* param);
lldb::TypeCategoryImplSP
- GetCategory (const char* category_name = NULL,
- bool can_create = true)
+ GetCategory(const char* category_name = nullptr,
+ bool can_create = true)
{
if (!category_name)
return GetCategory(m_default_category_name);
@@ -195,11 +196,11 @@ public:
lldb::DynamicValueType use_dynamic);
bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr)
{
return m_categories_map.AnyMatches(type_name,
items,
@@ -250,11 +251,7 @@ public:
{
return m_last_revision;
}
-
- ~FormatManager () override
- {
- }
-
+
static FormattersMatchVector
GetPossibleMatches (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
@@ -282,7 +279,6 @@ public:
GetCandidateLanguages (lldb::LanguageType lang_type);
private:
-
static std::vector<lldb::LanguageType>
GetCandidateLanguages (ValueObject& valobj);
Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- FormattersContainer.h ----------------------------------------*- C++ -*-===//
+//===-- FormattersContainer.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,9 +13,11 @@
// C Includes
// C++ Includes
#include <functional>
+#include <map>
+#include <memory>
+#include <string>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
@@ -34,15 +36,14 @@ namespace lldb_private {
class IFormatChangeListener
{
public:
+ virtual
+ ~IFormatChangeListener() = default;
+
virtual void
Changed () = 0;
-
- virtual
- ~IFormatChangeListener () {}
-
+
virtual uint32_t
GetCurrentRevision () = 0;
-
};
// if the user tries to add formatters for, say, "struct Foo"
@@ -76,7 +77,6 @@ template<typename KeyType, typename Valu
class FormatMap
{
public:
-
typedef typename ValueType::SharedPointer ValueSP;
typedef std::map<KeyType, ValueSP> MapType;
typedef typename MapType::iterator MapIterator;
@@ -211,7 +211,6 @@ protected:
friend class FormattersContainer<KeyType, ValueType>;
friend class FormatManager;
-
};
template<typename KeyType, typename ValueType>
@@ -240,20 +239,20 @@ public:
void
Add (const MapKeyType &type, const MapValueType& entry)
{
- Add_Impl(type, entry, (KeyType*)NULL);
+ Add_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
bool
Delete (ConstString type)
{
- return Delete_Impl(type, (KeyType*)NULL);
+ return Delete_Impl(type, static_cast<KeyType*>(nullptr));
}
bool
Get(ValueObject& valobj,
MapValueType& entry,
lldb::DynamicValueType use_dynamic,
- uint32_t* why = NULL)
+ uint32_t* why = nullptr)
{
uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
CompilerType ast_type(valobj.GetCompilerType());
@@ -270,13 +269,13 @@ public:
bool
Get (ConstString type, MapValueType& entry)
{
- return Get_Impl(type, entry, (KeyType*)NULL);
+ return Get_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
bool
GetExact (ConstString type, MapValueType& entry)
{
- return GetExact_Impl(type, entry, (KeyType*)NULL);
+ return GetExact_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
MapValueType
@@ -288,7 +287,7 @@ public:
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierAtIndex (size_t index)
{
- return GetTypeNameSpecifierAtIndex_Impl(index, (KeyType*)NULL);
+ return GetTypeNameSpecifierAtIndex_Impl(index, static_cast<KeyType*>(nullptr));
}
void
@@ -361,7 +360,7 @@ protected:
bool
GetExact_Impl (ConstString type, MapValueType& entry, ConstString *dummy)
{
- return Get_Impl(type,entry, (KeyType*)0);
+ return Get_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
lldb::TypeNameSpecifierImplSP
@@ -379,7 +378,7 @@ protected:
GetTypeNameSpecifierAtIndex_Impl (size_t index, lldb::RegularExpressionSP *dummy)
{
lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
- if (regex.get() == NULL)
+ if (regex.get() == nullptr)
return lldb::TypeNameSpecifierImplSP();
return lldb::TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(regex->GetText(),
true));
@@ -452,4 +451,4 @@ protected:
} // namespace lldb_private
-#endif // lldb_FormattersContainer_h_
+#endif // lldb_FormattersContainer_h_
Modified: lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/StringPrinter.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/StringPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/StringPrinter.h Tue Oct 27 12:20:33 2015
@@ -10,20 +10,23 @@
#ifndef liblldb_StringPrinter_h_
#define liblldb_StringPrinter_h_
+// C Includes
+// C++ Includes
+#include <functional>
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/Core/DataExtractor.h"
-#include <functional>
-#include <string>
-
namespace lldb_private {
namespace formatters
{
class StringPrinter
{
public:
-
enum class StringElementType
{
ASCII,
@@ -41,11 +44,10 @@ namespace lldb_private {
class ReadStringAndDumpToStreamOptions
{
public:
-
ReadStringAndDumpToStreamOptions () :
m_location(0),
m_process_sp(),
- m_stream(NULL),
+ m_stream(nullptr),
m_prefix_token(),
m_suffix_token(),
m_quote('"'),
@@ -249,10 +251,9 @@ namespace lldb_private {
class ReadBufferAndDumpToStreamOptions
{
public:
-
ReadBufferAndDumpToStreamOptions () :
m_data(),
- m_stream(NULL),
+ m_stream(nullptr),
m_prefix_token(),
m_suffix_token(),
m_quote('"'),
@@ -455,6 +456,13 @@ namespace lldb_private {
rhs.m_data = nullptr; // this is why m_data has to be mutable
}
+ ~StringPrinterBufferPointer()
+ {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = nullptr;
+ }
+
const T*
GetBytes () const
{
@@ -467,13 +475,6 @@ namespace lldb_private {
return m_size;
}
- ~StringPrinterBufferPointer ()
- {
- if (m_data && m_deleter)
- m_deleter(m_data);
- m_data = nullptr;
- }
-
StringPrinterBufferPointer&
operator = (const StringPrinterBufferPointer& rhs)
{
Modified: lldb/trunk/include/lldb/DataFormatters/TypeCategory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeCategory.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeCategory.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeCategory.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- TypeCategory.h -------------------------------------------*- C++ -*-===//
+//===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,10 @@
// C Includes
// C++ Includes
+#include <initializer_list>
+#include <memory>
+#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -75,10 +79,9 @@ namespace lldb_private {
#ifndef LLDB_DISABLE_PYTHON
typedef FormatterContainerPair<ScriptedSyntheticChildren> SynthContainer;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
public:
-
typedef uint16_t FormatCategoryItems;
static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
@@ -93,7 +96,7 @@ namespace lldb_private {
#ifndef LLDB_DISABLE_PYTHON
typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
@@ -191,7 +194,7 @@ namespace lldb_private {
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForSyntheticAtIndex (size_t index);
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
ValidatorContainerSP
GetTypeValidatorsContainer ()
@@ -227,28 +230,28 @@ namespace lldb_private {
}
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeFormatImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeFormatImplSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeSummaryImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeSummaryImplSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::SyntheticChildrenSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::SyntheticChildrenSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeValidatorImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeValidatorImplSP& entry,
+ uint32_t* reason = nullptr);
void
Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
@@ -282,11 +285,11 @@ namespace lldb_private {
GetDescription ();
bool
- AnyMatches (ConstString type_name,
- FormatCategoryItems items = ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- FormatCategoryItems* matching_type = NULL);
+ AnyMatches(ConstString type_name,
+ FormatCategoryItems items = ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ FormatCategoryItems* matching_type = nullptr);
typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
@@ -296,7 +299,7 @@ namespace lldb_private {
FilterContainer m_filter_cont;
#ifndef LLDB_DISABLE_PYTHON
SynthContainer m_synth_cont;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
ValidatorContainer m_validator_cont;
bool m_enabled;
@@ -351,7 +354,7 @@ namespace lldb_private {
#ifndef LLDB_DISABLE_PYTHON
friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
friend class FormattersContainer<lldb::RegularExpressionSP, ScriptedSyntheticChildren>;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
friend class FormattersContainer<ConstString, TypeValidatorImpl>;
friend class FormattersContainer<lldb::RegularExpressionSP, TypeValidatorImpl>;
@@ -359,4 +362,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // lldb_TypeCategory_h_
+#endif // lldb_TypeCategory_h_
Modified: lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- TypeCategoryMap.h ----------------------------------------*- C++ -*-===//
+//===-- TypeCategoryMap.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <list>
+#include <map>
// Other libraries and framework includes
// Project includes
@@ -88,11 +90,11 @@ namespace lldb_private {
GetAtIndex (uint32_t);
bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
uint32_t
GetCount ()
@@ -111,11 +113,10 @@ namespace lldb_private {
GetSyntheticChildren (FormattersMatchData& match_data);
#endif
- lldb::TypeValidatorImplSP
- GetValidator (FormattersMatchData& match_data);
+ lldb::TypeValidatorImplSP
+ GetValidator(FormattersMatchData& match_data);
private:
-
class delete_matching_categories
{
lldb::TypeCategoryImplSP ptr;
@@ -155,4 +156,4 @@ namespace lldb_private {
};
} // namespace lldb_private
-#endif // lldb_TypeCategoryMap_h_
+#endif // lldb_TypeCategoryMap_h_
Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- TypeSummary.h --------------------------------------------*- C++ -*-===//
+//===-- TypeSummary.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,11 +15,10 @@
// C++ Includes
#include <functional>
+#include <memory>
#include <string>
-#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
@@ -35,6 +34,8 @@ namespace lldb_private {
TypeSummaryOptions ();
TypeSummaryOptions (const TypeSummaryOptions& rhs);
+ ~TypeSummaryOptions() = default;
+
TypeSummaryOptions&
operator = (const TypeSummaryOptions& rhs);
@@ -49,8 +50,7 @@ namespace lldb_private {
TypeSummaryOptions&
SetCapping (lldb::TypeSummaryCapping);
-
- ~TypeSummaryOptions() = default;
+
private:
lldb::LanguageType m_lang;
lldb::TypeSummaryCapping m_capping;
@@ -65,7 +65,10 @@ namespace lldb_private {
eScript,
eCallback
};
-
+
+ virtual
+ ~TypeSummaryImpl() = default;
+
Kind
GetKind () const
{
@@ -75,7 +78,6 @@ namespace lldb_private {
class Flags
{
public:
-
Flags () :
m_flags (lldb::eTypeOptionCascade)
{}
@@ -276,16 +278,19 @@ namespace lldb_private {
{
return m_flags.GetCascades();
}
+
bool
SkipsPointers () const
{
return m_flags.GetSkipPointers();
}
+
bool
SkipsReferences () const
{
return m_flags.GetSkipReferences();
}
+
bool
NonCacheable () const
{
@@ -382,11 +387,6 @@ namespace lldb_private {
m_flags.SetValue(value);
}
- virtual
- ~TypeSummaryImpl ()
- {
- }
-
// we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
// extended periods of time and we trust the ValueObject to stay around for as long as it is required
// for us to generate its summary
@@ -429,10 +429,8 @@ namespace lldb_private {
StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char* f);
-
- ~StringSummaryFormat() override
- {
- }
+
+ ~StringSummaryFormat() override = default;
const char*
GetSummaryString () const
@@ -475,7 +473,9 @@ namespace lldb_private {
CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
Callback impl,
const char* description);
-
+
+ ~CXXFunctionSummaryFormat() override = default;
+
Callback
GetBackendFunction () const
{
@@ -502,11 +502,7 @@ namespace lldb_private {
else
m_description.clear();
}
-
- ~CXXFunctionSummaryFormat() override
- {
- }
-
+
bool
FormatObject(ValueObject *valobj,
std::string& dest,
@@ -535,8 +531,10 @@ namespace lldb_private {
ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char *function_name,
- const char* python_script = NULL);
-
+ const char* python_script = nullptr);
+
+ ~ScriptSummaryFormat() override = default;
+
const char*
GetFunctionName () const
{
@@ -568,10 +566,6 @@ namespace lldb_private {
m_python_script.clear();
}
- ~ScriptSummaryFormat() override
- {
- }
-
bool
FormatObject(ValueObject *valobj,
std::string& dest,
Modified: lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h Tue Oct 27 12:20:33 2015
@@ -1,4 +1,4 @@
-//===-- TypeSynthetic.h -------------------------------------------*- C++ -*-===//
+//===-- TypeSynthetic.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,12 +14,13 @@
#include <stdint.h>
// C++ Includes
+#include <initializer_list>
#include <functional>
+#include <memory>
#include <string>
#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
@@ -46,16 +47,13 @@ namespace lldb_private {
}
public:
-
SyntheticChildrenFrontEnd (ValueObject &backend) :
m_backend(backend),
m_valid(true)
{}
-
+
virtual
- ~SyntheticChildrenFrontEnd ()
- {
- }
+ ~SyntheticChildrenFrontEnd() = default;
virtual size_t
CalculateNumChildren () = 0;
@@ -125,11 +123,9 @@ namespace lldb_private {
SyntheticValueProviderFrontEnd (ValueObject &backend) :
SyntheticChildrenFrontEnd(backend)
{}
-
- ~SyntheticValueProviderFrontEnd() override
- {
- }
-
+
+ ~SyntheticValueProviderFrontEnd() override = default;
+
size_t
CalculateNumChildren() override { return 0; }
@@ -155,7 +151,6 @@ namespace lldb_private {
class SyntheticChildren
{
public:
-
class Flags
{
public:
@@ -279,27 +274,28 @@ namespace lldb_private {
m_flags(flags)
{
}
-
+
virtual
- ~SyntheticChildren ()
- {
- }
-
+ ~SyntheticChildren() = default;
+
bool
Cascades () const
{
return m_flags.GetCascades();
}
+
bool
SkipsPointers () const
{
return m_flags.GetSkipPointers();
}
+
bool
SkipsReferences () const
{
return m_flags.GetSkipReferences();
}
+
bool
NonCacheable () const
{
@@ -434,20 +430,15 @@ namespace lldb_private {
class FrontEnd : public SyntheticChildrenFrontEnd
{
- private:
- TypeFilterImpl* filter;
public:
-
FrontEnd(TypeFilterImpl* flt,
ValueObject &backend) :
SyntheticChildrenFrontEnd(backend),
filter(flt)
{}
-
- ~FrontEnd() override
- {
- }
-
+
+ ~FrontEnd() override = default;
+
size_t
CalculateNumChildren() override
{
@@ -477,6 +468,8 @@ namespace lldb_private {
typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
private:
+ TypeFilterImpl* filter;
+
DISALLOW_COPY_AND_ASSIGN(FrontEnd);
};
@@ -534,9 +527,9 @@ namespace lldb_private {
std::string m_python_code;
public:
- ScriptedSyntheticChildren (const SyntheticChildren::Flags& flags,
- const char* pclass,
- const char* pcode = NULL) :
+ ScriptedSyntheticChildren(const SyntheticChildren::Flags& flags,
+ const char* pclass,
+ const char* pcode = nullptr) :
SyntheticChildren(flags),
m_python_class(),
m_python_code()
@@ -583,20 +576,15 @@ namespace lldb_private {
class FrontEnd : public SyntheticChildrenFrontEnd
{
- private:
- std::string m_python_class;
- StructuredData::ObjectSP m_wrapper_sp;
- ScriptInterpreter *m_interpreter;
public:
-
FrontEnd (std::string pclass,
ValueObject &backend);
+ ~FrontEnd() override;
+
bool
IsValid ();
- ~FrontEnd() override;
-
size_t
CalculateNumChildren() override;
@@ -621,6 +609,10 @@ namespace lldb_private {
typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
private:
+ std::string m_python_class;
+ StructuredData::ObjectSP m_wrapper_sp;
+ ScriptInterpreter *m_interpreter;
+
DISALLOW_COPY_AND_ASSIGN(FrontEnd);
};
@@ -630,7 +622,7 @@ namespace lldb_private {
auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(m_python_class, backend));
if (synth_ptr && ((FrontEnd*)synth_ptr.get())->IsValid())
return synth_ptr;
- return NULL;
+ return nullptr;
}
private:
Modified: lldb/trunk/include/lldb/Utility/Iterable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Iterable.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Iterable.h (original)
+++ lldb/trunk/include/lldb/Utility/Iterable.h Tue Oct 27 12:20:33 2015
@@ -10,6 +10,12 @@
#ifndef liblldb_Iterable_h_
#define liblldb_Iterable_h_
+// C Includes
+// C++ Includes
+#include <utility>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/Host/Mutex.h"
namespace lldb_private
@@ -34,9 +40,7 @@ template <typename C, typename E, E (*A)
{
public:
typedef typename C::const_iterator BackingIterator;
-private:
- BackingIterator m_iter;
-public:
+
// Wrapping constructor
AdaptedConstIterator (BackingIterator backing_iterator) :
m_iter(backing_iterator)
@@ -63,7 +67,7 @@ public:
}
// Destructible
- ~AdaptedConstIterator () { }
+ ~AdaptedConstIterator() = default;
// Comparable
bool operator== (const AdaptedConstIterator &rhs)
@@ -160,6 +164,9 @@ public:
template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
friend void swap(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
+
+private:
+ BackingIterator m_iter;
};
template <typename C, typename E, E (*A)(typename C::const_iterator &)>
@@ -203,8 +210,6 @@ public:
template <typename C, typename E, E (*A)(typename C::const_iterator &)> class LockingAdaptedIterable : public AdaptedIterable<C, E, A>
{
-private:
- Mutex *m_mutex = nullptr;
public:
LockingAdaptedIterable (C &container, Mutex &mutex) :
AdaptedIterable<C,E,A>(container),
@@ -217,7 +222,7 @@ public:
AdaptedIterable<C,E,A>(rhs),
m_mutex(rhs.m_mutex)
{
- rhs.m_mutex = NULL;
+ rhs.m_mutex = nullptr;
}
~LockingAdaptedIterable ()
@@ -227,9 +232,11 @@ public:
}
private:
+ Mutex *m_mutex = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(LockingAdaptedIterable);
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_Iterable_h_
Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=251416&r1=251415&r2=251416&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/trunk/include/lldb/Utility/SharingPtr.h Tue Oct 27 12:20:33 2015
@@ -10,6 +10,8 @@
#ifndef utility_SharingPtr_h_
#define utility_SharingPtr_h_
+// C Includes
+// C++ Includes
#include <algorithm>
#include <memory>
@@ -22,6 +24,9 @@
#include <atomic>
#endif
+// Other libraries and framework includes
+// Project includes
+
//#define ENABLE_SP_LOGGING 1 // DON'T CHECK THIS LINE IN UNLESS COMMENTED OUT
#if defined (ENABLE_SP_LOGGING)
@@ -38,6 +43,13 @@ class shared_count
shared_count(const shared_count&);
shared_count& operator=(const shared_count&);
+public:
+ explicit shared_count(long refs = 0)
+ : shared_owners_(refs) {}
+
+ void add_shared();
+ void release_shared();
+ long use_count() const {return shared_owners_ + 1;}
protected:
#ifdef _MSC_VER
long shared_owners_;
@@ -45,16 +57,9 @@ protected:
std::atomic<long> shared_owners_;
#endif
virtual ~shared_count();
+
private:
virtual void on_zero_shared() = 0;
-
-public:
- explicit shared_count(long refs = 0)
- : shared_owners_(refs) {}
-
- void add_shared();
- void release_shared();
- long use_count() const {return shared_owners_ + 1;}
};
template <class T>
@@ -125,18 +130,20 @@ shared_ptr_emplace<T>::on_zero_shared()
{
}
-} // namespace
+} // namespace imp
template<class T>
class SharingPtr
{
public:
typedef T element_type;
+
private:
element_type* ptr_;
imp::shared_count* cntrl_;
struct nat {int for_bool_;};
+
public:
SharingPtr();
SharingPtr(std::nullptr_t);
@@ -162,7 +169,7 @@ public:
element_type* operator->() const {return ptr_;}
long use_count() const {return cntrl_ ? cntrl_->use_count() : 0;}
bool unique() const {return use_count() == 1;}
- bool empty() const {return cntrl_ == 0;}
+ bool empty() const {return cntrl_ == nullptr;}
operator nat*() const {return (nat*)get();}
static SharingPtr<T> make_shared();
@@ -183,30 +190,29 @@ public:
static SharingPtr<T> make_shared(A0&, A1&, A2&, A3&, A4&);
private:
-
template <class U> friend class SharingPtr;
};
template<class T>
inline
SharingPtr<T>::SharingPtr()
- : ptr_(0),
- cntrl_(0)
+ : ptr_(nullptr),
+ cntrl_(nullptr)
{
}
template<class T>
inline
SharingPtr<T>::SharingPtr(std::nullptr_t)
-: ptr_(0),
-cntrl_(0)
+: ptr_(nullptr),
+cntrl_(nullptr)
{
}
template<class T>
template<class Y>
SharingPtr<T>::SharingPtr(Y* p)
- : ptr_(p), cntrl_(0)
+ : ptr_(p), cntrl_(nullptr)
{
std::unique_ptr<Y> hold(p);
typedef imp::shared_ptr_pointer<Y*> _CntrlBlk;
@@ -432,7 +438,6 @@ make_shared(A0& a0, A1& a1, A2& a2, A3&
return SharingPtr<T>::make_shared(a0, a1, a2, a3, a4);
}
-
template<class T, class U>
inline
bool
@@ -491,12 +496,8 @@ public:
// action: false means increment just happened
// true means decrement is about to happen
-private:
- Callback cb_;
- void* baton_;
+ LoggingSharingPtr() : cb_(0), baton_(nullptr) {}
-public:
- LoggingSharingPtr() : cb_(0), baton_(0) {}
LoggingSharingPtr(Callback cb, void* baton)
: cb_(cb), baton_(baton)
{
@@ -506,7 +507,7 @@ public:
template <class Y>
LoggingSharingPtr(Y* p)
- : base(p), cb_(0), baton_(0) {}
+ : base(p), cb_(0), baton_(nullptr) {}
template <class Y>
LoggingSharingPtr(Y* p, Callback cb, void* baton)
@@ -569,9 +570,12 @@ public:
cb_ = 0;
baton_ = 0;
}
+
+private:
+ Callback cb_;
+ void* baton_;
};
-
-
+
template <class T>
class IntrusiveSharingPtr;
@@ -638,11 +642,9 @@ public:
imp::shared_count(-1)
{
}
-
- ~ReferenceCountedBaseVirtual() override
- {
- }
-
+
+ ~ReferenceCountedBaseVirtual() override = default;
+
void on_zero_shared() override;
};
@@ -715,7 +717,7 @@ public:
// those would be builds for release. But for debug and release builds
// that are for development, we NULL out the pointers to catch potential
// issues.
- ptr_ = NULL;
+ ptr_ = nullptr;
#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
}
@@ -753,7 +755,7 @@ public:
}
void
- reset(T* ptr = NULL)
+ reset(T* ptr = nullptr)
{
IntrusiveSharingPtr(ptr).swap(*this);
}
@@ -792,7 +794,7 @@ private:
if (ptr_)
{
#if defined (ENABLE_SP_LOGGING)
- track_sp (this, NULL, ptr_->use_count() - 1);
+ track_sp (this, nullptr, ptr_->use_count() - 1);
#endif
ptr_->release_shared();
}
More information about the lldb-commits
mailing list