clang/bin/find-unprefixed-members-wrapper |   33 ++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

New commits:
commit ea78ef69ffcf432a9e03bb9616cc46427cf09e31
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Feb 27 13:00:39 2023 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Feb 27 13:03:55 2023 +0100

    clang: sync find-unprefixed-members-wrapper with clang-rename-wrapper
    
    They are meant to be mostly the same, except the name of the tool.

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:

Reply via email to