Skip to content

Conversation

@Michael137
Copy link
Member

In #137947 I refactored the script and added a copy_files function, which takes the header files to copy as an argument.

But because the list of headers is a space separated string, we need to quote the string. Otherwise we would just copy the first header in the list.

This patch also adds an echo statement in the copy_files loop to print the source/destination. Confirming that the files are copied as expected.

$ libcxxabi/src/demangle/cp-to-llvm.sh
This will overwrite the copies of ItaniumDemangle.h ItaniumNodes.def StringViewExtras.h Utility.h in ../../../llvm/include/llvm/Demangle and DemangleTestCases.inc in ../../../llvm/include/llvm/Demangle/../Testing/Demangle; are you sure? [y/N]y
Copying ./ItaniumDemangle.h to ../../../llvm/include/llvm/Demangle/ItaniumDemangle.h
Copying ./ItaniumNodes.def to ../../../llvm/include/llvm/Demangle/ItaniumNodes.def
Copying ./StringViewExtras.h to ../../../llvm/include/llvm/Demangle/StringViewExtras.h
Copying ./Utility.h to ../../../llvm/include/llvm/Demangle/Utility.h
Copying ../../test/DemangleTestCases.inc to ../../../llvm/include/llvm/Demangle/../Testing/Demangle/DemangleTestCases.inc

Luckily there weren't any out-of-sync changes introduced in the meantime.

@Michael137 Michael137 requested a review from a team as a code owner November 5, 2025 15:42
@Michael137 Michael137 changed the title [libcxxabi][demangle] Fix the cp-to-llvm.sh sync script [libcxxabi][demangle] Fix the cp-to-llvm.sh sync script to copy all headers Nov 5, 2025
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Nov 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 5, 2025

@llvm/pr-subscribers-libcxxabi

Author: Michael Buch (Michael137)

Changes

In #137947 I refactored the script and added a copy_files function, which takes the header files to copy as an argument.

But because the list of headers is a space separated string, we need to quote the string. Otherwise we would just copy the first header in the list.

This patch also adds an echo statement in the copy_files loop to print the source/destination. Confirming that the files are copied as expected.

$ libcxxabi/src/demangle/cp-to-llvm.sh
This will overwrite the copies of ItaniumDemangle.h ItaniumNodes.def StringViewExtras.h Utility.h in ../../../llvm/include/llvm/Demangle and DemangleTestCases.inc in ../../../llvm/include/llvm/Demangle/../Testing/Demangle; are you sure? [y/N]y
Copying ./ItaniumDemangle.h to ../../../llvm/include/llvm/Demangle/ItaniumDemangle.h
Copying ./ItaniumNodes.def to ../../../llvm/include/llvm/Demangle/ItaniumNodes.def
Copying ./StringViewExtras.h to ../../../llvm/include/llvm/Demangle/StringViewExtras.h
Copying ./Utility.h to ../../../llvm/include/llvm/Demangle/Utility.h
Copying ../../test/DemangleTestCases.inc to ../../../llvm/include/llvm/Demangle/../Testing/Demangle/DemangleTestCases.inc

Luckily there weren't any out-of-sync changes introduced in the meantime.


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

1 Files Affected:

  • (modified) libcxxabi/src/demangle/cp-to-llvm.sh (+3-2)
diff --git a/libcxxabi/src/demangle/cp-to-llvm.sh b/libcxxabi/src/demangle/cp-to-llvm.sh
index f773dff9f0a8b..8244837900b33 100755
--- a/libcxxabi/src/demangle/cp-to-llvm.sh
+++ b/libcxxabi/src/demangle/cp-to-llvm.sh
@@ -42,6 +42,7 @@ copy_files() {
     chmod -w $dst/README.txt
 
     for I in $hdrs ; do
+	    echo "Copying ${src}/$I to ${dst}/$I"
 	    rm -f $dst/$I
 	    dash=$(echo "$I---------------------------" | cut -c -27 |\
 		       sed 's|[^-]*||')
@@ -53,6 +54,6 @@ copy_files() {
 }
 
 if [[ $ANSWER =~ ^[Yy]$ ]]; then
-    copy_files . $LLVM_DEMANGLE_DIR $HDRS
-    copy_files ../../test $LLVM_TESTING_DIR $TEST_HDRS
+    copy_files . $LLVM_DEMANGLE_DIR "$HDRS"
+    copy_files ../../test $LLVM_TESTING_DIR "$TEST_HDRS"
 fi

In llvm#137947 I refactored the script and added a `copy_files` function, which takes the header files to copy as an argument.

But because the list of headers is a space separated string, we need to quote the string. Otherwise we would just copy the first header in the list.

This patch also adds an `echo` statement in the `copy_files` loop to print the source/destination. Confirming that the files are copied as expected.
```
$ libcxxabi/src/demangle/cp-to-llvm.sh
This will overwrite the copies of ItaniumDemangle.h ItaniumNodes.def StringViewExtras.h Utility.h in ../../../llvm/include/llvm/Demangle and DemangleTestCases.inc in ../../../llvm/include/llvm/Demangle/../Testing/Demangle; are you sure? [y/N]y
Copying ./ItaniumDemangle.h to ../../../llvm/include/llvm/Demangle/ItaniumDemangle.h
Copying ./ItaniumNodes.def to ../../../llvm/include/llvm/Demangle/ItaniumNodes.def
Copying ./StringViewExtras.h to ../../../llvm/include/llvm/Demangle/StringViewExtras.h
Copying ./Utility.h to ../../../llvm/include/llvm/Demangle/Utility.h
Copying ../../test/DemangleTestCases.inc to ../../../llvm/include/llvm/Demangle/../Testing/Demangle/DemangleTestCases.inc
```
@Michael137 Michael137 force-pushed the libcxxabi/fix-sync-script branch from 99421bf to cde0e83 Compare November 5, 2025 15:43
@Michael137
Copy link
Member Author

Bootstrap CI failure seems unrelated:

  /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:391:5: error: no matching function for call to 'setExplicitlyUnknownBranchWeightsIfProfiled'
    391 |     setExplicitlyUnknownBranchWeightsIfProfiled(*BR, *BR->getFunction(),
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/ProfDataUtils.h:200:1: note: candidate function not viable: no known conversion from 'Function' to 'StringRef' for 2nd argument
    200 | setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I, StringRef PassName,
        | ^                                                           ~~~~~~~~~~~~~~~~~~
  /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:3206:3: error: no matching function for call to 'setExplicitlyUnknownBranchWeightsIfProfiled'
   3206 |   setExplicitlyUnknownBranchWeightsIfProfiled(
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/ProfDataUtils.h:200:1: note: candidate function not viable: no known conversion from 'Function' to 'StringRef' for 2nd argument
    200 | setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I, StringRef PassName,
        | ^                                                           ~~~~~~~~~~~~~~~~~~
  2 errors generated.

@Michael137 Michael137 merged commit d49c670 into llvm:main Nov 5, 2025
63 of 65 checks passed
@Michael137 Michael137 deleted the libcxxabi/fix-sync-script branch November 5, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++abi libc++abi C++ Runtime Library. Not libc++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants