Skip to content

Commit c1970c7

Browse files
[libcxxabi] Add test to assert that ItaniumDemangle.h is the same (#140323)
ItaniumDemangle.h exists in both llvm/ and libcxxabi/. These files are supposed to be copies of each other (minus the top two lines). This patch adds a test to assert that this is the case to enable tooling to automatically detect this as an issue, like in #139825. This makes it easier for contributors unfamiliar with the duplication to make changes/get appropriate reviews. Ideally we would share the file and copy it from one place to the other but the ideal way to do this (based on previous discussion with libc++ maintainers) would be a new runtime library that clearly outlines requirements, so that is left for later with the test being used as a stopgap. This is a relatively common approach for structures shared between compiler-rt and LLVM. This patch does make the test reference the LLVM source directory, but that should be fine given building libcxxabi is only supported through the runtimes build in the monorepo meaning it should always be available.
1 parent 2186c95 commit c1970c7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libcxxabi/test/configs/cmake-bridge.cfg.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ config.test_exec_root = os.path.join('@LIBCXXABI_BINARY_DIR@', 'test')
2727
config.host_triple = '@LLVM_HOST_TRIPLE@'
2828

2929
config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
30+
config.substitutions.append(('%{libcxxabi}', '@LIBCXXABI_SOURCE_DIR@'))
31+
config.substitutions.append(('%{llvm}', '@LLVM_MAIN_SRC_DIR@'))
3032
config.substitutions.append(('%{install-prefix}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@'))
3133
config.substitutions.append(('%{include}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/include'))
3234
config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/@LIBCXXABI_INSTALL_INCLUDE_DIR@'))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This test diffs the ItaniumDemangle.h header in libcxxabi and LLVM to ensure
2+
# that they are the same.
3+
4+
# RUN: tail -n +3 %{libcxxabi}/src/demangle/ItaniumDemangle.h > %t.libcxxabi_demangle
5+
# RUN: tail -n +3 %{llvm}/include/llvm/Demangle/ItaniumDemangle.h > %t.llvm_demangle
6+
# RUN: diff %t.libcxxabi_demangle %t.llvm_demangle

0 commit comments

Comments
 (0)