diff options
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser')
14 files changed, 113 insertions, 109 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp index 3fecb0c7da9..369f88327dd 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp @@ -85,7 +85,7 @@ void ASTDumper::ToLog(Log *log, const char *prefix) { memcpy(str, m_dump.c_str(), len); - char *end = NULL; + char *end = nullptr; end = strchr(str, '\n'); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 71e13070897..5dc39e8dac4 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -34,8 +34,9 @@ using namespace lldb_private; ASTResultSynthesizer::ASTResultSynthesizer(ASTConsumer *passthrough, bool top_level, Target &target) - : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL), - m_target(target), m_sema(NULL), m_top_level(top_level) { + : m_ast_context(nullptr), m_passthrough(passthrough), + m_passthrough_sema(nullptr), m_target(target), m_sema(nullptr), + m_top_level(top_level) { if (!m_passthrough) return; @@ -311,7 +312,7 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, (is_lvalue ? "lvalue" : "rvalue"), s.c_str()); } - clang::VarDecl *result_decl = NULL; + clang::VarDecl *result_decl = nullptr; if (is_lvalue) { IdentifierInfo *result_ptr_id; @@ -329,14 +330,14 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, QualType ptr_qual_type; - if (expr_qual_type->getAs<ObjCObjectType>() != NULL) + if (expr_qual_type->getAs<ObjCObjectType>() != nullptr) ptr_qual_type = Ctx.getObjCObjectPointerType(expr_qual_type); else ptr_qual_type = Ctx.getPointerType(expr_qual_type); result_decl = VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), - result_ptr_id, ptr_qual_type, NULL, SC_Static); + result_ptr_id, ptr_qual_type, nullptr, SC_Static); if (!result_decl) return false; @@ -350,8 +351,9 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, } else { IdentifierInfo &result_id = Ctx.Idents.get("$__lldb_expr_result"); - result_decl = VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), - &result_id, expr_qual_type, NULL, SC_Static); + result_decl = + VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), &result_id, + expr_qual_type, nullptr, SC_Static); if (!result_decl) return false; @@ -507,7 +509,7 @@ void ASTResultSynthesizer::InitializeSema(Sema &S) { } void ASTResultSynthesizer::ForgetSema() { - m_sema = NULL; + m_sema = nullptr; if (m_passthrough_sema) m_passthrough_sema->ForgetSema(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp index 1d8e6931cb9..190eacaa2b6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp @@ -29,9 +29,9 @@ using namespace lldb_private; ASTStructExtractor::ASTStructExtractor(ASTConsumer *passthrough, const char *struct_name, ClangFunctionCaller &function) - : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL), - m_sema(NULL), m_action(NULL), m_function(function), - m_struct_name(struct_name) { + : m_ast_context(nullptr), m_passthrough(passthrough), + m_passthrough_sema(nullptr), m_sema(nullptr), m_action(nullptr), + m_function(function), m_struct_name(struct_name) { if (!m_passthrough) return; @@ -57,7 +57,7 @@ void ASTStructExtractor::ExtractFromFunctionDecl(FunctionDecl *F) { if (!body_compound_stmt) return; // do we have to handle this? - RecordDecl *struct_decl = NULL; + RecordDecl *struct_decl = nullptr; StringRef desired_name(m_struct_name); @@ -177,8 +177,8 @@ void ASTStructExtractor::InitializeSema(Sema &S) { } void ASTStructExtractor::ForgetSema() { - m_sema = NULL; - m_action = NULL; + m_sema = nullptr; + m_action = nullptr; if (m_passthrough_sema) m_passthrough_sema->ForgetSema(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 92191793d19..632594f1c46 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -51,7 +51,7 @@ private: ClangASTSource::ClangASTSource(const lldb::TargetSP &target) : m_import_in_progress(false), m_lookups_enabled(false), m_target(target), - m_ast_context(NULL), m_active_lexical_decls(), m_active_lookups() { + m_ast_context(nullptr), m_active_lexical_decls(), m_active_lookups() { if (!target->GetUseModernTypeLookup()) { m_ast_importer_sp = m_target->GetClangASTImporter(); } @@ -441,8 +441,8 @@ void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) { return; } - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; if (m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx)) { @@ -475,12 +475,12 @@ clang::ObjCInterfaceDecl *ClangASTSource::GetCompleteObjCInterface( lldb::ProcessSP process(m_target->GetProcessSP()); if (!process) - return NULL; + return nullptr; ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime()); if (!language_runtime) - return NULL; + return nullptr; ConstString class_name(interface_decl->getNameAsString().c_str()); @@ -488,7 +488,7 @@ clang::ObjCInterfaceDecl *ClangASTSource::GetCompleteObjCInterface( language_runtime->LookupInCompleteClassCache(class_name)); if (!complete_type_sp) - return NULL; + return nullptr; TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetFullCompilerType()); @@ -496,7 +496,7 @@ clang::ObjCInterfaceDecl *ClangASTSource::GetCompleteObjCInterface( complete_type.GetOpaqueQualType(); if (!complete_opaque_type) - return NULL; + return nullptr; const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr(); @@ -504,7 +504,7 @@ clang::ObjCInterfaceDecl *ClangASTSource::GetCompleteObjCInterface( dyn_cast<ObjCInterfaceType>(complete_clang_type); if (!complete_interface_type) - return NULL; + return nullptr; ObjCInterfaceDecl *complete_iface_decl(complete_interface_type->getDecl()); @@ -569,8 +569,8 @@ void ClangASTSource::FindExternalLexicalDecls( current_id, static_cast<const void *>(m_ast_context)); } - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; if (!m_ast_importer_sp->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx)) @@ -993,9 +993,9 @@ void ClangASTSource::FindExternalVisibleDecls( template <class D> class TaggedASTDecl { public: - TaggedASTDecl() : decl(NULL) {} + TaggedASTDecl() : decl(nullptr) {} TaggedASTDecl(D *_decl) : decl(_decl) {} - bool IsValid() const { return (decl != NULL); } + bool IsValid() const { return (decl != nullptr); } bool IsInvalid() const { return !IsValid(); } D *operator->() const { return decl; } D *decl; @@ -1028,7 +1028,7 @@ public: template <class D> DeclFromUser<D> DeclFromParser<D>::GetOrigin(ClangASTSource &source) { DeclFromUser<> origin_decl; - source.ResolveDeclOrigin(this->decl, &origin_decl.decl, NULL); + source.ResolveDeclOrigin(this->decl, &origin_decl.decl, nullptr); if (origin_decl.IsInvalid()) return DeclFromUser<D>(); return DeclFromUser<D>(dyn_cast<D>(origin_decl.decl)); @@ -1158,8 +1158,8 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { return; do { - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx); @@ -2063,12 +2063,12 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(const CompilerType &type) { assert(type && "Type for variable must be valid!"); if (!type.IsValid()) - return NULL; + return nullptr; ClangASTContext *lldb_ast = llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem()); if (!lldb_ast) - return NULL; + return nullptr; IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo(); @@ -2076,7 +2076,7 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(const CompilerType &type) { clang::NamedDecl *Decl = VarDecl::Create( *ast, const_cast<DeclContext *>(m_decl_context), SourceLocation(), - SourceLocation(), ii, ClangUtil::GetQualType(type), 0, SC_Static); + SourceLocation(), ii, ClangUtil::GetQualType(type), nullptr, SC_Static); m_decls.push_back(Decl); return Decl; @@ -2087,15 +2087,15 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type, assert(type && "Type for variable must be valid!"); if (!type.IsValid()) - return NULL; + return nullptr; if (m_function_types.count(type)) - return NULL; + return nullptr; ClangASTContext *lldb_ast = llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem()); if (!lldb_ast) - return NULL; + return nullptr; m_function_types.insert(type); @@ -2124,7 +2124,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type, clang::FunctionDecl *func_decl = FunctionDecl::Create( *ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type, - NULL, SC_Extern, isInlineSpecified, hasWrittenPrototype, + nullptr, SC_Extern, isInlineSpecified, hasWrittenPrototype, isConstexprSpecified); // We have to do more than just synthesize the FunctionDecl. We have to @@ -2143,9 +2143,10 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type, for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex) { QualType arg_qual_type(func_proto_type->getParamType(ArgIndex)); - parm_var_decls.push_back(ParmVarDecl::Create( - *ast, const_cast<DeclContext *>(context), SourceLocation(), - SourceLocation(), NULL, arg_qual_type, NULL, SC_Static, NULL)); + parm_var_decls.push_back( + ParmVarDecl::Create(*ast, const_cast<DeclContext *>(context), + SourceLocation(), SourceLocation(), nullptr, + arg_qual_type, nullptr, SC_Static, nullptr)); } func_decl->setParams(ArrayRef<ParmVarDecl *>(parm_var_decls)); @@ -2166,7 +2167,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type, ClangASTContext::IsOperator(decl_name.getAsString().c_str(), op_kind)) { if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( false, op_kind, func_proto_type->getNumParams())) - return NULL; + return nullptr; } m_decls.push_back(func_decl); @@ -2214,7 +2215,7 @@ NameSearchContext::AddTypeDecl(const CompilerType &clang_type) { return (NamedDecl *)interface_decl; } } - return NULL; + return nullptr; } void NameSearchContext::AddLookupResult(clang::DeclContextLookupResult result) { diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h index 624c86a5174..7a8bacf48a8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -45,15 +45,15 @@ public: ~ClangASTSource() override; /// Interface stubs. - clang::Decl *GetExternalDecl(uint32_t) override { return NULL; } - clang::Stmt *GetExternalDeclStmt(uint64_t) override { return NULL; } + clang::Decl *GetExternalDecl(uint32_t) override { return nullptr; } + clang::Stmt *GetExternalDeclStmt(uint64_t) override { return nullptr; } clang::Selector GetExternalSelector(uint32_t) override { return clang::Selector(); } uint32_t GetNumExternalSelectors() override { return 0; } clang::CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override { - return NULL; + return nullptr; } void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 83cbe517643..496d5b40e3e 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -367,7 +367,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) return false; ClangASTContext *context(target->GetScratchClangASTContext()); @@ -951,7 +951,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( // Clang is looking for the type of "this" - if (frame == NULL) + if (frame == nullptr) return; // Find the block that defines the function represented by "sym_ctx" @@ -1277,7 +1277,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( } } if (target) { - var = FindGlobalVariable(*target, module_sp, name, &namespace_decl, NULL); + var = FindGlobalVariable(*target, module_sp, name, &namespace_decl, + nullptr); if (var) { valobj = ValueObjectVariable::Create(target, var); @@ -1434,8 +1435,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( } if (sc_list.GetSize()) { - Symbol *extern_symbol = NULL; - Symbol *non_extern_symbol = NULL; + Symbol *extern_symbol = nullptr; + Symbol *non_extern_symbol = nullptr; for (uint32_t index = 0, num_indices = sc_list.GetSize(); index < num_indices; ++index) { @@ -1452,13 +1453,13 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr)) continue; - AddOneFunction(context, sym_ctx.function, NULL, current_id); + AddOneFunction(context, sym_ctx.function, nullptr, current_id); context.m_found.function_with_type_info = true; context.m_found.function = true; } else if (sym_ctx.symbol) { if (sym_ctx.symbol->GetType() == eSymbolTypeReExported && target) { sym_ctx.symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target); - if (sym_ctx.symbol == NULL) + if (sym_ctx.symbol == nullptr) continue; } @@ -1484,10 +1485,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( if (!context.m_found.function_with_type_info) { if (extern_symbol) { - AddOneFunction(context, NULL, extern_symbol, current_id); + AddOneFunction(context, nullptr, extern_symbol, current_id); context.m_found.function = true; } else if (non_extern_symbol) { - AddOneFunction(context, NULL, non_extern_symbol, current_id); + AddOneFunction(context, nullptr, non_extern_symbol, current_id); context.m_found.function = true; } } @@ -1723,7 +1724,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, bool is_reference = pt.IsReferenceType(); - NamedDecl *var_decl = NULL; + NamedDecl *var_decl = nullptr; if (is_reference) var_decl = context.AddVarDecl(pt); else @@ -1740,7 +1741,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, entity->GetParserVars(GetParserID()); parser_vars->m_parser_type = pt; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value = var_location; parser_vars->m_lldb_var = var; @@ -1783,7 +1784,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, ->GetParserVars(GetParserID()); parser_vars->m_parser_type = parser_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value.Clear(); if (log) { @@ -1802,7 +1803,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) return; ASTContext *scratch_ast_context = @@ -1841,7 +1842,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, parser_vars->m_parser_type = parser_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_sym = &symbol; if (log) { @@ -1889,7 +1890,7 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() { var_type.getAsOpaquePtr(), ClangASTContext::GetASTContext(&var_decl->getASTContext())); - lldb::opaque_compiler_type_t copied_type = 0; + lldb::opaque_compiler_type_t copied_type = nullptr; if (m_ast_importer_sp) { copied_type = m_ast_importer_sp->CopyType( scratch_ast_context->getASTContext(), &var_decl->getASTContext(), @@ -1962,7 +1963,7 @@ void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context, entity->GetParserVars(GetParserID()); parser_vars->m_parser_type = parser_clang_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value.Clear(); entity->m_flags |= ClangExpressionVariable::EVBareRegister; @@ -1981,7 +1982,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - NamedDecl *function_decl = NULL; + NamedDecl *function_decl = nullptr; Address fun_address; CompilerType function_clang_type; @@ -2141,7 +2142,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, } parser_vars->m_named_decl = function_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; if (log) { std::string function_str = @@ -2194,7 +2195,7 @@ void ClangExpressionDeclMap::AddThisType(NameSearchContext &context, CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context) ->AddMethodToCXXRecordType( - copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", NULL, + copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", nullptr, method_type, lldb::eAccessPublic, is_virtual, is_static, is_inline, is_explicit, is_attr_used, is_artificial); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h index a7e2ced2c45..03b73e6be39 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -242,9 +242,8 @@ public: /// \return /// Valid load address for the symbol lldb::addr_t GetSymbolAddress(Target &target, Process *process, - ConstString name, - lldb::SymbolType symbol_type, - Module *module = NULL); + ConstString name, lldb::SymbolType symbol_type, + Module *module = nullptr); lldb::addr_t GetSymbolAddress(ConstString name, lldb::SymbolType symbol_type); @@ -331,7 +330,7 @@ private: return m_exe_ctx.GetTargetPtr(); else if (m_sym_ctx.target_sp) m_sym_ctx.target_sp.get(); - return NULL; + return nullptr; } ExecutionContext m_exe_ctx; ///< The execution context to use when parsing. @@ -368,7 +367,7 @@ private: struct StructVars { StructVars() : m_struct_alignment(0), m_struct_size(0), m_struct_laid_out(false), - m_result_name(), m_object_pointer_type(NULL, NULL) {} + m_result_name(), m_object_pointer_type(nullptr, nullptr) {} lldb::offset_t m_struct_alignment; ///< The alignment of the struct in bytes. @@ -421,7 +420,7 @@ private: lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module, ConstString name, CompilerDeclContext *namespace_decl, - TypeFromUser *type = NULL); + TypeFromUser *type = nullptr); /// Get the value of a variable in a given execution context and return the /// associated Types if needed. @@ -449,8 +448,8 @@ private: /// Return true if the value was successfully filled in. bool GetVariableValue(lldb::VariableSP &var, lldb_private::Value &var_location, - TypeFromUser *found_type = NULL, - TypeFromParser *parser_type = NULL); + TypeFromUser *found_type = nullptr, + TypeFromParser *parser_type = nullptr); /// Use the NameSearchContext to generate a Decl for the given LLDB /// Variable, and put it in the Tuple list. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 0659851fa08..9fd9fe9a59f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -1229,7 +1229,7 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution( type_system_helper->DeclMap(); // result can be NULL if (decl_map) { - Stream *error_stream = NULL; + Stream *error_stream = nullptr; Target *target = exe_ctx.GetTargetPtr(); error_stream = target->GetDebugger().GetErrorFile().get(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h index bb5e6e79870..eb7f74f20a2 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h @@ -117,8 +117,8 @@ public: class ParserVars { public: ParserVars() - : m_parser_type(), m_named_decl(NULL), m_llvm_value(NULL), - m_lldb_value(), m_lldb_var(), m_lldb_sym(NULL) {} + : m_parser_type(), m_named_decl(nullptr), m_llvm_value(nullptr), + m_lldb_value(), m_lldb_var(), m_lldb_sym(nullptr) {} TypeFromParser m_parser_type; ///< The type of the variable according to the parser @@ -152,7 +152,7 @@ public: ParserVarMap::iterator i = m_parser_vars.find(parser_id); if (i == m_parser_vars.end()) - return NULL; + return nullptr; else return &i->second; } @@ -186,7 +186,7 @@ public: JITVarMap::iterator i = m_jit_vars.find(parser_id); if (i == m_jit_vars.end()) - return NULL; + return nullptr; else return &i->second; } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h index bdcead230c5..24f6f2eb91b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h @@ -72,7 +72,7 @@ class ClangFunctionCaller : public FunctionCaller { /// Return the object that the parser should use when resolving external /// values. May be NULL if everything should be self-contained. - ClangExpressionDeclMap *DeclMap() override { return NULL; } + ClangExpressionDeclMap *DeclMap() override { return nullptr; } /// Return the object that the parser should allow to access ASTs. May be /// NULL if the ASTs do not need to be transformed. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp index e77ba86eb10..912c9ef2e1b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -48,7 +48,7 @@ void ClangPersistentVariables::RemovePersistentVariable( return; name++; - if (strtoul(name, NULL, 0) == m_next_persistent_variable_id - 1) + if (strtoul(name, nullptr, 0) == m_next_persistent_variable_id - 1) m_next_persistent_variable_id--; } @@ -72,7 +72,7 @@ ClangPersistentVariables::GetPersistentDecl(ConstString name) { m_persistent_decls.find(name.GetCString()); if (i == m_persistent_decls.end()) - return NULL; + return nullptr; else return i->second; } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 9fcf2d49845..2dae5b7022f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -102,7 +102,7 @@ void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { } StackFrame *frame = exe_ctx.GetFramePtr(); - if (frame == NULL) { + if (frame == nullptr) { if (log) log->Printf(" [CUE::SC] Null stack frame"); return; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp index 684cffd815e..5eec224477f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp @@ -90,7 +90,7 @@ bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager, ResetDeclMap(exe_ctx, keep_result_in_memory); - if (!DeclMap()->WillParse(exe_ctx, NULL)) { + if (!DeclMap()->WillParse(exe_ctx, nullptr)) { diagnostic_manager.PutString( eDiagnosticSeverityError, "current process state is unsuitable for expression parsing"); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 9c928054cfb..f083b92e3d6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -60,7 +60,7 @@ IRForTarget::FunctionValueCache::GetValue(llvm::Function *function) { static llvm::Value *FindEntryInstruction(llvm::Function *function) { if (function->empty()) - return NULL; + return nullptr; return function->getEntryBlock().getFirstNonPHIOrDbg(); } @@ -71,11 +71,12 @@ IRForTarget::IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map, lldb_private::Stream &error_stream, const char *func_name) : ModulePass(ID), m_resolve_vars(resolve_vars), m_func_name(func_name), - m_module(NULL), m_decl_map(decl_map), m_CFStringCreateWithBytes(NULL), - m_sel_registerName(NULL), m_objc_getClass(NULL), m_intptr_ty(NULL), - m_error_stream(error_stream), - m_execution_unit(execution_unit), m_result_store(NULL), - m_result_is_pointer(false), m_reloc_placeholder(NULL), + m_module(nullptr), m_decl_map(decl_map), + m_CFStringCreateWithBytes(nullptr), m_sel_registerName(nullptr), + m_objc_getClass(nullptr), m_intptr_ty(nullptr), + m_error_stream(error_stream), m_execution_unit(execution_unit), + m_result_store(nullptr), m_result_is_pointer(false), + m_reloc_placeholder(nullptr), m_entry_instruction_finder(FindEntryInstruction) {} /* Handy utility functions used at several places in the code */ @@ -116,7 +117,7 @@ clang::NamedDecl *IRForTarget::DeclForGlobal(const GlobalValue *global_val, module->getNamedMetadata("clang.global.decl.ptrs"); if (!named_metadata) - return NULL; + return nullptr; unsigned num_nodes = named_metadata->getNumOperands(); unsigned node_index; @@ -125,7 +126,7 @@ clang::NamedDecl *IRForTarget::DeclForGlobal(const GlobalValue *global_val, llvm::MDNode *metadata_node = dyn_cast<llvm::MDNode>(named_metadata->getOperand(node_index)); if (!metadata_node) - return NULL; + return nullptr; if (metadata_node->getNumOperands() != 2) continue; @@ -138,14 +139,14 @@ clang::NamedDecl *IRForTarget::DeclForGlobal(const GlobalValue *global_val, mdconst::dyn_extract<ConstantInt>(metadata_node->getOperand(1)); if (!constant_int) - return NULL; + return nullptr; uintptr_t ptr = constant_int->getZExtValue(); return reinterpret_cast<clang::NamedDecl *>(ptr); } - return NULL; + return nullptr; } clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) { @@ -164,7 +165,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable(); std::string result_name_str; - const char *result_name = NULL; + const char *result_name = nullptr; for (ValueSymbolTable::iterator vi = value_symbol_table.begin(), ve = value_symbol_table.end(); @@ -342,8 +343,8 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { GlobalVariable *new_result_global = new GlobalVariable( (*m_module), result_global->getType()->getElementType(), - false, /* not constant */ - GlobalValue::ExternalLinkage, NULL, /* no initializer */ + false, /* not constant */ + GlobalValue::ExternalLinkage, nullptr, /* no initializer */ m_result_name.GetCString()); // It's too late in compilation to create a new VarDecl for this, but we @@ -488,7 +489,7 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str, CFSCWB_ty, ConstantExpr::getIntToPtr(CFSCWB_addr_int, CFSCWB_ptr_ty)}; } - ConstantDataSequential *string_array = NULL; + ConstantDataSequential *string_array = nullptr; if (cstr) string_array = dyn_cast<ConstantDataSequential>(cstr->getInitializer()); @@ -733,7 +734,7 @@ bool IRForTarget::RewriteObjCConstStrings() { } if (!cstr_array) - cstr_global = NULL; + cstr_global = nullptr; if (!RewriteObjCConstString(nsstring_global, cstr_global)) { if (log) @@ -1149,8 +1150,8 @@ bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) { return false; GlobalVariable *persistent_global = new GlobalVariable( - (*m_module), alloc->getType(), false, /* not constant */ - GlobalValue::ExternalLinkage, NULL, /* no initializer */ + (*m_module), alloc->getType(), false, /* not constant */ + GlobalValue::ExternalLinkage, nullptr, /* no initializer */ alloc->getName().str()); // What we're going to do here is make believe this was a regular old @@ -1346,13 +1347,13 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { std::string name(named_decl->getName().str()); clang::ValueDecl *value_decl = dyn_cast<clang::ValueDecl>(named_decl); - if (value_decl == NULL) + if (value_decl == nullptr) return false; lldb_private::CompilerType compiler_type(&value_decl->getASTContext(), value_decl->getType()); - const Type *value_type = NULL; + const Type *value_type = nullptr; if (name[0] == '$') { // The $__lldb_expr_result name indicates the return value has allocated @@ -1630,12 +1631,12 @@ bool IRForTarget::ResolveExternals(Function &llvm_function) { } static bool isGuardVariableRef(Value *V) { - Constant *Old = NULL; + Constant *Old = nullptr; if (!(Old = dyn_cast<Constant>(V))) return false; - ConstantExpr *CE = NULL; + ConstantExpr *CE = nullptr; if ((CE = dyn_cast<ConstantExpr>(V))) { if (CE->getOpcode() != Instruction::BitCast) @@ -1930,8 +1931,8 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) { } for (element_index = 0; element_index < num_elements; ++element_index) { - const clang::NamedDecl *decl = NULL; - Value *value = NULL; + const clang::NamedDecl *decl = nullptr; + Value *value = nullptr; lldb::offset_t offset; lldb_private::ConstString name; @@ -2051,7 +2052,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) { std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -2088,7 +2089,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) { m_reloc_placeholder = new llvm::GlobalVariable( (*m_module), int8_ty, false /* IsConstant */, GlobalVariable::InternalLinkage, Constant::getNullValue(int8_ty), - "reloc_placeholder", NULL /* InsertBefore */, + "reloc_placeholder", nullptr /* InsertBefore */, GlobalVariable::NotThreadLocal /* ThreadLocal */, 0 /* AddressSpace */); //////////////////////////////////////////////////////////// @@ -2110,7 +2111,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) { std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -2245,7 +2246,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) { std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); |