[llvm-branch-commits] [clang-tools-extra] [clang-doc][nfc] Silence tidy warning about anonymous namespace (PR #198071)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 15 23:57:26 PDT 2026


https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/198071

clang-tidy complains that we should prefer static over the anonymous
namespace, despite the API being static in addition to being in the
anonymous namespace. We can silence the diagnostic by simply removing
the namespace declaration.

>From fc9cbe010aeb4c38122e7fe60e2d63daf8ba4e39 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Sat, 16 May 2026 01:47:30 +0000
Subject: [PATCH] [clang-doc][nfc] Silence tidy warning about anonymous
 namespace

clang-tidy complains that we should prefer static over the anonymous
namespace, despite the API being static in addition to being in the
anonymous namespace. We can silence the diagnostic by simply removing
the namespace declaration.
---
 clang-tools-extra/clang-doc/Serialize.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp
index f19b8da83e46b..b107af26cde27 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -26,7 +26,6 @@ namespace clang {
 namespace doc {
 namespace serialize {
 
-namespace {
 static StringRef exprToString(const clang::Expr *E) {
   clang::LangOptions Opts;
   clang::PrintingPolicy Policy(Opts);
@@ -35,7 +34,6 @@ static StringRef exprToString(const clang::Expr *E) {
   E->printPretty(OS, nullptr, Policy);
   return internString(Result);
 }
-} // namespace
 
 SymbolID hashUSR(llvm::StringRef USR) {
   return llvm::SHA1::hash(arrayRefFromStringRef(USR));



More information about the llvm-branch-commits mailing list