diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-02-27 13:00:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-02-27 13:03:55 +0100 |
commit | ea78ef69ffcf432a9e03bb9616cc46427cf09e31 (patch) | |
tree | b4bcf6f7d5da11a0fea7e37f272fde3b29ce8db0 | |
parent | 3ce714de3b5319efeee3f713c82d58649b3e0098 (diff) |
clang: sync find-unprefixed-members-wrapper with clang-rename-wrapper
They are meant to be mostly the same, except the name of the tool.
-rwxr-xr-x | clang/bin/find-unprefixed-members-wrapper | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/clang/bin/find-unprefixed-members-wrapper b/clang/bin/find-unprefixed-members-wrapper index a39cf6c1..8459afaa 100755 --- a/clang/bin/find-unprefixed-members-wrapper +++ b/clang/bin/find-unprefixed-members-wrapper @@ -1,32 +1,45 @@ #!/bin/bash -RENAME_CSV=/tmp/rename.csv - mydir=$(dirname $0) +myname=find-unprefixed-members if [ -h $0 ]; then mydir=$(dirname $(readlink -f $0)) fi c= +o= +file= for i in "$@" do if [ "$i" = "-c" ]; then c=1 + elif [ "$i" = "-o" ]; then + o=1 + elif [ -n "$o" ]; then + o= elif [ -n "$c" ]; then file=$i break fi done -if [ -n "$c" ] && ! $mydir/find-unprefixed-members $RENAME_ARGS $file -- "$@" 2> "$RENAME_CSV" ; then - echo "Found the members to rename, please see $RENAME_CSV:" - echo - cat "$RENAME_CSV" - echo - exit 1 +ret=0 +if [ -n "$file" ]; then + if [ "$myname" == "clang-rename" ]; then + mkdir -p /tmp/rename + RENAME_ARGS="$RENAME_ARGS -export-fixes=$(mktemp -p /tmp/rename XXXXXXXXXX.yaml)" + fi + # Avoid "error: unable to find plugin 'loplugin'". + args="$(echo "$@"|sed "s|-Xclang -load -Xclang $SRC_ROOT/compilerplugins/clang/plugin.so -Xclang -add-plugin -Xclang loplugin||")" + $mydir/$myname $RENAME_ARGS $file -- $args + ret=$? +fi + +# gbuild detected or error: no need to call the real compiler +if [ $ret -gt 0 -o -n "$COMPILER_EXTERNAL_TOOL" ]; then + exit $ret fi -# run the compiler if we did not find what we wanted (yet) -exec -- "$@" +exec "$@" # vi:set shiftwidth=4 expandtab: |