Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/Symbol; other minor fixes.

llvm-svn: 251673
This commit is contained in:
Eugene Zelenko 2015-10-30 00:04:20 +00:00
parent e46bd74147
commit ecf34922f0
12 changed files with 196 additions and 161 deletions

View File

@ -10,6 +10,12 @@
#ifndef liblldb_Block_h_ #ifndef liblldb_Block_h_
#define liblldb_Block_h_ #define liblldb_Block_h_
// C Includes
// C++ Includes
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h" #include "lldb/Core/AddressRange.h"
#include "lldb/Core/RangeMap.h" #include "lldb/Core/RangeMap.h"
@ -209,7 +215,7 @@ public:
/// Get the parent block. /// Get the parent block.
/// ///
/// @return /// @return
/// The parent block pointer, or NULL if this block has no /// The parent block pointer, or nullptr if this block has no
/// parent. /// parent.
//------------------------------------------------------------------ //------------------------------------------------------------------
Block * Block *
@ -221,7 +227,7 @@ public:
/// @return /// @return
/// If this block contains inlined function info, it will return /// If this block contains inlined function info, it will return
/// this block, else parent blocks will be searched to see if /// 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. /// nor any parent blocks are inlined function blocks.
//------------------------------------------------------------------ //------------------------------------------------------------------
Block * Block *
@ -231,7 +237,7 @@ public:
/// Get the inlined parent block for this block. /// Get the inlined parent block for this block.
/// ///
/// @return /// @return
/// The parent block pointer, or NULL if this block has no /// The parent block pointer, or nullptr if this block has no
/// parent. /// parent.
//------------------------------------------------------------------ //------------------------------------------------------------------
Block * Block *
@ -241,7 +247,7 @@ public:
/// Get the sibling block for this block. /// Get the sibling block for this block.
/// ///
/// @return /// @return
/// The sibling block pointer, or NULL if this block has no /// The sibling block pointer, or nullptr if this block has no
/// sibling. /// sibling.
//------------------------------------------------------------------ //------------------------------------------------------------------
Block * Block *
@ -251,15 +257,13 @@ public:
/// Get the first child block. /// Get the first child block.
/// ///
/// @return /// @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. /// children.
//------------------------------------------------------------------ //------------------------------------------------------------------
Block * Block *
GetFirstChild () const GetFirstChild () const
{ {
if (m_children.empty()) return (m_children.empty() ? nullptr : m_children.front().get());
return NULL;
return m_children.front().get();
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -346,7 +350,7 @@ public:
/// Get const accessor for any inlined function information. /// Get const accessor for any inlined function information.
/// ///
/// @return /// @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. /// if this is a regular block.
//------------------------------------------------------------------ //------------------------------------------------------------------
const InlineFunctionInfo* const InlineFunctionInfo*
@ -375,16 +379,16 @@ public:
/// ///
/// @param[in] name /// @param[in] name
/// The method name for the inlined function. This value should /// The method name for the inlined function. This value should
/// not be NULL. /// not be nullptr.
/// ///
/// @param[in] mangled /// @param[in] mangled
/// The mangled method name for the inlined function. This can /// 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. /// or if the name is the same as \a name.
/// ///
/// @param[in] decl_ptr /// @param[in] decl_ptr
/// A optional pointer to declaration information for the /// 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. /// indicate that no declaration information is available.
/// ///
/// @param[in] call_decl_ptr /// @param[in] call_decl_ptr

View File

@ -14,19 +14,22 @@
#include <stdint.h> #include <stdint.h>
// C++ Includes // C++ Includes
#include <functional>
#include <initializer_list> #include <initializer_list>
#include <map>
#include <memory>
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>
#include <utility> #include <utility>
// Other libraries and framework includes // Other libraries and framework includes
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h" #include "clang/AST/ASTContext.h"
#include "clang/AST/TemplateBase.h" #include "clang/AST/TemplateBase.h"
// Project includes // Project includes
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "lldb/lldb-enumerations.h" #include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h" #include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h" #include "lldb/Core/ConstString.h"
@ -54,7 +57,7 @@ public:
//------------------------------------------------------------------ //------------------------------------------------------------------
// Constructors and Destructors // Constructors and Destructors
//------------------------------------------------------------------ //------------------------------------------------------------------
ClangASTContext (const char *triple = NULL); ClangASTContext(const char *triple = nullptr);
~ClangASTContext() override; ~ClangASTContext() override;
@ -301,12 +304,12 @@ public:
bool omit_empty_base_classes); bool omit_empty_base_classes);
CompilerType CompilerType
CreateRecordType (clang::DeclContext *decl_ctx, CreateRecordType(clang::DeclContext *decl_ctx,
lldb::AccessType access_type, lldb::AccessType access_type,
const char *name, const char *name,
int kind, int kind,
lldb::LanguageType language, lldb::LanguageType language,
ClangASTMetadata *metadata = NULL); ClangASTMetadata *metadata = nullptr);
class TemplateParameterInfos class TemplateParameterInfos
{ {
@ -382,11 +385,11 @@ public:
RecordHasFields (const clang::RecordDecl *record_decl); RecordHasFields (const clang::RecordDecl *record_decl);
CompilerType CompilerType
CreateObjCClass (const char *name, CreateObjCClass(const char *name,
clang::DeclContext *decl_ctx, clang::DeclContext *decl_ctx,
bool isForwardDecl, bool isForwardDecl,
bool isInternal, bool isInternal,
ClangASTMetadata *metadata = NULL); ClangASTMetadata *metadata = nullptr);
bool bool
SetTagTypeKind (clang::QualType type, int kind) const; SetTagTypeKind (clang::QualType type, int kind) const;
@ -654,16 +657,16 @@ public:
IsObjCObjectOrInterfaceType (const CompilerType& type); IsObjCObjectOrInterfaceType (const CompilerType& type);
static bool static bool
IsObjCObjectPointerType (const CompilerType& type, CompilerType *target_type = NULL); IsObjCObjectPointerType(const CompilerType& type, CompilerType *target_type = nullptr);
bool bool
IsPolymorphicClass (lldb::opaque_compiler_type_t type) override; IsPolymorphicClass (lldb::opaque_compiler_type_t type) override;
bool bool
IsPossibleDynamicType (lldb::opaque_compiler_type_t type, IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *target_type, // Can pass NULL CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_cplusplus,
bool check_objc) override; bool check_objc) override;
bool bool
IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override; IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override;

View File

@ -10,13 +10,20 @@
#ifndef liblldb_ClangASTImporter_h_ #ifndef liblldb_ClangASTImporter_h_
#define liblldb_ClangASTImporter_h_ #define liblldb_ClangASTImporter_h_
// C Includes
// C++ Includes
#include <map> #include <map>
#include <memory>
#include <set> #include <set>
#include <vector>
#include "lldb/lldb-types.h" // Other libraries and framework includes
#include "clang/AST/ASTImporter.h" #include "clang/AST/ASTImporter.h"
#include "clang/Basic/FileManager.h" #include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/FileSystemOptions.h"
// Project includes
#include "lldb/lldb-types.h"
#include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/CompilerDeclContext.h"
namespace lldb_private { namespace lldb_private {
@ -199,12 +206,13 @@ public:
void ForgetDestination (clang::ASTContext *dst_ctx); void ForgetDestination (clang::ASTContext *dst_ctx);
void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx); void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
private: private:
struct DeclOrigin struct DeclOrigin
{ {
DeclOrigin () : DeclOrigin () :
ctx(NULL), ctx(nullptr),
decl(NULL) decl(nullptr)
{ {
} }
@ -230,7 +238,7 @@ private:
bool bool
Valid () Valid ()
{ {
return (ctx != NULL || decl != NULL); return (ctx != nullptr || decl != nullptr);
} }
clang::ASTContext *ctx; clang::ASTContext *ctx;
@ -250,8 +258,8 @@ private:
*source_ctx, *source_ctx,
master.m_file_manager, master.m_file_manager,
true /*minimal*/), true /*minimal*/),
m_decls_to_deport(NULL), m_decls_to_deport(nullptr),
m_decls_already_deported(NULL), m_decls_already_deported(nullptr),
m_master(master), m_master(master),
m_source_ctx(source_ctx) m_source_ctx(source_ctx)
{ {
@ -297,7 +305,7 @@ private:
m_minions (), m_minions (),
m_origins (), m_origins (),
m_namespace_maps (), m_namespace_maps (),
m_map_completer (NULL) m_map_completer (nullptr)
{ {
} }

View File

@ -11,12 +11,11 @@
#define liblldb_ClangExternalASTSourceCallbacks_h_ #define liblldb_ClangExternalASTSourceCallbacks_h_
// C Includes // C Includes
// C++ Includes
#include <string>
#include <vector>
#include <stdint.h> #include <stdint.h>
// C++ Includes
// Other libraries and framework includes // Other libraries and framework includes
#include "llvm/ADT/DenseMap.h"
#include "clang/AST/CharUnits.h" #include "clang/AST/CharUnits.h"
// Project includes // Project includes
@ -30,7 +29,6 @@ namespace lldb_private {
class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon
{ {
public: public:
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *); typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *); typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results); typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results);
@ -62,7 +60,7 @@ public:
{ {
// This method only needs to be implemented if the AST source ever // This method only needs to be implemented if the AST source ever
// passes back decl sets as VisibleDeclaration objects. // passes back decl sets as VisibleDeclaration objects.
return 0; return nullptr;
} }
clang::Stmt * clang::Stmt *
@ -71,7 +69,7 @@ public:
// This operation is meant to be used via a LazyOffsetPtr. It only // This operation is meant to be used via a LazyOffsetPtr. It only
// needs to be implemented if the AST source uses methods like // needs to be implemented if the AST source uses methods like
// FunctionDecl::setLazyBody when building decls. // FunctionDecl::setLazyBody when building decls.
return 0; return nullptr;
} }
clang::Selector clang::Selector
@ -91,13 +89,12 @@ public:
clang::CXXBaseSpecifier * clang::CXXBaseSpecifier *
GetExternalCXXBaseSpecifiers(uint64_t Offset) override GetExternalCXXBaseSpecifiers(uint64_t Offset) override
{ {
return NULL; return nullptr;
} }
virtual void virtual void
MaterializeVisibleDecls (const clang::DeclContext *decl_ctx) MaterializeVisibleDecls (const clang::DeclContext *decl_ctx)
{ {
return;
} }
bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override; bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
@ -110,6 +107,7 @@ public:
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets, llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets, llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override; llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
void void
SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback, SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback, CompleteObjCInterfaceDeclCallback objc_decl_callback,
@ -129,10 +127,10 @@ public:
{ {
if (callback_baton == m_callback_baton) if (callback_baton == m_callback_baton)
{ {
m_callback_tag_decl = NULL; m_callback_tag_decl = nullptr;
m_callback_objc_decl = NULL; m_callback_objc_decl = nullptr;
m_callback_find_by_name = NULL; m_callback_find_by_name = nullptr;
m_callback_layout_record_type = NULL; m_callback_layout_record_type = nullptr;
} }
} }
@ -149,4 +147,4 @@ protected:
} // namespace lldb_private } // namespace lldb_private
#endif // liblldb_ClangExternalASTSourceCallbacks_h_ #endif // liblldb_ClangExternalASTSourceCallbacks_h_

View File

@ -20,6 +20,7 @@
// file. So we have to define NDEBUG when including clang headers to avoid any // file. So we have to define NDEBUG when including clang headers to avoid any
// mismatches. This is covered by rdar://problem/8691220 // mismatches. This is covered by rdar://problem/8691220
// C Includes
#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF) #if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
#define LLDB_DEFINED_NDEBUG_FOR_CLANG #define LLDB_DEFINED_NDEBUG_FOR_CLANG
#define NDEBUG #define NDEBUG
@ -27,8 +28,6 @@
#include <assert.h> #include <assert.h>
#endif #endif
#include "clang/AST/ExternalASTSource.h"
#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG #ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
#undef NDEBUG #undef NDEBUG
#undef LLDB_DEFINED_NDEBUG_FOR_CLANG #undef LLDB_DEFINED_NDEBUG_FOR_CLANG
@ -36,6 +35,11 @@
#include <assert.h> #include <assert.h>
#endif #endif
// C++ Includes
// Other libraries and framework includes
#include "clang/AST/ExternalASTSource.h"
// Project includes
#include "lldb/lldb-defines.h" #include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h" #include "lldb/lldb-enumerations.h"
#include "lldb/Core/dwarf.h" #include "lldb/Core/dwarf.h"
@ -124,7 +128,6 @@ public:
return lldb::eLanguageTypeC_plus_plus; return lldb::eLanguageTypeC_plus_plus;
} }
return lldb::eLanguageTypeUnknown; return lldb::eLanguageTypeUnknown;
} }
const char * const char *
@ -138,7 +141,7 @@ public:
return "this"; return "this";
} }
else else
return NULL; return nullptr;
} }
bool bool
@ -156,12 +159,12 @@ private:
lldb::user_id_t m_user_id; lldb::user_id_t m_user_id;
uint64_t m_isa_ptr; uint64_t m_isa_ptr;
}; };
bool m_union_is_user_id : 1, bool m_union_is_user_id : 1,
m_union_is_isa_ptr : 1, m_union_is_isa_ptr : 1,
m_has_object_ptr : 1, m_has_object_ptr : 1,
m_is_self : 1, m_is_self : 1,
m_is_dynamic_cxx : 1; m_is_dynamic_cxx : 1;
}; };
class ClangExternalASTSourceCommon : public clang::ExternalASTSource class ClangExternalASTSourceCommon : public clang::ExternalASTSource
@ -176,6 +179,7 @@ public:
static ClangExternalASTSourceCommon * static ClangExternalASTSourceCommon *
Lookup(clang::ExternalASTSource *source); Lookup(clang::ExternalASTSource *source);
private: private:
typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap; typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;

View File

@ -10,9 +10,14 @@
#ifndef liblldb_CompilerType_h_ #ifndef liblldb_CompilerType_h_
#define liblldb_CompilerType_h_ #define liblldb_CompilerType_h_
// C Includes
// C++ Includes
#include <functional>
#include <string> #include <string>
#include <vector> #include <vector>
#include <functional>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h" #include "lldb/Core/ClangForward.h"
@ -44,8 +49,8 @@ public:
} }
CompilerType () : CompilerType () :
m_type (0), m_type (nullptr),
m_type_system (0) m_type_system (nullptr)
{ {
} }
@ -62,7 +67,6 @@ public:
m_type_system = rhs.m_type_system; m_type_system = rhs.m_type_system;
return *this; return *this;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Tests // Tests
@ -70,7 +74,7 @@ public:
explicit operator bool () const explicit operator bool () const
{ {
return m_type != NULL && m_type_system != NULL; return m_type != nullptr && m_type_system != nullptr;
} }
bool bool
@ -84,7 +88,7 @@ public:
bool bool
IsValid () const IsValid () const
{ {
return m_type != NULL && m_type_system != NULL; return m_type != nullptr && m_type_system != nullptr;
} }
bool bool
@ -124,7 +128,7 @@ public:
IsFloatingPointType (uint32_t &count, bool &is_complex) const; IsFloatingPointType (uint32_t &count, bool &is_complex) const;
bool bool
IsFunctionType (bool *is_variadic_ptr = NULL) const; IsFunctionType(bool *is_variadic_ptr = nullptr) const;
uint32_t uint32_t
IsHomogeneousAggregate (CompilerType* base_type_ptr) const; IsHomogeneousAggregate (CompilerType* base_type_ptr) const;
@ -148,16 +152,15 @@ public:
IsPolymorphicClass () const; IsPolymorphicClass () const;
bool bool
IsPossibleCPlusPlusDynamicType (CompilerType *target_type = NULL) const IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const
{ {
return IsPossibleDynamicType (target_type, true, false); return IsPossibleDynamicType (target_type, true, false);
} }
bool bool
IsPossibleDynamicType (CompilerType *target_type, // Can pass NULL IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_cplusplus,
bool check_objc) const; bool check_objc) const;
bool bool
IsPointerToScalarType () const; IsPointerToScalarType () const;
@ -166,13 +169,13 @@ public:
IsRuntimeGeneratedType () const; IsRuntimeGeneratedType () const;
bool bool
IsPointerType (CompilerType *pointee_type = NULL) const; IsPointerType(CompilerType *pointee_type = nullptr) const;
bool bool
IsPointerOrReferenceType (CompilerType *pointee_type = NULL) const; IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
bool bool
IsReferenceType (CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const; IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
bool bool
IsScalarType () const; IsScalarType () const;
@ -220,7 +223,7 @@ public:
GetDisplayTypeName () const; GetDisplayTypeName () const;
uint32_t uint32_t
GetTypeInfo (CompilerType *pointee_or_element_compiler_type = NULL) const; GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
lldb::LanguageType lldb::LanguageType
GetMinimumLanguage (); GetMinimumLanguage ();
@ -236,6 +239,7 @@ public:
void void
SetCompilerType (TypeSystem* type_system, lldb::opaque_compiler_type_t type); SetCompilerType (TypeSystem* type_system, lldb::opaque_compiler_type_t type);
void void
SetCompilerType (clang::ASTContext *ast, clang::QualType qual_type); SetCompilerType (clang::ASTContext *ast, clang::QualType qual_type);
@ -247,7 +251,7 @@ public:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
CompilerType CompilerType
GetArrayElementType (uint64_t *stride = nullptr) const; GetArrayElementType(uint64_t *stride = nullptr) const;
CompilerType CompilerType
GetCanonicalType () const; GetCanonicalType () const;
@ -378,6 +382,7 @@ public:
static lldb::BasicType static lldb::BasicType
GetBasicTypeEnumeration (const ConstString &name); GetBasicTypeEnumeration (const ConstString &name);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// If this type is an enumeration, iterate through all of its enumerators // If this type is an enumeration, iterate through all of its enumerators
// using a callback. If the callback returns true, keep iterating, else // using a callback. If the callback returns true, keep iterating, else
@ -387,6 +392,7 @@ public:
ForEachEnumerator (std::function <bool (const CompilerType &integer_type, ForEachEnumerator (std::function <bool (const CompilerType &integer_type,
const ConstString &name, const ConstString &name,
const llvm::APSInt &value)> const &callback) const; const llvm::APSInt &value)> const &callback) const;
uint32_t uint32_t
GetNumFields () const; GetNumFields () const;
@ -412,11 +418,11 @@ public:
uint32_t *bit_offset_ptr) const; uint32_t *bit_offset_ptr) const;
uint32_t uint32_t
GetIndexOfFieldWithName (const char* name, GetIndexOfFieldWithName(const char* name,
CompilerType* field_compiler_type = NULL, CompilerType* field_compiler_type = nullptr,
uint64_t *bit_offset_ptr = NULL, uint64_t *bit_offset_ptr = nullptr,
uint32_t *bitfield_bit_size_ptr = NULL, uint32_t *bitfield_bit_size_ptr = nullptr,
bool *is_bitfield_ptr = NULL) const; bool *is_bitfield_ptr = nullptr) const;
CompilerType CompilerType
GetChildCompilerTypeAtIndex (ExecutionContext *exe_ctx, GetChildCompilerTypeAtIndex (ExecutionContext *exe_ctx,
@ -475,6 +481,7 @@ public:
ConvertStringToFloatValue (const char *s, ConvertStringToFloatValue (const char *s,
uint8_t *dst, uint8_t *dst,
size_t dst_size) const; size_t dst_size) const;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Dumping types // Dumping types
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -540,19 +547,18 @@ public:
void void
Clear() Clear()
{ {
m_type = NULL; m_type = nullptr;
m_type_system = NULL; m_type_system = nullptr;
} }
private: private:
lldb::opaque_compiler_type_t m_type; lldb::opaque_compiler_type_t m_type;
TypeSystem *m_type_system; TypeSystem *m_type_system;
}; };
bool operator == (const CompilerType &lhs, const CompilerType &rhs); bool operator == (const CompilerType &lhs, const CompilerType &rhs);
bool operator != (const CompilerType &lhs, const CompilerType &rhs); bool operator != (const CompilerType &lhs, const CompilerType &rhs);
} // namespace lldb_private } // namespace lldb_private
#endif // #ifndef liblldb_CompilerType_h_ #endif // liblldb_CompilerType_h_

View File

@ -13,6 +13,10 @@
// C Includes // C Includes
// C++ Includes // C++ Includes
#include <map> #include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
// Other libraries and framework includes // Other libraries and framework includes
// Project 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 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; 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 IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override;
bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *target_type, // Can pass NULL CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_objc) override; 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; 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; 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; 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. // 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; unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;

View File

@ -10,8 +10,12 @@
#ifndef liblldb_LineTable_h_ #ifndef liblldb_LineTable_h_
#define liblldb_LineTable_h_ #define liblldb_LineTable_h_
// C Includes
// C++ Includes
#include <vector> #include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/LineEntry.h"
#include "lldb/Core/ModuleChild.h" #include "lldb/Core/ModuleChild.h"
@ -30,7 +34,7 @@ public:
LineSequence (); LineSequence ();
virtual virtual
~LineSequence() {} ~LineSequence() = default;
virtual void virtual void
Clear() = 0; Clear() = 0;
@ -143,14 +147,14 @@ public:
/// ///
/// @param[out] index_ptr /// @param[out] index_ptr
/// A pointer to a 32 bit integer that will get the actual line /// 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 /// @return
/// Returns \b true if \a so_addr is contained in a line entry /// Returns \b true if \a so_addr is contained in a line entry
/// in this line table, \b false otherwise. /// in this line table, \b false otherwise.
//------------------------------------------------------------------ //------------------------------------------------------------------
bool 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 /// Find a line entry index that has a matching file index and
@ -269,7 +273,6 @@ public:
LinkLineTable (const FileRangeMap &file_range_map); LinkLineTable (const FileRangeMap &file_range_map);
protected: protected:
struct Entry struct Entry
{ {
Entry () : Entry () :
@ -348,6 +351,7 @@ protected:
public: public:
LessThanBinaryPredicate(LineTable *line_table); LessThanBinaryPredicate(LineTable *line_table);
bool operator() (const LineTable::Entry&, const LineTable::Entry&) const; bool operator() (const LineTable::Entry&, const LineTable::Entry&) const;
protected: protected:
LineTable *m_line_table; LineTable *m_line_table;
}; };
@ -395,12 +399,9 @@ protected:
class LineSequenceImpl : public LineSequence class LineSequenceImpl : public LineSequence
{ {
public: public:
LineSequenceImpl() : LineSequenceImpl() = default;
LineSequence()
{}
~LineSequenceImpl() override ~LineSequenceImpl() override = default;
{}
void void
Clear() override; Clear() override;

View File

@ -14,7 +14,6 @@
// C++ Includes // C++ Includes
// Other libraries and framework includes // Other libraries and framework includes
// Project includes // Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/DataExtractor.h" #include "lldb/Core/DataExtractor.h"
#include "lldb/Host/FileSpec.h" #include "lldb/Host/FileSpec.h"
@ -71,9 +70,7 @@ public:
/// The destructor is virtual since this class is designed to be /// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance. /// inherited from by the plug-in instance.
//------------------------------------------------------------------ //------------------------------------------------------------------
~ObjectContainer() override ~ObjectContainer() override = default;
{
}
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Dump a description of this object to a Stream. /// Dump a description of this object to a Stream.
@ -187,7 +184,7 @@ public:
/// ///
/// @return /// @return
/// Returns a pointer to the object file of the requested \a /// 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. /// file exists in the container.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual lldb::ObjectFileSP virtual lldb::ObjectFileSP
@ -202,19 +199,19 @@ public:
virtual ObjectFile * virtual ObjectFile *
GetObjectFileAtIndex (uint32_t object_idx) GetObjectFileAtIndex (uint32_t object_idx)
{ {
return NULL; return nullptr;
} }
virtual ObjectContainer * virtual ObjectContainer *
GetObjectContainerAtIndex (uint32_t object_idx) GetObjectContainerAtIndex (uint32_t object_idx)
{ {
return NULL; return nullptr;
} }
virtual const char * virtual const char *
GetObjectNameAtIndex (uint32_t object_idx) const GetObjectNameAtIndex (uint32_t object_idx) const
{ {
return NULL; return nullptr;
} }
protected: protected:

View File

@ -7,12 +7,17 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef liblldb_SymbolContext_h_ #ifndef liblldb_SymbolContext_h_
#define liblldb_SymbolContext_h_ #define liblldb_SymbolContext_h_
// C Includes
// C++ Includes
#include <memory>
#include <string>
#include <vector> #include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/Address.h" #include "lldb/Core/Address.h"
#include "lldb/Core/Mangled.h" #include "lldb/Core/Mangled.h"
@ -22,6 +27,7 @@
namespace lldb_private { namespace lldb_private {
class SymbolContextScope; class SymbolContextScope;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
/// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" /// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h"
/// @brief Defines a symbol context baton that can be handed other debug /// @brief Defines a symbol context baton that can be handed other debug
@ -36,11 +42,10 @@ class SymbolContextScope;
class SymbolContext class SymbolContext
{ {
public: public:
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Default constructor. /// 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. /// to their default state.
//------------------------------------------------------------------ //------------------------------------------------------------------
SymbolContext (); SymbolContext ();
@ -81,24 +86,23 @@ public:
/// A Symbol pointer to the symbol for this context. /// A Symbol pointer to the symbol for this context.
//------------------------------------------------------------------ //------------------------------------------------------------------
explicit explicit
SymbolContext (const lldb::TargetSP &target_sp, SymbolContext(const lldb::TargetSP &target_sp,
const lldb::ModuleSP &module_sp, const lldb::ModuleSP &module_sp,
CompileUnit *comp_unit = NULL, CompileUnit *comp_unit = nullptr,
Function *function = NULL, Function *function = nullptr,
Block *block = NULL, Block *block = nullptr,
LineEntry *line_entry = NULL, LineEntry *line_entry = nullptr,
Symbol *symbol = NULL); Symbol *symbol = nullptr);
// This version sets the target to a NULL TargetSP if you don't know it. // This version sets the target to a NULL TargetSP if you don't know it.
explicit explicit
SymbolContext (const lldb::ModuleSP &module_sp, SymbolContext(const lldb::ModuleSP &module_sp,
CompileUnit *comp_unit = NULL, CompileUnit *comp_unit = nullptr,
Function *function = NULL, Function *function = nullptr,
Block *block = NULL, Block *block = nullptr,
LineEntry *line_entry = NULL, LineEntry *line_entry = nullptr,
Symbol *symbol = NULL); Symbol *symbol = nullptr);
~SymbolContext ();
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Copy constructor /// Copy constructor
/// ///
@ -109,6 +113,8 @@ public:
//------------------------------------------------------------------ //------------------------------------------------------------------
SymbolContext (const SymbolContext& rhs); SymbolContext (const SymbolContext& rhs);
~SymbolContext ();
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Assignment operator. /// Assignment operator.
/// ///
@ -127,7 +133,7 @@ public:
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Clear the object's state. /// 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. /// to their default state.
//------------------------------------------------------------------ //------------------------------------------------------------------
void void
@ -203,14 +209,14 @@ public:
/// ///
/// Address range priority is as follows: /// Address range priority is as follows:
/// - line_entry address range if line_entry is valid and eSymbolContextLineEntry is set in \a scope /// - 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 /// - block address range if block is not nullptr and eSymbolContextBlock is set in \a scope
/// - function address range if function is not NULL and eSymbolContextFunction 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 NULL and eSymbolContextSymbol is set in \a scope /// - symbol address range if symbol is not nullptr and eSymbolContextSymbol is set in \a scope
/// ///
/// @param[in] scope /// @param[in] scope
/// A mask of symbol context bits telling this function which /// A mask of symbol context bits telling this function which
/// address ranges it can use when trying to extract one from /// 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 /// @param[in] range_idx
/// The address range index to grab. Since many functions and /// The address range index to grab. Since many functions and
@ -239,7 +245,6 @@ public:
bool use_inline_block_range, bool use_inline_block_range,
AddressRange &range) const; AddressRange &range) const;
void void
GetDescription(Stream *s, GetDescription(Stream *s,
lldb::DescriptionLevel level, lldb::DescriptionLevel level,
@ -248,7 +253,6 @@ public:
uint32_t uint32_t
GetResolvedMask () const; GetResolvedMask () const;
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Find a block that defines the function represented by this /// Find a block that defines the function represented by this
/// symbol context. /// symbol context.
@ -268,12 +272,11 @@ public:
/// ///
/// @return /// @return
/// The block object pointer that defines the function that is /// 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 * Block *
GetFunctionBlock (); GetFunctionBlock ();
//------------------------------------------------------------------ //------------------------------------------------------------------
/// If this symbol context represents a function that is a method, /// If this symbol context represents a function that is a method,
/// return true and provide information about the method. /// return true and provide information about the method.
@ -304,7 +307,8 @@ public:
/// ///
//------------------------------------------------------------------ //------------------------------------------------------------------
void 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. /// Find a name of the innermost function for the symbol context.
/// ///
@ -322,7 +326,6 @@ public:
ConstString ConstString
GetFunctionName (Mangled::NamePreference preference = Mangled::ePreferDemangled) const; GetFunctionName (Mangled::NamePreference preference = Mangled::ePreferDemangled) const;
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Get the line entry that corresponds to the function. /// Get the line entry that corresponds to the function.
/// ///
@ -384,7 +387,6 @@ public:
Variable * variable; ///< The global variable matching the given query Variable * variable; ///< The global variable matching the given query
}; };
class SymbolContextSpecifier class SymbolContextSpecifier
{ {
public: public:
@ -434,7 +436,6 @@ private:
std::string m_class_name; std::string m_class_name;
std::unique_ptr<AddressRange> m_address_range_ap; std::unique_ptr<AddressRange> m_address_range_ap;
uint32_t m_type; // Or'ed bits from SpecificationType uint32_t m_type; // Or'ed bits from SpecificationType
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -486,6 +487,7 @@ public:
uint32_t uint32_t
AppendIfUnique (const SymbolContextList& sc_list, AppendIfUnique (const SymbolContextList& sc_list,
bool merge_symbol_into_function); bool merge_symbol_into_function);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Clear the object's state. /// Clear the object's state.
/// ///
@ -565,6 +567,7 @@ public:
bool bool
RemoveContextAtIndex (size_t idx); RemoveContextAtIndex (size_t idx);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Get accessor for a symbol context list size. /// Get accessor for a symbol context list size.
/// ///
@ -607,4 +610,4 @@ bool operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs);
} // namespace lldb_private } // namespace lldb_private
#endif // liblldb_SymbolContext_h_ #endif // liblldb_SymbolContext_h_

View File

@ -72,7 +72,7 @@ class SymbolContextScope
{ {
public: public:
virtual virtual
~SymbolContextScope () {} ~SymbolContextScope() = default;
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Reconstruct the object's symbol context into \a sc. /// Reconstruct the object's symbol context into \a sc.
@ -87,7 +87,6 @@ public:
virtual void virtual void
CalculateSymbolContext (SymbolContext *sc) = 0; CalculateSymbolContext (SymbolContext *sc) = 0;
virtual lldb::ModuleSP virtual lldb::ModuleSP
CalculateSymbolContextModule () CalculateSymbolContextModule ()
{ {
@ -97,25 +96,25 @@ public:
virtual CompileUnit * virtual CompileUnit *
CalculateSymbolContextCompileUnit () CalculateSymbolContextCompileUnit ()
{ {
return NULL; return nullptr;
} }
virtual Function * virtual Function *
CalculateSymbolContextFunction () CalculateSymbolContextFunction ()
{ {
return NULL; return nullptr;
} }
virtual Block * virtual Block *
CalculateSymbolContextBlock () CalculateSymbolContextBlock ()
{ {
return NULL; return nullptr;
} }
virtual Symbol * virtual Symbol *
CalculateSymbolContextSymbol () CalculateSymbolContextSymbol ()
{ {
return NULL; return nullptr;
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -134,4 +133,4 @@ public:
} // namespace lldb_private } // namespace lldb_private
#endif // liblldb_SymbolContextScope_h_ #endif // liblldb_SymbolContextScope_h_

View File

@ -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 #ifndef liblldb_UnwindPlan_h
#define liblldb_UnwindPlan_h #define liblldb_UnwindPlan_h
// C Includes
// C++ Includes
#include <map>
#include <memory>
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h" #include "lldb/Core/AddressRange.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/ConstString.h" #include "lldb/Core/ConstString.h"
#include <map>
#include <vector>
namespace lldb_private { namespace lldb_private {
// The UnwindPlan object specifies how to unwind out of a function - where // The UnwindPlan object specifies how to unwind out of a function - where
@ -38,13 +52,11 @@ namespace lldb_private {
class UnwindPlan { class UnwindPlan {
public: public:
class Row { class Row {
public: public:
class RegisterLocation class RegisterLocation
{ {
public: public:
enum RestoreType enum RestoreType
{ {
unspecified, // not specified, we may be able to assume this unspecified, // not specified, we may be able to assume this
@ -187,7 +199,7 @@ public:
} }
else else
{ {
*opcodes = NULL; *opcodes = nullptr;
len = 0; len = 0;
} }
} }
@ -203,7 +215,7 @@ public:
{ {
if (m_type == atDWARFExpression || m_type == isDWARFExpression) if (m_type == atDWARFExpression || m_type == isDWARFExpression)
return m_location.expr.opcodes; return m_location.expr.opcodes;
return NULL; return nullptr;
} }
int int
@ -240,7 +252,6 @@ public:
class CFAValue class CFAValue
{ {
public: public:
enum ValueType enum ValueType
{ {
unspecified, // not specified unspecified, // not specified
@ -361,7 +372,7 @@ public:
} }
else else
{ {
*opcodes = NULL; *opcodes = nullptr;
len = 0; len = 0;
} }
} }
@ -371,7 +382,7 @@ public:
{ {
if (m_type == isDWARFExpression) if (m_type == isDWARFExpression)
return m_value.expr.opcodes; return m_value.expr.opcodes;
return NULL; return nullptr;
} }
int int
@ -488,7 +499,6 @@ public:
}; // class Row }; // class Row
public: public:
typedef std::shared_ptr<Row> RowSP; typedef std::shared_ptr<Row> RowSP;
UnwindPlan (lldb::RegisterKind reg_kind) : UnwindPlan (lldb::RegisterKind reg_kind) :
@ -520,9 +530,7 @@ public:
m_row_list.emplace_back (new Row (*row_sp)); m_row_list.emplace_back (new Row (*row_sp));
} }
~UnwindPlan () ~UnwindPlan() = default;
{
}
void void
Dump (Stream& s, Thread* thread, lldb::addr_t base_addr) const; Dump (Stream& s, Thread* thread, lldb::addr_t base_addr) const;
@ -676,8 +684,6 @@ public:
} }
private: private:
typedef std::vector<RowSP> collection; typedef std::vector<RowSP> collection;
collection m_row_list; collection m_row_list;
AddressRange m_plan_valid_address_range; AddressRange m_plan_valid_address_range;
@ -697,4 +703,4 @@ private:
} // namespace lldb_private } // namespace lldb_private
#endif //liblldb_UnwindPlan_h #endif // liblldb_UnwindPlan_h