Skip to content

Commit 56fb8b7

Browse files
committed
[libc] Update libc namespace clang-tidy checks
Namespace macro that should be used to declare a new namespace is updated from LIBC_NAMESPACE to LIBC_NAMESPACE_DECL which by default has hidden visibility (#97109). This commit updates the clang-tidy checks to match the new policy.
1 parent 97dc508 commit 56fb8b7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

clang-tools-extra/clang-tidy/llvmlibc/ImplementationInNamespaceCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ void ImplementationInNamespaceCheck::check(
3333
if (NS == nullptr || NS->isAnonymousNamespace()) {
3434
diag(MatchedDecl->getLocation(),
3535
"declaration must be enclosed within the '%0' namespace")
36-
<< RequiredNamespaceMacroName;
36+
<< RequiredNamespaceHiddenMacroName;
3737
return;
3838
}
3939
if (Result.SourceManager->isMacroBodyExpansion(NS->getLocation()) == false) {
4040
diag(NS->getLocation(), "the outermost namespace should be the '%0' macro")
41-
<< RequiredNamespaceMacroName;
41+
<< RequiredNamespaceHiddenMacroName;
4242
return;
4343
}
4444
if (NS->getName().starts_with(RequiredNamespaceStart) == false) {
4545
diag(NS->getLocation(), "the '%0' macro should start with '%1'")
46-
<< RequiredNamespaceMacroName << RequiredNamespaceStart;
46+
<< RequiredNamespaceHiddenMacroName << RequiredNamespaceStart;
4747
return;
4848
}
4949
}

clang-tools-extra/clang-tidy/llvmlibc/NamespaceConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
namespace clang::tidy::llvm_libc {
1212

1313
const static llvm::StringRef RequiredNamespaceStart = "__llvm_libc";
14+
const static llvm::StringRef RequiredNamespaceHiddenMacroName =
15+
"LIBC_NAMESPACE_DECL";
1416
const static llvm::StringRef RequiredNamespaceMacroName = "LIBC_NAMESPACE";
1517

1618
} // namespace clang::tidy::llvm_libc

0 commit comments

Comments
 (0)