[PATCH] D35448: [Bash-autocompletion] Fixed a bug on bash

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 15 02:10:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL308091: [Bash-autocompletion] Fixed a bug on bash (authored by yamaguchi).

Changed prior to commit:
  https://reviews.llvm.org/D35448?vs=106752&id=106762#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35448

Files:
  cfe/trunk/utils/bash-autocomplete.sh


Index: cfe/trunk/utils/bash-autocomplete.sh
===================================================================
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -20,18 +20,21 @@
     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"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35448.106762.patch
Type: text/x-patch
Size: 1303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170715/125a6f96/attachment.bin>


More information about the cfe-commits mailing list