[Lldb-commits] [lldb] 5839976 - [nfc][trace] use formatv instead of the old Printf

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 30 10:21:53 PDT 2021


It would be cleaner to use CommandReturnObject::AppendErrorWithFormatv.

Jim


> On Jul 29, 2021, at 7:05 PM, Walter Erquinigo via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
> Author: Walter Erquinigo
> Date: 2021-07-29T19:04:59-07:00
> New Revision: 5839976976bc018b674f45f56f8a13707b870443
> 
> URL: https://github.com/llvm/llvm-project/commit/5839976976bc018b674f45f56f8a13707b870443
> DIFF: https://github.com/llvm/llvm-project/commit/5839976976bc018b674f45f56f8a13707b870443.diff
> 
> LOG: [nfc][trace] use formatv instead of the old Printf
> 
> It was suggested in https://reviews.llvm.org/D105741 and it makes sense.
> 
> Added: 
> 
> 
> Modified: 
>    lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
> 
> Removed: 
> 
> 
> 
> ################################################################################
> diff  --git a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
> index 873eda687dd8..9e994ea829e9 100644
> --- a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
> +++ b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
> @@ -75,9 +75,11 @@ bool CommandObjectThreadTraceExportCTF::DoExecute(Args &command,
>     const uint32_t num_threads = process->GetThreadList().GetSize();
>     size_t tid = m_options.m_thread_index ? *m_options.m_thread_index
>                                           : LLDB_INVALID_THREAD_ID;
> -    result.AppendErrorWithFormat(
> -        "Thread index %" PRIu64 " is out of range (valid values are 0 - %u).\n", tid,
> -        num_threads);
> +    result.AppendError(
> +        llvm::formatv(
> +            "Thread index {0} is out of range (valid values are 1 - {1}).\n",
> +            tid, num_threads)
> +            .str());
>     return false;
>   } else {
>     TraceHTR htr(*thread, *trace_sp->GetCursor(*thread));
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list