[Lldb-commits] [PATCH] D137645: [trace] Add `SBTraceCursor::GetWallClockTime` API

Will Hawkins via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 11:08:23 PST 2022


hawkinsw added inline comments.


================
Comment at: lldb/source/API/SBTraceCursor.cpp:127-131
+double SBTraceCursor::GetWallClockTime() const {
+  LLDB_INSTRUMENT_VA(this);
+
+  const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime();
+  return maybe_wall_clock_time ? *maybe_wall_clock_time : -1.0;
----------------
wallace wrote:
> we don't have optionals in the SB bridge, so you could do the following
> 
>   bool SBTraceCursor::GetWallClockTime(double &time) {
>     if (const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime()) {
>       time = *maybe_wall_clock_time;
>       return true;
>     }
>     return false;
>   }
Not that it matters, but *that* was going to be my other suggestion! @wallace is smarter than I am!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137645/new/

https://reviews.llvm.org/D137645



More information about the lldb-commits mailing list