[llvm] Make NoopStatistic constructor constexpr (NFC) (PR #159045)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 04:34:19 PDT 2025
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/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.
>From 2da5d5dd50c959cfaa14085d3f01d009a4e69011 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Tue, 16 Sep 2025 04:31:16 -0700
Subject: [PATCH] Make NoopStatistic constructor constexpr (NFC)
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.
---
llvm/include/llvm/ADT/Statistic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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