[all-commits] [llvm/llvm-project] 4fc93a: Allow signposts to take advantage of deferred stri...

adrian-prantl via All-commits all-commits at lists.llvm.org
Fri Jun 11 16:52:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4fc93a3a1f95ef5a0a57750fc621f2411ea445a8
      https://github.com/llvm/llvm-project/commit/4fc93a3a1f95ef5a0a57750fc621f2411ea445a8
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2021-06-11 (Fri, 11 Jun 2021)

  Changed paths:
    M lldb/include/lldb/Utility/Timer.h
    M lldb/source/Utility/Timer.cpp
    M llvm/include/llvm/Support/Signposts.h
    M llvm/lib/Support/Signposts.cpp
    M llvm/lib/Support/Timer.cpp

  Log Message:
  -----------
  Allow signposts to take advantage of deferred string substitution

One nice feature of the os_signpost API is that format string
substitutions happen in the consumer, not the logging
application. LLVM's current Signpost class doesn't take advantage of
this though and instead always uses a static "Begin/End %s" format
string.

This patch uses variadic macros to allow the API to be used as
intended. Unfortunately, the primary use-case I had in mind (the
LLDB_SCOPED_TIMER() macro) does not get much better from this, because
__PRETTY_FUNCTION__ is *not* a macro, but a static string, so
signposts created by LLDB_SCOPED_TIMER() still use a static "%s"
format string. At least LLDB_SCOPED_TIMERF() works as intended.

This reapplies the previsously reverted patch with support for
platforms where signposts are unavailable.

Differential Revision: https://reviews.llvm.org/D103575




More information about the All-commits mailing list