From 2edcad7b5982a207666150e4f30544fff6dcaa3e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 6 May 2019 20:45:31 +0000 Subject: [Driver] Change the way we deal with local lldbinit files. Currently we have special handling for local lldbinit files in the driver. At the same time, we have an SB API named `SourceInitFileInCurrentWorkingDirectory` that does the same thing. This patch removes the special handling from the driver and uses the API instead. In addition to the obvious advantages of having one canonical way of doing things and removing code duplication, this change also means that the code path is the same for global and local lldb init files. Differential revision: https://reviews.llvm.org/D61577 llvm-svn: 360077 --- lldb/source/Interpreter/CommandInterpreter.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp') diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 10a290be54c..0811822ff14 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2095,16 +2095,14 @@ void CommandInterpreter::SourceInitFile(bool in_cwd, CommandReturnObject &result) { FileSpec init_file; if (in_cwd) { - ExecutionContext exe_ctx(GetExecutionContext()); - Target *target = exe_ctx.GetTargetPtr(); - if (target) { + lldb::TargetPropertiesSP properties = Target::GetGlobalProperties(); + if (properties) { // In the current working directory we don't load any program specific // .lldbinit files, we only look for a ".lldbinit" file. if (m_skip_lldbinit_files) return; - LoadCWDlldbinitFile should_load = - target->TargetProperties::GetLoadCWDlldbinitFile(); + LoadCWDlldbinitFile should_load = properties->GetLoadCWDlldbinitFile(); if (should_load == eLoadCWDlldbinitWarn) { FileSpec dot_lldb(".lldbinit"); FileSystem::Instance().Resolve(dot_lldb); -- cgit v1.2.3