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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 04:34:57 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Mehdi Amini (joker-eph)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/159045.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/Statistic.h (+2-2) 


``````````diff
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; }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/159045


More information about the llvm-commits mailing list