]> granicus.if.org Git - clang/commitdiff
[Bash-autocompletion] Invoke clang where user called
authorYuka Takahashi <yukatkh@gmail.com>
Wed, 28 Jun 2017 16:29:26 +0000 (16:29 +0000)
committerYuka Takahashi <yukatkh@gmail.com>
Wed, 28 Jun 2017 16:29:26 +0000 (16:29 +0000)
Summary:
When user build clang and used completion Eg. `build/bin/clang -fno[tab]`, we want to invoke `build/bin/clang --autocomplete=-fno`, rather than `clang --autocomplete=-fno`.

Differential Revision: https://reviews.llvm.org/D34761

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306559 91177308-0d34-0410-b5e6-96231b3b80d8

utils/bash-autocomplete.sh

index 46e29b87bb54b504b305765ae02085bb7567e35b..775b1f45351ac3e13e2af7d8783501b72b186493 100644 (file)
@@ -24,7 +24,7 @@ _clang()
     arg="$w2=,$cur"
   fi
 
-  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then