summaryrefslogtreecommitdiffstats
path: root/clang/utils/bash-autocomplete.sh
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
commit0486c8c3af7bc43415d4a996c07736fefa2ad42d (patch)
tree271a770867d76b658285e27b03d73e074600d980 /clang/utils/bash-autocomplete.sh
parentb8c7c9c3693afb5a99ca36d536be5d5a775d5b88 (diff)
downloadbcm5719-llvm-0486c8c3af7bc43415d4a996c07736fefa2ad42d.tar.gz
bcm5719-llvm-0486c8c3af7bc43415d4a996c07736fefa2ad42d.zip
[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. llvm-svn: 333202
Diffstat (limited to 'clang/utils/bash-autocomplete.sh')
-rw-r--r--clang/utils/bash-autocomplete.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/utils/bash-autocomplete.sh b/clang/utils/bash-autocomplete.sh
index 2042f0b200c..bcda789b1c0 100644
--- a/clang/utils/bash-autocomplete.sh
+++ b/clang/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
OpenPOWER on IntegriCloud