[libcxx-commits] [libcxx] 4668dd8 - [libc++] Run clang-tidy in all configurations that are run in the Docker container
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 28 10:15:09 PST 2023
Author: Nikolas Klauser
Date: 2023-02-28T19:14:58+01:00
New Revision: 4668dd8c4ab156effda831a3f736c3f97c1265ab
URL: https://github.com/llvm/llvm-project/commit/4668dd8c4ab156effda831a3f736c3f97c1265ab
DIFF: https://github.com/llvm/llvm-project/commit/4668dd8c4ab156effda831a3f736c3f97c1265ab.diff
LOG: [libc++] Run clang-tidy in all configurations that are run in the Docker container
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D143333
Added:
Modified:
libcxx/include/__atomic/atomic_sync.h
libcxx/include/__debug
libcxx/include/__tree
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
libcxx/utils/ci/buildkite-pipeline.yml
Removed:
################################################################################
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index 114bc50d5c8a1..939487aee7446 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -78,7 +78,7 @@ _LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const
template <class _Atp, class _Fn>
_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn)
{
- return __libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
}
#endif // _LIBCPP_HAS_NO_THREADS
diff --git a/libcxx/include/__debug b/libcxx/include/__debug
index 140cc9142a82b..ccbfae72320ba 100644
--- a/libcxx/include/__debug
+++ b/libcxx/include/__debug
@@ -98,8 +98,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _Cp = static_cast<_Cont*>(__c_);
- return _Cp->__dereferenceable(__j);
+ _Cont* __cp = static_cast<_Cont*>(__c_);
+ return __cp->__dereferenceable(__j);
}
template <class _Cont>
@@ -108,8 +108,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _Cp = static_cast<_Cont*>(__c_);
- return _Cp->__decrementable(__j);
+ _Cont* __cp = static_cast<_Cont*>(__c_);
+ return __cp->__decrementable(__j);
}
template <class _Cont>
@@ -118,8 +118,8 @@ _C_node<_Cont>::__addable(const void* __i, ptr
diff _t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _Cp = static_cast<_Cont*>(__c_);
- return _Cp->__addable(__j, __n);
+ _Cont* __cp = static_cast<_Cont*>(__c_);
+ return __cp->__addable(__j, __n);
}
template <class _Cont>
@@ -128,8 +128,8 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptr
diff _t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _Cp = static_cast<_Cont*>(__c_);
- return _Cp->__subscriptable(__j, __n);
+ _Cont* __cp = static_cast<_Cont*>(__c_);
+ return __cp->__subscriptable(__j, __n);
}
class _LIBCPP_TYPE_VIS __libcpp_db
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 7f657dc5b883b..672b92c7796ea 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -375,7 +375,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
{
_LIBCPP_ASSERT(__root != nullptr, "Root node should not be null");
_LIBCPP_ASSERT(__z != nullptr, "The node to remove should not be null");
- _LIBCPP_DEBUG_ASSERT(__tree_invariant(__root), "The tree invariants should hold");
+ _LIBCPP_DEBUG_ASSERT(std::__tree_invariant(__root), "The tree invariants should hold");
// __z will be removed from the tree. Client still needs to destruct/deallocate it
// __y is either __z, or if __z has two children, __tree_next(__z).
// __y will have at most one child.
diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
index f1664eee1f6e8..0e437d0a24308 100644
--- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -45,7 +45,16 @@ target_include_directories(clangTidy INTERFACE
${CLANG_INCLUDE_DIRS}
${LLVM_INCLUDE_DIRS}
)
-target_compile_options(clangTidy INTERFACE -fno-rtti)
+target_compile_options(clangTidy INTERFACE
+ -fno-rtti
+ -fno-sanitize=address,hwaddress,undefined,thread,leak # ignore any sanitizers
+ )
+
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ target_compile_options(clangTidy INTERFACE
+ -fno-sanitize=memory,dataflow
+ )
+endif()
add_library(cxx-tidy MODULE ${SOURCES})
target_link_libraries(cxx-tidy clangTidy)
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index d4fe17aaa7d29..f4ff83a67a531 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -97,6 +97,7 @@ steps:
env:
CC: "gcc-${GCC_STABLE_VERSION}"
CXX: "g++-${GCC_STABLE_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -132,6 +133,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -245,6 +247,7 @@ steps:
env:
CC: "gcc-${GCC_STABLE_VERSION}"
CXX: "g++-${GCC_STABLE_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -262,6 +265,8 @@ steps:
env:
CC: "clang-15"
CXX: "clang++-15"
+ # TODO LLVM18: Enable clang-tidy
+ # ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -279,6 +284,7 @@ steps:
env:
CC: "clang-16"
CXX: "clang++-16"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -299,6 +305,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -316,6 +323,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -333,6 +341,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -350,6 +359,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -389,6 +399,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -406,6 +417,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -423,6 +435,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -440,6 +453,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -457,6 +471,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -474,6 +489,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -493,6 +509,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -510,6 +527,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -527,6 +545,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -544,6 +563,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -561,6 +581,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -578,6 +599,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -595,6 +617,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -612,6 +635,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -629,6 +653,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -646,6 +671,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
@@ -664,6 +690,7 @@ steps:
env:
CC: "clang-${LLVM_HEAD_VERSION}"
CXX: "clang++-${LLVM_HEAD_VERSION}"
+ ENABLE_CLANG_TIDY: "On"
agents:
queue: "libcxx-builders"
os: "linux"
More information about the libcxx-commits
mailing list