From ecf34922f0c6cadd81c7c3ebf3dee2adac0199f0 Mon Sep 17 00:00:00 2001 From: Eugene Zelenko Date: Fri, 30 Oct 2015 00:04:20 +0000 Subject: [PATCH] Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/Symbol; other minor fixes. llvm-svn: 251673 --- lldb/include/lldb/Symbol/Block.h | 28 ++++---- lldb/include/lldb/Symbol/ClangASTContext.h | 41 ++++++------ lldb/include/lldb/Symbol/ClangASTImporter.h | 22 +++++-- .../Symbol/ClangExternalASTSourceCallbacks.h | 24 ++++--- .../Symbol/ClangExternalASTSourceCommon.h | 14 ++-- lldb/include/lldb/Symbol/CompilerType.h | 60 +++++++++-------- lldb/include/lldb/Symbol/GoASTContext.h | 18 +++-- lldb/include/lldb/Symbol/LineTable.h | 19 +++--- lldb/include/lldb/Symbol/ObjectContainer.h | 13 ++-- lldb/include/lldb/Symbol/SymbolContext.h | 65 ++++++++++--------- lldb/include/lldb/Symbol/SymbolContextScope.h | 13 ++-- lldb/include/lldb/Symbol/UnwindPlan.h | 40 +++++++----- 12 files changed, 196 insertions(+), 161 deletions(-) diff --git a/lldb/include/lldb/Symbol/Block.h b/lldb/include/lldb/Symbol/Block.h index 47695007dc00..6c0793dda80f 100644 --- a/lldb/include/lldb/Symbol/Block.h +++ b/lldb/include/lldb/Symbol/Block.h @@ -10,6 +10,12 @@ #ifndef liblldb_Block_h_ #define liblldb_Block_h_ +// C Includes +// C++ Includes +#include + +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/AddressRange.h" #include "lldb/Core/RangeMap.h" @@ -209,7 +215,7 @@ public: /// Get the parent block. /// /// @return - /// The parent block pointer, or NULL if this block has no + /// The parent block pointer, or nullptr if this block has no /// parent. //------------------------------------------------------------------ Block * @@ -221,7 +227,7 @@ public: /// @return /// If this block contains inlined function info, it will return /// this block, else parent blocks will be searched to see if - /// any contain this block. NULL will be returned if this block + /// any contain this block. nullptr will be returned if this block /// nor any parent blocks are inlined function blocks. //------------------------------------------------------------------ Block * @@ -231,7 +237,7 @@ public: /// Get the inlined parent block for this block. /// /// @return - /// The parent block pointer, or NULL if this block has no + /// The parent block pointer, or nullptr if this block has no /// parent. //------------------------------------------------------------------ Block * @@ -241,7 +247,7 @@ public: /// Get the sibling block for this block. /// /// @return - /// The sibling block pointer, or NULL if this block has no + /// The sibling block pointer, or nullptr if this block has no /// sibling. //------------------------------------------------------------------ Block * @@ -251,15 +257,13 @@ public: /// Get the first child block. /// /// @return - /// The first child block pointer, or NULL if this block has no + /// The first child block pointer, or nullptr if this block has no /// children. //------------------------------------------------------------------ Block * GetFirstChild () const { - if (m_children.empty()) - return NULL; - return m_children.front().get(); + return (m_children.empty() ? nullptr : m_children.front().get()); } //------------------------------------------------------------------ @@ -346,7 +350,7 @@ public: /// Get const accessor for any inlined function information. /// /// @return - /// A const pointer to any inlined function information, or NULL + /// A const pointer to any inlined function information, or nullptr /// if this is a regular block. //------------------------------------------------------------------ const InlineFunctionInfo* @@ -375,16 +379,16 @@ public: /// /// @param[in] name /// The method name for the inlined function. This value should - /// not be NULL. + /// not be nullptr. /// /// @param[in] mangled /// The mangled method name for the inlined function. This can - /// be NULL if there is no mangled name for an inlined function + /// be nullptr if there is no mangled name for an inlined function /// or if the name is the same as \a name. /// /// @param[in] decl_ptr /// A optional pointer to declaration information for the - /// inlined function information. This value can be NULL to + /// inlined function information. This value can be nullptr to /// indicate that no declaration information is available. /// /// @param[in] call_decl_ptr diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index f0c7626848e6..9637a405bac0 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -14,19 +14,22 @@ #include // C++ Includes +#include #include +#include +#include +#include #include #include #include // Other libraries and framework includes -#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" - #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" #include "clang/AST/TemplateBase.h" // Project includes +#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "lldb/lldb-enumerations.h" #include "lldb/Core/ClangForward.h" #include "lldb/Core/ConstString.h" @@ -54,7 +57,7 @@ public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - ClangASTContext (const char *triple = NULL); + ClangASTContext(const char *triple = nullptr); ~ClangASTContext() override; @@ -301,12 +304,12 @@ public: bool omit_empty_base_classes); CompilerType - CreateRecordType (clang::DeclContext *decl_ctx, - lldb::AccessType access_type, - const char *name, - int kind, - lldb::LanguageType language, - ClangASTMetadata *metadata = NULL); + CreateRecordType(clang::DeclContext *decl_ctx, + lldb::AccessType access_type, + const char *name, + int kind, + lldb::LanguageType language, + ClangASTMetadata *metadata = nullptr); class TemplateParameterInfos { @@ -382,11 +385,11 @@ public: RecordHasFields (const clang::RecordDecl *record_decl); CompilerType - CreateObjCClass (const char *name, - clang::DeclContext *decl_ctx, - bool isForwardDecl, - bool isInternal, - ClangASTMetadata *metadata = NULL); + CreateObjCClass(const char *name, + clang::DeclContext *decl_ctx, + bool isForwardDecl, + bool isInternal, + ClangASTMetadata *metadata = nullptr); bool SetTagTypeKind (clang::QualType type, int kind) const; @@ -654,16 +657,16 @@ public: IsObjCObjectOrInterfaceType (const CompilerType& type); static bool - IsObjCObjectPointerType (const CompilerType& type, CompilerType *target_type = NULL); + IsObjCObjectPointerType(const CompilerType& type, CompilerType *target_type = nullptr); bool IsPolymorphicClass (lldb::opaque_compiler_type_t type) override; bool - IsPossibleDynamicType (lldb::opaque_compiler_type_t type, - CompilerType *target_type, // Can pass NULL - bool check_cplusplus, - bool check_objc) override; + IsPossibleDynamicType(lldb::opaque_compiler_type_t type, + CompilerType *target_type, // Can pass nullptr + bool check_cplusplus, + bool check_objc) override; bool IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override; diff --git a/lldb/include/lldb/Symbol/ClangASTImporter.h b/lldb/include/lldb/Symbol/ClangASTImporter.h index 8edf8047bba2..e5155023a105 100644 --- a/lldb/include/lldb/Symbol/ClangASTImporter.h +++ b/lldb/include/lldb/Symbol/ClangASTImporter.h @@ -10,13 +10,20 @@ #ifndef liblldb_ClangASTImporter_h_ #define liblldb_ClangASTImporter_h_ +// C Includes +// C++ Includes #include +#include #include +#include -#include "lldb/lldb-types.h" +// Other libraries and framework includes #include "clang/AST/ASTImporter.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemOptions.h" + +// Project includes +#include "lldb/lldb-types.h" #include "lldb/Symbol/CompilerDeclContext.h" namespace lldb_private { @@ -199,12 +206,13 @@ public: void ForgetDestination (clang::ASTContext *dst_ctx); void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx); + private: struct DeclOrigin { DeclOrigin () : - ctx(NULL), - decl(NULL) + ctx(nullptr), + decl(nullptr) { } @@ -230,7 +238,7 @@ private: bool Valid () { - return (ctx != NULL || decl != NULL); + return (ctx != nullptr || decl != nullptr); } clang::ASTContext *ctx; @@ -250,8 +258,8 @@ private: *source_ctx, master.m_file_manager, true /*minimal*/), - m_decls_to_deport(NULL), - m_decls_already_deported(NULL), + m_decls_to_deport(nullptr), + m_decls_already_deported(nullptr), m_master(master), m_source_ctx(source_ctx) { @@ -297,7 +305,7 @@ private: m_minions (), m_origins (), m_namespace_maps (), - m_map_completer (NULL) + m_map_completer (nullptr) { } diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h index 9a083ac28905..bf2018fd48c4 100644 --- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -11,12 +11,11 @@ #define liblldb_ClangExternalASTSourceCallbacks_h_ // C Includes -// C++ Includes -#include -#include #include +// C++ Includes // Other libraries and framework includes +#include "llvm/ADT/DenseMap.h" #include "clang/AST/CharUnits.h" // Project includes @@ -30,7 +29,6 @@ namespace lldb_private { class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon { public: - typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *); typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *); typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl *results); @@ -62,7 +60,7 @@ public: { // This method only needs to be implemented if the AST source ever // passes back decl sets as VisibleDeclaration objects. - return 0; + return nullptr; } clang::Stmt * @@ -71,7 +69,7 @@ public: // This operation is meant to be used via a LazyOffsetPtr. It only // needs to be implemented if the AST source uses methods like // FunctionDecl::setLazyBody when building decls. - return 0; + return nullptr; } clang::Selector @@ -91,13 +89,12 @@ public: clang::CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override { - return NULL; + return nullptr; } virtual void MaterializeVisibleDecls (const clang::DeclContext *decl_ctx) { - return; } bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override; @@ -110,6 +107,7 @@ public: llvm::DenseMap &FieldOffsets, llvm::DenseMap &BaseOffsets, llvm::DenseMap &VirtualBaseOffsets) override; + void SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback, CompleteObjCInterfaceDeclCallback objc_decl_callback, @@ -129,10 +127,10 @@ public: { if (callback_baton == m_callback_baton) { - m_callback_tag_decl = NULL; - m_callback_objc_decl = NULL; - m_callback_find_by_name = NULL; - m_callback_layout_record_type = NULL; + m_callback_tag_decl = nullptr; + m_callback_objc_decl = nullptr; + m_callback_find_by_name = nullptr; + m_callback_layout_record_type = nullptr; } } @@ -149,4 +147,4 @@ protected: } // namespace lldb_private -#endif // liblldb_ClangExternalASTSourceCallbacks_h_ +#endif // liblldb_ClangExternalASTSourceCallbacks_h_ diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h index 21684baaf5ad..711be42c15fb 100644 --- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h +++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h @@ -20,6 +20,7 @@ // file. So we have to define NDEBUG when including clang headers to avoid any // mismatches. This is covered by rdar://problem/8691220 +// C Includes #if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF) #define LLDB_DEFINED_NDEBUG_FOR_CLANG #define NDEBUG @@ -27,8 +28,6 @@ #include #endif -#include "clang/AST/ExternalASTSource.h" - #ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG #undef NDEBUG #undef LLDB_DEFINED_NDEBUG_FOR_CLANG @@ -36,6 +35,11 @@ #include #endif +// C++ Includes +// Other libraries and framework includes +#include "clang/AST/ExternalASTSource.h" + +// Project includes #include "lldb/lldb-defines.h" #include "lldb/lldb-enumerations.h" #include "lldb/Core/dwarf.h" @@ -124,7 +128,6 @@ public: return lldb::eLanguageTypeC_plus_plus; } return lldb::eLanguageTypeUnknown; - } const char * @@ -138,7 +141,7 @@ public: return "this"; } else - return NULL; + return nullptr; } bool @@ -156,12 +159,12 @@ private: lldb::user_id_t m_user_id; uint64_t m_isa_ptr; }; + bool m_union_is_user_id : 1, m_union_is_isa_ptr : 1, m_has_object_ptr : 1, m_is_self : 1, m_is_dynamic_cxx : 1; - }; class ClangExternalASTSourceCommon : public clang::ExternalASTSource @@ -176,6 +179,7 @@ public: static ClangExternalASTSourceCommon * Lookup(clang::ExternalASTSource *source); + private: typedef llvm::DenseMap MetadataMap; diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 1657118b4211..7cb9e48369bb 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -10,9 +10,14 @@ #ifndef liblldb_CompilerType_h_ #define liblldb_CompilerType_h_ +// C Includes +// C++ Includes +#include #include #include -#include + +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/ClangForward.h" @@ -44,8 +49,8 @@ public: } CompilerType () : - m_type (0), - m_type_system (0) + m_type (nullptr), + m_type_system (nullptr) { } @@ -62,7 +67,6 @@ public: m_type_system = rhs.m_type_system; return *this; } - //---------------------------------------------------------------------- // Tests @@ -70,7 +74,7 @@ public: explicit operator bool () const { - return m_type != NULL && m_type_system != NULL; + return m_type != nullptr && m_type_system != nullptr; } bool @@ -84,7 +88,7 @@ public: bool IsValid () const { - return m_type != NULL && m_type_system != NULL; + return m_type != nullptr && m_type_system != nullptr; } bool @@ -124,7 +128,7 @@ public: IsFloatingPointType (uint32_t &count, bool &is_complex) const; bool - IsFunctionType (bool *is_variadic_ptr = NULL) const; + IsFunctionType(bool *is_variadic_ptr = nullptr) const; uint32_t IsHomogeneousAggregate (CompilerType* base_type_ptr) const; @@ -148,16 +152,15 @@ public: IsPolymorphicClass () const; bool - IsPossibleCPlusPlusDynamicType (CompilerType *target_type = NULL) const + IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const { return IsPossibleDynamicType (target_type, true, false); } bool - IsPossibleDynamicType (CompilerType *target_type, // Can pass NULL - bool check_cplusplus, - bool check_objc) const; - + IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr + bool check_cplusplus, + bool check_objc) const; bool IsPointerToScalarType () const; @@ -166,13 +169,13 @@ public: IsRuntimeGeneratedType () const; bool - IsPointerType (CompilerType *pointee_type = NULL) const; + IsPointerType(CompilerType *pointee_type = nullptr) const; bool - IsPointerOrReferenceType (CompilerType *pointee_type = NULL) const; + IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const; bool - IsReferenceType (CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const; + IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const; bool IsScalarType () const; @@ -220,7 +223,7 @@ public: GetDisplayTypeName () const; uint32_t - GetTypeInfo (CompilerType *pointee_or_element_compiler_type = NULL) const; + GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const; lldb::LanguageType GetMinimumLanguage (); @@ -236,6 +239,7 @@ public: void SetCompilerType (TypeSystem* type_system, lldb::opaque_compiler_type_t type); + void SetCompilerType (clang::ASTContext *ast, clang::QualType qual_type); @@ -247,7 +251,7 @@ public: //---------------------------------------------------------------------- CompilerType - GetArrayElementType (uint64_t *stride = nullptr) const; + GetArrayElementType(uint64_t *stride = nullptr) const; CompilerType GetCanonicalType () const; @@ -378,6 +382,7 @@ public: static lldb::BasicType GetBasicTypeEnumeration (const ConstString &name); + //---------------------------------------------------------------------- // If this type is an enumeration, iterate through all of its enumerators // using a callback. If the callback returns true, keep iterating, else @@ -387,6 +392,7 @@ public: ForEachEnumerator (std::function const &callback) const; + uint32_t GetNumFields () const; @@ -412,11 +418,11 @@ public: uint32_t *bit_offset_ptr) const; uint32_t - GetIndexOfFieldWithName (const char* name, - CompilerType* field_compiler_type = NULL, - uint64_t *bit_offset_ptr = NULL, - uint32_t *bitfield_bit_size_ptr = NULL, - bool *is_bitfield_ptr = NULL) const; + GetIndexOfFieldWithName(const char* name, + CompilerType* field_compiler_type = nullptr, + uint64_t *bit_offset_ptr = nullptr, + uint32_t *bitfield_bit_size_ptr = nullptr, + bool *is_bitfield_ptr = nullptr) const; CompilerType GetChildCompilerTypeAtIndex (ExecutionContext *exe_ctx, @@ -475,6 +481,7 @@ public: ConvertStringToFloatValue (const char *s, uint8_t *dst, size_t dst_size) const; + //---------------------------------------------------------------------- // Dumping types //---------------------------------------------------------------------- @@ -540,19 +547,18 @@ public: void Clear() { - m_type = NULL; - m_type_system = NULL; + m_type = nullptr; + m_type_system = nullptr; } + private: lldb::opaque_compiler_type_t m_type; TypeSystem *m_type_system; - }; bool operator == (const CompilerType &lhs, const CompilerType &rhs); bool operator != (const CompilerType &lhs, const CompilerType &rhs); - } // namespace lldb_private -#endif // #ifndef liblldb_CompilerType_h_ +#endif // liblldb_CompilerType_h_ diff --git a/lldb/include/lldb/Symbol/GoASTContext.h b/lldb/include/lldb/Symbol/GoASTContext.h index 3fb1a02e397e..fb39de32d42d 100644 --- a/lldb/include/lldb/Symbol/GoASTContext.h +++ b/lldb/include/lldb/Symbol/GoASTContext.h @@ -13,6 +13,10 @@ // C Includes // C++ Includes #include +#include +#include +#include +#include // Other libraries and framework includes // Project includes @@ -165,7 +169,7 @@ class GoASTContext : public TypeSystem bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override; - bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = NULL) override; + bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = nullptr) override; size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override; @@ -176,10 +180,10 @@ class GoASTContext : public TypeSystem bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override; bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, - CompilerType *target_type, // Can pass NULL - bool check_cplusplus, bool check_objc) override; + CompilerType *target_type, // Can pass nullptr + bool check_cplusplus, bool check_objc) override; - bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = NULL) override; + bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override; bool IsScalarType(lldb::opaque_compiler_type_t type) override; @@ -205,7 +209,8 @@ class GoASTContext : public TypeSystem ConstString GetTypeName(lldb::opaque_compiler_type_t type) override; - uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type = NULL) override; + uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, + CompilerType *pointee_or_element_compiler_type = nullptr) override; lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override; @@ -346,7 +351,8 @@ class GoASTContext : public TypeSystem // TODO: Determine if these methods should move to ClangASTContext. //---------------------------------------------------------------------- - bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = NULL) override; + bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, + CompilerType *pointee_type = nullptr) override; unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override; diff --git a/lldb/include/lldb/Symbol/LineTable.h b/lldb/include/lldb/Symbol/LineTable.h index 7cc41b17d521..cbad9bf590c2 100644 --- a/lldb/include/lldb/Symbol/LineTable.h +++ b/lldb/include/lldb/Symbol/LineTable.h @@ -10,8 +10,12 @@ #ifndef liblldb_LineTable_h_ #define liblldb_LineTable_h_ +// C Includes +// C++ Includes #include +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Core/ModuleChild.h" @@ -30,7 +34,7 @@ public: LineSequence (); virtual - ~LineSequence() {} + ~LineSequence() = default; virtual void Clear() = 0; @@ -143,14 +147,14 @@ public: /// /// @param[out] index_ptr /// A pointer to a 32 bit integer that will get the actual line - /// entry index if it is not NULL. + /// entry index if it is not nullptr. /// /// @return /// Returns \b true if \a so_addr is contained in a line entry /// in this line table, \b false otherwise. //------------------------------------------------------------------ bool - FindLineEntryByAddress (const Address &so_addr, LineEntry& line_entry, uint32_t *index_ptr = NULL); + FindLineEntryByAddress(const Address &so_addr, LineEntry& line_entry, uint32_t *index_ptr = nullptr); //------------------------------------------------------------------ /// Find a line entry index that has a matching file index and @@ -269,7 +273,6 @@ public: LinkLineTable (const FileRangeMap &file_range_map); protected: - struct Entry { Entry () : @@ -348,6 +351,7 @@ protected: public: LessThanBinaryPredicate(LineTable *line_table); bool operator() (const LineTable::Entry&, const LineTable::Entry&) const; + protected: LineTable *m_line_table; }; @@ -395,12 +399,9 @@ protected: class LineSequenceImpl : public LineSequence { public: - LineSequenceImpl() : - LineSequence() - {} + LineSequenceImpl() = default; - ~LineSequenceImpl() override - {} + ~LineSequenceImpl() override = default; void Clear() override; diff --git a/lldb/include/lldb/Symbol/ObjectContainer.h b/lldb/include/lldb/Symbol/ObjectContainer.h index baacc136eafe..eeda1c4ae19d 100644 --- a/lldb/include/lldb/Symbol/ObjectContainer.h +++ b/lldb/include/lldb/Symbol/ObjectContainer.h @@ -14,7 +14,6 @@ // C++ Includes // Other libraries and framework includes // Project includes - #include "lldb/lldb-private.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Host/FileSpec.h" @@ -71,9 +70,7 @@ public: /// The destructor is virtual since this class is designed to be /// inherited from by the plug-in instance. //------------------------------------------------------------------ - ~ObjectContainer() override - { - } + ~ObjectContainer() override = default; //------------------------------------------------------------------ /// Dump a description of this object to a Stream. @@ -187,7 +184,7 @@ public: /// /// @return /// Returns a pointer to the object file of the requested \a - /// arch and optional \a name. Returns NULL of no such object + /// arch and optional \a name. Returns nullptr of no such object /// file exists in the container. //------------------------------------------------------------------ virtual lldb::ObjectFileSP @@ -202,19 +199,19 @@ public: virtual ObjectFile * GetObjectFileAtIndex (uint32_t object_idx) { - return NULL; + return nullptr; } virtual ObjectContainer * GetObjectContainerAtIndex (uint32_t object_idx) { - return NULL; + return nullptr; } virtual const char * GetObjectNameAtIndex (uint32_t object_idx) const { - return NULL; + return nullptr; } protected: diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 6fb845e7882f..04b1872983f3 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -7,12 +7,17 @@ // //===----------------------------------------------------------------------===// - #ifndef liblldb_SymbolContext_h_ #define liblldb_SymbolContext_h_ +// C Includes +// C++ Includes +#include +#include #include +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" #include "lldb/Core/Mangled.h" @@ -22,6 +27,7 @@ namespace lldb_private { class SymbolContextScope; + //---------------------------------------------------------------------- /// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" /// @brief Defines a symbol context baton that can be handed other debug @@ -36,11 +42,10 @@ class SymbolContextScope; class SymbolContext { public: - //------------------------------------------------------------------ /// Default constructor. /// - /// Initialize all pointer members to NULL and all struct members + /// Initialize all pointer members to nullptr and all struct members /// to their default state. //------------------------------------------------------------------ SymbolContext (); @@ -81,24 +86,23 @@ public: /// A Symbol pointer to the symbol for this context. //------------------------------------------------------------------ explicit - SymbolContext (const lldb::TargetSP &target_sp, - const lldb::ModuleSP &module_sp, - CompileUnit *comp_unit = NULL, - Function *function = NULL, - Block *block = NULL, - LineEntry *line_entry = NULL, - Symbol *symbol = NULL); + SymbolContext(const lldb::TargetSP &target_sp, + const lldb::ModuleSP &module_sp, + CompileUnit *comp_unit = nullptr, + Function *function = nullptr, + Block *block = nullptr, + LineEntry *line_entry = nullptr, + Symbol *symbol = nullptr); // This version sets the target to a NULL TargetSP if you don't know it. explicit - SymbolContext (const lldb::ModuleSP &module_sp, - CompileUnit *comp_unit = NULL, - Function *function = NULL, - Block *block = NULL, - LineEntry *line_entry = NULL, - Symbol *symbol = NULL); + SymbolContext(const lldb::ModuleSP &module_sp, + CompileUnit *comp_unit = nullptr, + Function *function = nullptr, + Block *block = nullptr, + LineEntry *line_entry = nullptr, + Symbol *symbol = nullptr); - ~SymbolContext (); //------------------------------------------------------------------ /// Copy constructor /// @@ -109,6 +113,8 @@ public: //------------------------------------------------------------------ SymbolContext (const SymbolContext& rhs); + ~SymbolContext (); + //------------------------------------------------------------------ /// Assignment operator. /// @@ -127,7 +133,7 @@ public: //------------------------------------------------------------------ /// Clear the object's state. /// - /// Resets all pointer members to NULL, and clears any class objects + /// Resets all pointer members to nullptr, and clears any class objects /// to their default state. //------------------------------------------------------------------ void @@ -203,14 +209,14 @@ public: /// /// Address range priority is as follows: /// - line_entry address range if line_entry is valid and eSymbolContextLineEntry is set in \a scope - /// - block address range if block is not NULL and eSymbolContextBlock is set in \a scope - /// - function address range if function is not NULL and eSymbolContextFunction is set in \a scope - /// - symbol address range if symbol is not NULL and eSymbolContextSymbol is set in \a scope + /// - block address range if block is not nullptr and eSymbolContextBlock is set in \a scope + /// - function address range if function is not nullptr and eSymbolContextFunction is set in \a scope + /// - symbol address range if symbol is not nullptr and eSymbolContextSymbol is set in \a scope /// /// @param[in] scope /// A mask of symbol context bits telling this function which /// address ranges it can use when trying to extract one from - /// the valid (non-NULL) symbol context classes. + /// the valid (non-nullptr) symbol context classes. /// /// @param[in] range_idx /// The address range index to grab. Since many functions and @@ -239,7 +245,6 @@ public: bool use_inline_block_range, AddressRange &range) const; - void GetDescription(Stream *s, lldb::DescriptionLevel level, @@ -248,7 +253,6 @@ public: uint32_t GetResolvedMask () const; - //------------------------------------------------------------------ /// Find a block that defines the function represented by this /// symbol context. @@ -268,12 +272,11 @@ public: /// /// @return /// The block object pointer that defines the function that is - /// represented by this symbol context object, NULL otherwise. + /// represented by this symbol context object, nullptr otherwise. //------------------------------------------------------------------ Block * GetFunctionBlock (); - //------------------------------------------------------------------ /// If this symbol context represents a function that is a method, /// return true and provide information about the method. @@ -304,7 +307,8 @@ public: /// //------------------------------------------------------------------ void - SortTypeList(TypeMap &type_map, TypeList &type_list) const; + SortTypeList(TypeMap &type_map, TypeList &type_list) const; + //------------------------------------------------------------------ /// Find a name of the innermost function for the symbol context. /// @@ -322,7 +326,6 @@ public: ConstString GetFunctionName (Mangled::NamePreference preference = Mangled::ePreferDemangled) const; - //------------------------------------------------------------------ /// Get the line entry that corresponds to the function. /// @@ -384,7 +387,6 @@ public: Variable * variable; ///< The global variable matching the given query }; - class SymbolContextSpecifier { public: @@ -434,7 +436,6 @@ private: std::string m_class_name; std::unique_ptr m_address_range_ap; uint32_t m_type; // Or'ed bits from SpecificationType - }; //---------------------------------------------------------------------- @@ -486,6 +487,7 @@ public: uint32_t AppendIfUnique (const SymbolContextList& sc_list, bool merge_symbol_into_function); + //------------------------------------------------------------------ /// Clear the object's state. /// @@ -565,6 +567,7 @@ public: bool RemoveContextAtIndex (size_t idx); + //------------------------------------------------------------------ /// Get accessor for a symbol context list size. /// @@ -607,4 +610,4 @@ bool operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs); } // namespace lldb_private -#endif // liblldb_SymbolContext_h_ +#endif // liblldb_SymbolContext_h_ diff --git a/lldb/include/lldb/Symbol/SymbolContextScope.h b/lldb/include/lldb/Symbol/SymbolContextScope.h index a02b4523a4c0..212d8e6df233 100644 --- a/lldb/include/lldb/Symbol/SymbolContextScope.h +++ b/lldb/include/lldb/Symbol/SymbolContextScope.h @@ -72,7 +72,7 @@ class SymbolContextScope { public: virtual - ~SymbolContextScope () {} + ~SymbolContextScope() = default; //------------------------------------------------------------------ /// Reconstruct the object's symbol context into \a sc. @@ -87,7 +87,6 @@ public: virtual void CalculateSymbolContext (SymbolContext *sc) = 0; - virtual lldb::ModuleSP CalculateSymbolContextModule () { @@ -97,25 +96,25 @@ public: virtual CompileUnit * CalculateSymbolContextCompileUnit () { - return NULL; + return nullptr; } virtual Function * CalculateSymbolContextFunction () { - return NULL; + return nullptr; } virtual Block * CalculateSymbolContextBlock () { - return NULL; + return nullptr; } virtual Symbol * CalculateSymbolContextSymbol () { - return NULL; + return nullptr; } //------------------------------------------------------------------ @@ -134,4 +133,4 @@ public: } // namespace lldb_private -#endif // liblldb_SymbolContextScope_h_ +#endif // liblldb_SymbolContextScope_h_ diff --git a/lldb/include/lldb/Symbol/UnwindPlan.h b/lldb/include/lldb/Symbol/UnwindPlan.h index bfc008a5b6bc..71100138413d 100644 --- a/lldb/include/lldb/Symbol/UnwindPlan.h +++ b/lldb/include/lldb/Symbol/UnwindPlan.h @@ -1,14 +1,28 @@ +//===-- UnwindPlan.h --------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + #ifndef liblldb_UnwindPlan_h #define liblldb_UnwindPlan_h +// C Includes +// C++ Includes +#include +#include +#include + +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/AddressRange.h" #include "lldb/Core/Stream.h" #include "lldb/Core/ConstString.h" -#include -#include - namespace lldb_private { // The UnwindPlan object specifies how to unwind out of a function - where @@ -38,13 +52,11 @@ namespace lldb_private { class UnwindPlan { public: - class Row { public: class RegisterLocation { public: - enum RestoreType { unspecified, // not specified, we may be able to assume this @@ -187,7 +199,7 @@ public: } else { - *opcodes = NULL; + *opcodes = nullptr; len = 0; } } @@ -203,7 +215,7 @@ public: { if (m_type == atDWARFExpression || m_type == isDWARFExpression) return m_location.expr.opcodes; - return NULL; + return nullptr; } int @@ -240,7 +252,6 @@ public: class CFAValue { public: - enum ValueType { unspecified, // not specified @@ -361,7 +372,7 @@ public: } else { - *opcodes = NULL; + *opcodes = nullptr; len = 0; } } @@ -371,7 +382,7 @@ public: { if (m_type == isDWARFExpression) return m_value.expr.opcodes; - return NULL; + return nullptr; } int @@ -488,7 +499,6 @@ public: }; // class Row public: - typedef std::shared_ptr RowSP; UnwindPlan (lldb::RegisterKind reg_kind) : @@ -520,9 +530,7 @@ public: m_row_list.emplace_back (new Row (*row_sp)); } - ~UnwindPlan () - { - } + ~UnwindPlan() = default; void Dump (Stream& s, Thread* thread, lldb::addr_t base_addr) const; @@ -676,8 +684,6 @@ public: } private: - - typedef std::vector collection; collection m_row_list; AddressRange m_plan_valid_address_range; @@ -697,4 +703,4 @@ private: } // namespace lldb_private -#endif //liblldb_UnwindPlan_h +#endif // liblldb_UnwindPlan_h