[Lldb-commits] [lldb] 564eb20 - Revert "[lldb] Avoid format string in LLDB_SCOPED_TIMER"

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue May 25 17:23:12 PDT 2021


Author: Jonas Devlieghere
Date: 2021-05-25T17:22:51-07:00
New Revision: 564eb20e0deecd173a7b990dcfd0e57fb045c522

URL: https://github.com/llvm/llvm-project/commit/564eb20e0deecd173a7b990dcfd0e57fb045c522
DIFF: https://github.com/llvm/llvm-project/commit/564eb20e0deecd173a7b990dcfd0e57fb045c522.diff

LOG: Revert "[lldb] Avoid format string in LLDB_SCOPED_TIMER"

Right after pushing, I remembered that this was added to silence a GCC
warning (https://reviews.llvm.org/D99120). This reverts my patch and
adds a comment.

Added: 
    

Modified: 
    lldb/include/lldb/Utility/Timer.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/Timer.h b/lldb/include/lldb/Utility/Timer.h
index edc064b23b57..0249c697b8ed 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -74,9 +74,11 @@ class Timer {
 
 } // namespace lldb_private
 
+// Use a format string because LLVM_PRETTY_FUNCTION might not be a string
+// literal.
 #define LLDB_SCOPED_TIMER()                                                    \
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);           \
-  ::lldb_private::Timer _scoped_timer(_cat, LLVM_PRETTY_FUNCTION)
+  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION)
 #define LLDB_SCOPED_TIMERF(...)                                                \
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);           \
   ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)


        


More information about the lldb-commits mailing list