Skip to content

[lldb][intel-pt] Fix build error on conversion from llvm::Error to Status::FromError #108719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

kusmour
Copy link
Contributor

@kusmour kusmour commented Sep 14, 2024

Summary: This introduced from upstream #107163

Test Plan: I can build

Closes: #107580

@llvmbot
Copy link
Member

llvmbot commented Sep 14, 2024

@llvm/pr-subscribers-lldb

Author: Wanyi (kusmour)

Changes

Summary: This introduced from upstream #107163

Test Plan: I can build


Full diff: https://github.com/llvm/llvm-project/pull/108719.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp (+2-2)
diff --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
index 81f7c228561a6d..40035e4480495f 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
@@ -78,7 +78,7 @@ bool CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads(
     llvm::ArrayRef<lldb::tid_t> tids) {
   if (Error err = m_trace.Start(tids, m_options.m_ipt_trace_size,
                                 m_options.m_enable_tsc, m_options.m_psb_period))
-    result.SetError(Status(std::move(err)));
+    result.SetError(Status::FromError(std::move(err)));
   else
     result.SetStatus(eReturnStatusSuccessFinishResult);
 
@@ -164,7 +164,7 @@ void CommandObjectProcessTraceStartIntelPT::DoExecute(
           m_options.m_ipt_trace_size, m_options.m_process_buffer_size_limit,
           m_options.m_enable_tsc, m_options.m_psb_period,
           m_options.m_per_cpu_tracing, m_options.m_disable_cgroup_filtering))
-    result.SetError(Status(std::move(err)));
+    result.SetError(Status::FromError(std::move(err)));
   else
     result.SetStatus(eReturnStatusSuccessFinishResult);
 }

@Jlalond
Copy link
Contributor

Jlalond commented Sep 14, 2024

Hey @kusmour. I actually looked into this on Thursday, see #108248. If we are going to merge this I think we should just call std::move and not Status::FromError(std::move(err)) as the API takes an err r-value.

@@ -78,7 +78,7 @@ bool CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads(
llvm::ArrayRef<lldb::tid_t> tids) {
if (Error err = m_trace.Start(tids, m_options.m_ipt_trace_size,
m_options.m_enable_tsc, m_options.m_psb_period))
result.SetError(Status(std::move(err)));
result.SetError(Status::FromError(std::move(err)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just make sure that you really need to invoke std::move. It's possible that the compiler can do that on its own and that you don't need the explicit std::move

…atus::FromError

Summary: This introduced from upstream llvm#107163

Test Plan: I can build
@kusmour kusmour merged commit e1971a8 into llvm:main Sep 17, 2024
7 checks passed
hamphet pushed a commit to hamphet/llvm-project that referenced this pull request Sep 18, 2024
…atus::FromError (llvm#108719)

Summary: This introduced from upstream
[llvm#107163](llvm#107163)

Test Plan: I can build

Closes: llvm#107580
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
…atus::FromError (llvm#108719)

Summary: This introduced from upstream
[llvm#107163](llvm#107163)

Test Plan: I can build

Closes: llvm#107580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lldb fails to build on CommandObjectTraceStartIntelPT.cpp:81:21: error: calling a protected constructor of class 'lldb_private::Status'
4 participants