[llvm] [Support] Remove a redundant declaration (NFC) (PR #166085)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 2 11:22:27 PST 2025


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

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 fae342de70332286600bcdeca7720c6b474dea5c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 2 Nov 2025 10:12:18 -0800
Subject: [PATCH] [Support] Remove a redundant declaration (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/StringRef.cpp | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index b6a2f8aeadccf..2e8fba8cbfa37 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -17,11 +17,6 @@
 
 using namespace llvm;
 
-// MSVC emits references to this into the translation units which reference it.
-#ifndef _MSC_VER
-constexpr size_t StringRef::npos;
-#endif
-
 // strncasecmp() is not available on non-POSIX systems, so define an
 // alternative function here.
 static int ascii_strncasecmp(StringRef LHS, StringRef RHS) {



More information about the llvm-commits mailing list