Skip to content

Commit e79e601

Browse files
committed
[lldb] Fix dangling expression
This fixes the following: ``` [6603/7618] Building CXX object tools\lldb\source\Plugins\ObjectFile\PECOFF\CMakeFiles\lldbPluginObjectFilePECOFF.dir\WindowsMiniDump.cpp.obj C:\src\git\llvm-project\lldb\source\Plugins\ObjectFile\PECOFF\WindowsMiniDump.cpp(29,25): warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl] 29 | const auto &outfile = core_options.GetOutputFile().value(); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. ```
1 parent a819b0e commit e79e601

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ bool SaveMiniDump(const lldb::ProcessSP &process_sp,
2626
if (!process_sp)
2727
return false;
2828
#ifdef _WIN32
29-
const auto &outfile = core_options.GetOutputFile().value();
29+
std::optional<FileSpec> outfileSpec = core_options.GetOutputFile();
30+
const auto &outfile = outfileSpec.value();
3031
HANDLE process_handle = ::OpenProcess(
3132
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, process_sp->GetID());
3233
const std::string file_name = outfile.GetPath();

0 commit comments

Comments
 (0)