[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash
Yuka Takahashi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 28 09:00:12 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306555: [Bash-autocompletion] Check clang version in Bash (authored by yamaguchi).
Changed prior to commit:
https://reviews.llvm.org/D34607?vs=103884&id=104435#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34607
Files:
cfe/trunk/utils/bash-autocomplete.sh
Index: cfe/trunk/utils/bash-autocomplete.sh
===================================================================
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -1,7 +1,7 @@
# Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
_clang()
{
- local cur prev words cword arg
+ local cur prev words cword arg flags
_init_completion -n : || return
# bash always separates '=' as a token even if there's no space before/after '='.
@@ -24,7 +24,14 @@
arg="$w2=,$cur"
fi
- local flags=$( clang --autocomplete="$arg" )
+ flags=$( clang --autocomplete="$arg" 2>/dev/null )
+ # If clang is old that it does not support --autocomplete,
+ # fall back to the filename completion.
+ if [[ "$?" != 0 ]]; then
+ _filedir
+ return
+ fi
+
if [[ "$cur" == '=' ]]; then
COMPREPLY=( $( compgen -W "$flags" -- "") )
elif [[ "$flags" == "" || "$arg" == "" ]]; then
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34607.104435.patch
Type: text/x-patch
Size: 950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170628/9d043b2f/attachment.bin>
More information about the cfe-commits
mailing list