[clang-tools-extra] [clang-tidy][NFC] Prefer `static constexpr` over `static const` where possible (PR #173406)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 23 11:35:44 PST 2025


================
@@ -19,12 +19,14 @@ namespace optutils = clang::tidy::utils::options;
 
 namespace clang::tidy::readability {
 
-static const StringRef CompareMessage = "do not use 'compare' to test equality "
-                                        "of strings; use the string equality "
-                                        "operator instead";
-
-static const StringRef DefaultStringLikeClasses = "::std::basic_string;"
-                                                  "::std::basic_string_view";
+static constexpr StringRef CompareMessage =
+    "do not use 'compare' to test equality "
+    "of strings; use the string equality "
+    "operator instead";
----------------
EugeneZelenko wrote:

```suggestion
    "do not use 'compare' to test equality of strings; use the string "
    "equality operator instead";
```

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


More information about the cfe-commits mailing list