[Lldb-commits] [PATCH] D126402: Fix conversion error to Expected

Thomas Preud'homme via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 25 11:41:47 PDT 2022


thopre created this revision.
thopre added reviewers: wallace, jj10306.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

On Ubuntu 18.04 with GCC 7.5 Intel trace code fails to build due to
failure to convert from
lldb_private::process_linux::IntelPTPerThreadProcessTraceUP to
Expected<lldb_private::process_linux::IntelPTPerThreadProcessTraceUP>.
This commit explicitely marks those unique_ptr values as being moved
which fixes the conversion error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126402

Files:
  lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
  lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp


Index: lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
+++ lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
@@ -318,7 +318,7 @@
     }
     IntelPTSingleBufferTraceUP trace_up(
         new IntelPTSingleBufferTrace(std::move(*perf_event), initial_state));
-    return trace_up;
+    return std::move(trace_up);
   } else {
     return perf_event.takeError();
   }
Index: lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -78,7 +78,7 @@
     error = joinErrors(std::move(error), trace->TraceStart(tid));
   if (error)
     return std::move(error);
-  return trace;
+  return std::move(trace);
 }
 
 Error IntelPTCollector::TraceStart(const TraceIntelPTStartRequest &request) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126402.432061.patch
Type: text/x-patch
Size: 1034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220525/0dd6b3cc/attachment.bin>


More information about the lldb-commits mailing list