[libcxx] [llvm] [libc++][NFC] Make AssertionInfoMatcher::CheckMessageMatches Stricter (PR #77721)
Will Hawkins via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 22:29:27 PST 2024
https://github.com/hawkinsw updated https://github.com/llvm/llvm-project/pull/77721
>From ede4846a1379341a7b9a3da16eddd917e95ef6cb Mon Sep 17 00:00:00 2001
From: Will Hawkins <hawkinsw at obs.cr>
Date: Wed, 10 Jan 2024 22:35:32 -0500
Subject: [PATCH 1/2] [libc++][NFC] Make
AssertionInfoMatcher::CheckMessageMatches Stricter
Rather than allow for a message to be considered a match for the actual
assertion if it is anywhere in the assertion text, make sure that the
expected and the actual assertion are identical.
---
libcxx/test/support/check_assertion.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libcxx/test/support/check_assertion.h b/libcxx/test/support/check_assertion.h
index 98dd95b11556e6..01e296d9138d0c 100644
--- a/libcxx/test/support/check_assertion.h
+++ b/libcxx/test/support/check_assertion.h
@@ -89,8 +89,7 @@ struct AssertionInfoMatcher {
std::size_t found_at = got_msg.find(msg_);
if (found_at == std::string_view::npos)
return false;
- // Allow any match
- return true;
+ return found_at == 0 && got_msg.size() == msg_.size();
}
private:
bool is_empty_;
>From 0d572b2d39b454b7676a1e2d6e411079a3130c83 Mon Sep 17 00:00:00 2001
From: Will Hawkins <hawkinsw at obs.cr>
Date: Thu, 11 Jan 2024 01:29:10 -0500
Subject: [PATCH 2/2] fixup! [libc++][NFC] Make
AssertionInfoMatcher::CheckMessageMatches Stricter
Fix a few locations where matches were not precise.
---
.../containers/views/mdspan/layout_left/assert.stride.pass.cpp | 2 +-
.../containers/views/mdspan/layout_right/assert.stride.pass.cpp | 2 +-
.../views/mdspan/layout_stride/assert.stride.pass.cpp | 2 +-
llvm/cmake/modules/LLVMExternalProjectUtils.cmake | 2 ++
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
index 96af460d695db3..e54cf8678ea716 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp
@@ -35,7 +35,7 @@ int main(int, char**) {
{
std::layout_left::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}};
- TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
+ TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_left::mapping::stride(): invalid rank index");
}
return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
index fe5376b480c084..9cc5ad72f9349c 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp
@@ -35,7 +35,7 @@ int main(int, char**) {
{
std::layout_right::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}};
- TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
+ TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_right::mapping::stride(): invalid rank index");
}
return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
index b3b69549b2ebee..5ae141389da4ec 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp
@@ -30,7 +30,7 @@ int main(int, char**) {
std::layout_stride::mapping<std::dextents<int, 3>> m(
std::dextents<int, 3>(100, 100, 100), std::array<int, 3>{1, 100, 10000});
- TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
+ TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_stride::mapping::stride(): invalid rank index");
}
return 0;
}
diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 2089f979acd008..1d6e3ac4323b2b 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -349,6 +349,8 @@ function(llvm_ExternalProject_Add name source_dir)
-DPACKAGE_VERSION=${PACKAGE_VERSION}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
+ -DLLVM_ENABLE_SPHINX=${LLVM_ENABLE_SPHINX}
+ -DLLVM_BUILD_DOCS=${LLVM_BUILD_DOCS}
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
${cmake_args}
${PASSTHROUGH_VARIABLES}
More information about the llvm-commits
mailing list