summaryrefslogtreecommitdiffstats
path: root/clang/utils/bash-autocomplete.sh
diff options
context:
space:
mode:
authorYuka Takahashi <yukatkh@gmail.com>2017-07-15 09:09:51 +0000
committerYuka Takahashi <yukatkh@gmail.com>2017-07-15 09:09:51 +0000
commit8561c2e22c3af9295bd89764810f126e72fba50b (patch)
tree276533e4ad564168d6cec7bf4650dd065e712d56 /clang/utils/bash-autocomplete.sh
parent4fc09cb33328796b5d70ecd28ff5816628c710a4 (diff)
downloadbcm5719-llvm-8561c2e22c3af9295bd89764810f126e72fba50b.tar.gz
bcm5719-llvm-8561c2e22c3af9295bd89764810f126e72fba50b.zip
[Bash-autocompletion] Fixed a bug on bash
Summary: Maybe I mismerged when merging previous commits by hand. Differential Revision: https://reviews.llvm.org/D35448 llvm-svn: 308091
Diffstat (limited to 'clang/utils/bash-autocomplete.sh')
-rw-r--r--clang/utils/bash-autocomplete.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/utils/bash-autocomplete.sh b/clang/utils/bash-autocomplete.sh
index 1e38bcfcaad..72531b99e3d 100644
--- a/clang/utils/bash-autocomplete.sh
+++ b/clang/utils/bash-autocomplete.sh
@@ -20,18 +20,21 @@ _clang()
cur="${COMP_WORDS[$cword]}"
fi
- # bash always separates '=' as a token even if there's no space before/after '='.
- # On the other hand, '=' is just a regular character for clang options that
- # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
- # So, we need to partially undo bash tokenization here for integrity.
w1="${COMP_WORDS[$cword - 1]}"
if [[ $cword > 1 ]]; then
w2="${COMP_WORDS[$cword - 2]}"
+ fi
+
# Clang want to know if -cc1 or -Xclang option is specified or not, because we don't want to show
# cc1 options otherwise.
if [[ "${COMP_WORDS[1]}" == "-cc1" || "$w1" == "-Xclang" ]]; then
arg="#"
fi
+
+ # bash always separates '=' as a token even if there's no space before/after '='.
+ # On the other hand, '=' is just a regular character for clang options that
+ # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
+ # So, we need to partially undo bash tokenization here for integrity.
if [[ "$cur" == -* ]]; then
# -foo<tab>
arg="$arg$cur"
OpenPOWER on IntegriCloud