[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

Rui Ueyama via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 18:22:49 PDT 2017

ruiu added inline comments.

Comment at: clang/utils/bash-autocomplete.sh:28
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # Check if --autocomplete is supported in user's clang version.
+  if [[ "$?" != 0 ]]; then
It is probably a bit better if you mention that it falls back to the default filename completion if --autocomplete is not available. How about this: If clang is old that it does not support --autocomplete, fall back to the filename completion.

Comment at: clang/utils/bash-autocomplete.sh:31
+    _filedir
+    return 0
+  fi
If it is the same as just `return`, please remove `0`.

Comment at: clang/utils/bash-autocomplete.sh:33
+  fi
   if [[ "$cur" == '=' ]]; then
     COMPREPLY=( $( compgen -W "$flags" -- "") )
nit: it is a bit easier to read if you insert a newline here to separate code blocks.


More information about the cfe-commits mailing list