[llvm] ff25184 - Make NoopStatistic constructor constexpr (NFC) (#159045)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 05:16:54 PDT 2025


Author: Mehdi Amini
Date: 2025-09-16T12:16:50Z
New Revision: ff25184f356e0e2fa6e3606160b30f7da9ea525c

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

LOG: Make NoopStatistic constructor constexpr (NFC) (#159045)

This makes it friendly to -Wglobal-constructors environments. This class
is used when Statistics are disabled, the matching class,
TrackingStatistic, was made constexpr a while back already in
7e5682ee6201c for other reasons.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/Statistic.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h
index 082e6d50577fa..795b0c2082c77 100644
--- a/llvm/include/llvm/ADT/Statistic.h
+++ b/llvm/include/llvm/ADT/Statistic.h
@@ -131,8 +131,8 @@ class TrackingStatistic {
 
 class NoopStatistic {
 public:
-  NoopStatistic(const char * /*DebugType*/, const char * /*Name*/,
-                const char * /*Desc*/) {}
+  constexpr NoopStatistic(const char * /*DebugType*/, const char * /*Name*/,
+                          const char * /*Desc*/) {}
 
   uint64_t getValue() const { return 0; }
 


        


More information about the llvm-commits mailing list