summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2018-05-24 16:25:40 +0000
committerBen Langmuir <blangmuir@apple.com>2018-05-24 16:25:40 +0000
commit620cb9341758bf1d915aacb8270da249b7493587 (patch)
tree8f035dd81e0150bd76e36bff539ce60a3dc5b701 /utils
parent9c82d4ff6015e4477e924c8a495a834c2fced29e (diff)
downloadclang-620cb9341758bf1d915aacb8270da249b7493587.tar.gz
[bash-completion] Fix tab separation on macOS
We have a regex that needs to match a tab character in the command output, but on macOS sed doesn't support '\t', causing it to split on the 't' character instead. Fix by having bash expand the \t first. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/bash-autocomplete.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh
index 2042f0b200..bcda789b1c 100644
--- a/utils/bash-autocomplete.sh
+++ b/utils/bash-autocomplete.sh
@@ -38,7 +38,8 @@ _clang()
# expand ~ to $HOME
eval local path=${COMP_WORDS[0]}
- flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' )
+ # Use $'\t' so that bash expands the \t for older versions of sed.
+ flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e $'s/\t.*//' )
# If clang is old that it does not support --autocomplete,
# fall back to the filename completion.
if [[ "$?" != 0 ]]; then