diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-15 09:09:51 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-15 09:09:51 +0000 |
commit | db5402516165f52f4c97200e95022b6e775bba1b (patch) | |
tree | 61e0d6a7ca662a8a8d6ed71fbbecb6c6afef6afd /utils/bash-autocomplete.sh | |
parent | 07af1d2a4e1c80ccd8fbafe785c163a8ca43cec3 (diff) | |
download | clang-db5402516165f52f4c97200e95022b6e775bba1b.tar.gz |
[Bash-autocompletion] Fixed a bug on bash
Summary: Maybe I mismerged when merging previous commits by hand.
Differential Revision: https://reviews.llvm.org/D35448
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/bash-autocomplete.sh')
-rw-r--r-- | utils/bash-autocomplete.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh index 1e38bcfcaa..72531b99e3 100644 --- a/utils/bash-autocomplete.sh +++ b/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" |