diff options
| author | Mingming Liu <mingmingl@google.com> | 2025-09-10 15:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 15:25:31 -0700 |
| commit | 1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch) | |
| tree | 57f4b1f313c8cf74eed8819870f39c36ea263c68 /lldb/source/Interpreter/CommandInterpreter.cpp | |
| parent | 898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff) | |
| parent | b8cefcb601ddaa18482555c4ff363c01a270c2fe (diff) | |
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
| -rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 650b754fd8ac..d909c5650c95 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -52,6 +52,7 @@ #include "lldb/Core/Telemetry.h" #include "lldb/Host/StreamFile.h" #include "lldb/Utility/ErrorMessages.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" @@ -1801,13 +1802,13 @@ CommandObject *CommandInterpreter::BuildAliasResult( // Make sure we aren't going outside the bounds of the cmd string: if (strpos < start_fudge) { - result.AppendError("Unmatched quote at command beginning."); + result.AppendError("unmatched quote at command beginning"); return nullptr; } llvm::StringRef arg_text = entry.ref(); if (strpos - start_fudge + arg_text.size() + len_fudge > raw_input_string.size()) { - result.AppendError("Unmatched quote at command end."); + result.AppendError("unmatched quote at command end"); return nullptr; } raw_input_string = raw_input_string.erase( @@ -2090,7 +2091,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line, command_string = command_line; original_command_string = command_line; if (m_repeat_command.empty()) { - result.AppendError("No auto repeat."); + result.AppendError("no auto repeat"); return false; } @@ -2502,22 +2503,18 @@ int CommandInterpreter::GetOptionArgumentPosition(const char *in_string) { return position; } -static void GetHomeInitFile(llvm::SmallVectorImpl<char> &init_file, - llvm::StringRef suffix = {}) { +static void GetHomeInitFile(FileSpec &init_file, llvm::StringRef suffix = {}) { std::string init_file_name = ".lldbinit"; if (!suffix.empty()) { init_file_name.append("-"); init_file_name.append(suffix.str()); } - FileSystem::Instance().GetHomeDirectory(init_file); - llvm::sys::path::append(init_file, init_file_name); - - FileSystem::Instance().Resolve(init_file); + init_file = + HostInfo::GetUserHomeDir().CopyByAppendingPathComponent(init_file_name); } -static void GetHomeREPLInitFile(llvm::SmallVectorImpl<char> &init_file, - LanguageType language) { +static void GetHomeREPLInitFile(FileSpec &init_file, LanguageType language) { if (language == eLanguageTypeUnknown) { LanguageSet repl_languages = Language::GetLanguagesSupportingREPLs(); if (auto main_repl_language = repl_languages.GetSingularLanguage()) @@ -2531,9 +2528,9 @@ static void GetHomeREPLInitFile(llvm::SmallVectorImpl<char> &init_file, llvm::Twine(Language::GetNameForLanguageType(language)) + llvm::Twine("-repl")) .str(); - FileSystem::Instance().GetHomeDirectory(init_file); - llvm::sys::path::append(init_file, init_file_name); - FileSystem::Instance().Resolve(init_file); + + init_file = + HostInfo::GetUserHomeDir().CopyByAppendingPathComponent(init_file_name); } static void GetCwdInitFile(llvm::SmallVectorImpl<char> &init_file) { @@ -2588,10 +2585,10 @@ void CommandInterpreter::SourceInitFileCwd(CommandReturnObject &result) { SourceInitFile(FileSpec(init_file.str()), result); break; case eLoadCWDlldbinitWarn: { - llvm::SmallString<128> home_init_file; + FileSpec home_init_file; GetHomeInitFile(home_init_file); if (llvm::sys::path::parent_path(init_file) == - llvm::sys::path::parent_path(home_init_file)) { + llvm::sys::path::parent_path(home_init_file.GetPath())) { result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.AppendError(InitFileWarning); @@ -2611,24 +2608,24 @@ void CommandInterpreter::SourceInitFileHome(CommandReturnObject &result, return; } - llvm::SmallString<128> init_file; + FileSpec init_file; if (is_repl) GetHomeREPLInitFile(init_file, GetDebugger().GetREPLLanguage()); - if (init_file.empty()) + if (init_file.GetPath().empty()) GetHomeInitFile(init_file); if (!m_skip_app_init_files) { llvm::StringRef program_name = HostInfo::GetProgramFileSpec().GetFilename().GetStringRef(); - llvm::SmallString<128> program_init_file; + FileSpec program_init_file; GetHomeInitFile(program_init_file, program_name); if (FileSystem::Instance().Exists(program_init_file)) init_file = program_init_file; } - SourceInitFile(FileSpec(init_file.str()), result); + SourceInitFile(init_file, result); } void CommandInterpreter::SourceInitFileGlobal(CommandReturnObject &result) { |
