[libc-commits] [libc] [libc] Establish clean baseline for implementation-in-namespace (PR #231639)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 13 12:59:47 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Jeff Bailey (kaladron)

<details>
<summary>Changes</summary>

Scope libc/src/.clang-tidy down to llvmlibc-implementation-in-namespace with WarningsAsErrors to establish a 100% green baseline.

Add NOLINT comments to replaceable global allocation functions in new.cpp which must reside in the global namespace. Disable default clang-analyzer checks in libc/.clang-tidy with a leading '-*'.

Assisted-by: Automated tooling, human reviewed.

---
Full diff: https://github.com/llvm/llvm-project/pull/231639.diff


3 Files Affected:

- (modified) libc/.clang-tidy (+1-1) 
- (modified) libc/src/.clang-tidy (+2-5) 
- (modified) libc/src/__support/CPP/new.cpp (+9-1) 


``````````diff
diff --git a/libc/.clang-tidy b/libc/.clang-tidy
index dbde88928ee636..1b10533953f265 100644
--- a/libc/.clang-tidy
+++ b/libc/.clang-tidy
@@ -1,5 +1,5 @@
 InheritParentConfig: false
-Checks: 'readability-identifier-naming'
+Checks: '-*,readability-identifier-naming'
 HeaderFilterRegex: '.*'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase
diff --git a/libc/src/.clang-tidy b/libc/src/.clang-tidy
index 1c79b1cf6aae6f..e38038fa826eeb 100644
--- a/libc/src/.clang-tidy
+++ b/libc/src/.clang-tidy
@@ -1,7 +1,4 @@
 InheritParentConfig: true
-Checks: '-*,llvmlibc-*,readability-identifier-naming,llvm-header-guard'
+Checks: '-*,llvmlibc-implementation-in-namespace'
 HeaderFilterRegex: '.*'
-WarningsAsErrors: 'llvmlibc-*'
-CheckOptions:
-  - key:             llvmlibc-restrict-system-libc-headers.Includes
-    value:           '-*, linux/*, asm/*.h, asm-generic/*.h'
+WarningsAsErrors: '*'
diff --git a/libc/src/__support/CPP/new.cpp b/libc/src/__support/CPP/new.cpp
index 65f80de3734851..345811181878be 100644
--- a/libc/src/__support/CPP/new.cpp
+++ b/libc/src/__support/CPP/new.cpp
@@ -8,13 +8,17 @@
 
 #include "new.h"
 #include "hdr/func/free.h"
-
+// Replaceable global allocation functions must live in the global namespace.
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete(void *mem) noexcept { ::free(mem); }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete(void *mem, std::align_val_t) noexcept { ::free(mem); }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete(void *mem, size_t) noexcept { ::free(mem); }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete(void *mem, size_t, std::align_val_t) noexcept {
 #ifdef LIBC_TARGET_OS_IS_WINDOWS
   ::_aligned_free(mem);
@@ -23,8 +27,10 @@ void operator delete(void *mem, size_t, std::align_val_t) noexcept {
 #endif
 }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete[](void *mem) noexcept { ::free(mem); }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete[](void *mem, std::align_val_t) noexcept {
 #ifdef LIBC_TARGET_OS_IS_WINDOWS
   ::_aligned_free(mem);
@@ -33,8 +39,10 @@ void operator delete[](void *mem, std::align_val_t) noexcept {
 #endif
 }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete[](void *mem, size_t) noexcept { ::free(mem); }
 
+// NOLINTNEXTLINE(llvmlibc-implementation-in-namespace): global namespace
 void operator delete[](void *mem, size_t, std::align_val_t) noexcept {
 #ifdef LIBC_TARGET_OS_IS_WINDOWS
   ::_aligned_free(mem);

``````````

</details>


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


More information about the libc-commits mailing list