[llvm] [Support] Remove redundant declarations (NFC) (PR #166106)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 2 14:54:29 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/166106

In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.

Identified with readability-redundant-declaration.


>From d65ab0a00ccdab74d043813c0a1c56024369a24f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 2 Nov 2025 13:58:02 -0800
Subject: [PATCH] [Support] Remove redundant declarations (NFC)

In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.

Identified with readability-redundant-declaration.
---
 llvm/lib/Support/BranchProbability.cpp            | 2 --
 llvm/unittests/Support/raw_ostream_proxy_test.cpp | 2 --
 2 files changed, 4 deletions(-)

diff --git a/llvm/lib/Support/BranchProbability.cpp b/llvm/lib/Support/BranchProbability.cpp
index ea42f34b58645..143e58a05d3b7 100644
--- a/llvm/lib/Support/BranchProbability.cpp
+++ b/llvm/lib/Support/BranchProbability.cpp
@@ -20,8 +20,6 @@
 
 using namespace llvm;
 
-constexpr uint32_t BranchProbability::D;
-
 raw_ostream &BranchProbability::print(raw_ostream &OS) const {
   if (isUnknown())
     return OS << "?%";
diff --git a/llvm/unittests/Support/raw_ostream_proxy_test.cpp b/llvm/unittests/Support/raw_ostream_proxy_test.cpp
index 864dda712aac8..446e64aa1ff59 100644
--- a/llvm/unittests/Support/raw_ostream_proxy_test.cpp
+++ b/llvm/unittests/Support/raw_ostream_proxy_test.cpp
@@ -40,8 +40,6 @@ class BufferedNoPwriteSmallVectorStream : public raw_ostream {
   bool IsDisplayed = false;
 };
 
-constexpr size_t BufferedNoPwriteSmallVectorStream::PreferredBufferSize;
-
 TEST(raw_ostream_proxyTest, write) {
   // Besides confirming that "write" works, this test confirms that the proxy
   // takes on the buffer from the stream it's proxying, such that writes to the



More information about the llvm-commits mailing list