r308091 - [Bash-autocompletion] Fixed a bug on bash

Yuka Takahashi via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 15 02:09:51 PDT 2017


Author: yamaguchi
Date: Sat Jul 15 02:09:51 2017
New Revision: 308091

URL: http://llvm.org/viewvc/llvm-project?rev=308091&view=rev
Log:
[Bash-autocompletion] Fixed a bug on bash

Summary: Maybe I mismerged when merging previous commits by hand.

Differential Revision: https://reviews.llvm.org/D35448

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

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=308091&r1=308090&r2=308091&view=diff
==============================================================================
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sat Jul 15 02:09:51 2017
@@ -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"




More information about the cfe-commits mailing list