aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-04-28 13:36:00 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-04-28 18:12:41 -0700
commit13dbc16b4d82b9adc98c0919873b2b59ccc46afd (patch)
tree3550c36699c6567741693520e3c0112f2bd8751b /lldb/source/Interpreter/CommandInterpreter.cpp
parentbfb5a4fd53fa00d450a0434f20e2193fff196ae6 (diff)
downloadllvm-13dbc16b4d82b9adc98c0919873b2b59ccc46afd.zip
llvm-13dbc16b4d82b9adc98c0919873b2b59ccc46afd.tar.gz
llvm-13dbc16b4d82b9adc98c0919873b2b59ccc46afd.tar.bz2
[lldb] Refactor host::OpenFileInExternalEditor
This patch refactors the macOS implementation of OpenFileInExternalEditor. It fixes an AppleEvent memory leak, the caching of LLDB_EXTERNAL_EDITOR and speculatively fixes a crash when CFURL is NULL (rdar://108633464). The new code also improves error handling, readability and documents calls to the CoreFoundation Launch Services APIs. A bunch of the Launch Services APIs have been deprecated (LSFindApplicationForInfo, LSOpenURLsWithRole). The preferred API is LSOpenCFURLRef but it doesn't specifying the "location" Apple Event which is used to highlight the current line and switching over would regress the existing behavior. rdar://108633464 Differential revision: https://reviews.llvm.org/D149482
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index cee17df..f89cff4 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3271,8 +3271,10 @@ bool CommandInterpreter::SaveTranscript(
if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) {
const FileSpec file_spec;
error = file->GetFileSpec(const_cast<FileSpec &>(file_spec));
- if (error.Success())
- Host::OpenFileInExternalEditor(file_spec, 1);
+ if (error.Success()) {
+ if (llvm::Error e = Host::OpenFileInExternalEditor(file_spec, 1))
+ result.AppendError(llvm::toString(std::move(e)));
+ }
}
return true;