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

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 22:20:17 PST 2022


wallace accepted this revision.
wallace added inline comments.
This revision is now accepted and ready to land.


================
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;
----------------
hawkinsw wrote:
> 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!
<3


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