summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-07-28 21:25:21 +0000
committerHans Wennborg <hans@hanshq.net>2017-07-28 21:25:21 +0000
commita2e91b76cde21cad4d160e3b078deda5b9b41af2 (patch)
treeb0d10f68555ec67f962b55776c8319523388e017
parent5ca288a74db287f2b94e7723f74a224c8f20056a (diff)
Merging r309112:
------------------------------------------------------------------------ r309112 | yamaguchi | 2017-07-26 06:30:36 -0700 (Wed, 26 Jul 2017) | 7 lines [Bash-completion] Fixed a bug that file doesn't autocompleted after = Summary: File path wasn't autocompleted after `-fmodule-cache-path=[tab]`, so fixed this bug by checking if $flags contains only a newline or not. Differential Revision: https://reviews.llvm.org/D35763 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@309435 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/bash-autocomplete.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh
index 72531b99e3..83c168bf76 100644
--- a/utils/bash-autocomplete.sh
+++ b/utils/bash-autocomplete.sh
@@ -65,10 +65,14 @@ _clang()
return
fi
- if [[ "$cur" == '=' ]]; then
- COMPREPLY=( $( compgen -W "$flags" -- "") )
- elif [[ "$flags" == "" || "$arg" == "" ]]; then
+ # When clang does not emit any possible autocompletion, or user pushed tab after " ",
+ # just autocomplete files.
+ if [[ "$flags" == "$(echo -e '\n')" || "$arg" == "" ]]; then
+ # If -foo=<tab> and there was no possible values, autocomplete files.
+ [[ "$cur" == '=' || "$cur" == -*= ]] && cur=""
_clang_filedir
+ elif [[ "$cur" == '=' ]]; then
+ COMPREPLY=( $( compgen -W "$flags" -- "") )
else
# Bash automatically appends a space after '=' by default.
# Disable it so that it works nicely for options in the form of -foo=bar.