Skip to content

swift-autocomplete.bash: fix filename completion and update the hard coded list of -Xllvm options #36087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 138 additions & 57 deletions utils/swift-autocomplete.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,147 @@ _swift_complete()
prevWord="${COMP_WORDS[COMP_CWORD-1]}"

if [[ ${currentWord} != -* ]] ; then
COMPREPLY=( $(compgen -f "${currentWord}") )
COMPREPLY=()
return 0
fi

if [[ ${prevWord} == "-Xllvm" ]] ; then
# Don't know how to get the help for llvm options automatically.
# So we use a grep'ed static list.
COMPREPLY=( $(compgen -W "\
-disable-swift-specific-llvm-optzns \
-stack-promotion-limit \
-view-cfg-max-columns \
-view-cfg-long-line-behavior \
-view-cfg-remove-use-list-comments \
-view-cfg-only-for-function \
-sil-print-no-color \
-aa \
-cache-aa-results \
-sil-dump-call-graph \
-sil-dump-call-graph-stats \
-call-graph-file-check-prefix \
-view-loop-regions-max-columns \
-view-loop-regions-long-line-behavior \
-view-loop-regions-remove-use-list-comments \
-view-loop-regions-only-for-function \
-enable-rc-identity-arg-strip \
-enable-loop-arc \
-sil-abcopts-report \
-enable-abcopts \
-enable-abc-hoisting \
-aa-kind \
-allocbox-to-stack-analyze-apply \
-allow-critical-edges \
-basic-dynamic-replacement \
-bug-reducer-tester-failure-kind \
-bug-reducer-tester-target-func \
-canonical-ossa-rewrite-borrows \
-closure-specialize-eliminate-dead-closures \
-enable-copyforwarding \
-enable-destroyhoisting \
-cmo-function-size-limit \
-constexpr-limit \
-copy-forward-start \
-copy-forward-stop \
-view-cfg-before-cow-for \
-sil-array-props \
-enable-local-store-dse \
-enable-global-redundant-load-elim \
-sil-looprotate \
-sil-view-cfg \
-sil-view-guaranteed-cfg \
-sil-view-silgen-cfg \
-differentiation-skip-folding-differentiable-function-extraction \
-disable-arc-cm \
-disable-llvm-arc-opts \
-disable-sil-cm-rr-cm \
-disable-sil-ownership-verification \
-dont-abort-on-memory-lifetime-errors \
-enable-abc-hoisting \
-enable-abcopts \
-enable-accessed-storage-dump-uses \
-enable-copyforwarding \
-enable-destroyhoisting \
-enable-eager-specializer \
-enable-existential-specializer \
-enable-expand-all \
-enable-experimental-linear-map-transposition \
-enable-loop-arc \
-enable-mem-behavior-dump-all \
-enable-rc-identity-arg-strip \
-enable-sil-passmanager-verifier-analysis \
-enable-trap-debug-info \
-escapes-enable-graphwriter \
-escapes-internal-verify \
-inline-tree-no-demangle \
-keep-will-throw-call \
-looprotate-single-block-loop \
-looprotate-size-limit \
-lslocation-dump-use-new-projection \
-max-local-apply-recur-depth \
-max-partial-store-count \
-optimize-opaque-address-lowering \
-optremarkgen-declless-debugvalue-use-sildebugvar-info \
-optremarkgen-visit-implicit-autogen-funcs \
-print-shortest-path-info \
-print-swift-mangling-stats \
-sil-abcopts-report \
-sil-aggressive-inline \
-sil-assert-on-exclusivity-failure \
-sil-break-on-function \
-sil-break-on-pass \
-sil-closure-lifetime-fixup-reverse-phi-order \
-sil-combine-disable-alloc-stack-opts \
-sil-cross-module-serialize-all \
-sil-di-assert-on-failure \
-sil-disable-convert-escape-to-noescape-switch-peephole \
-sil-disable-skipping-passes \
-sil-disable-typelowering-constantinfo-cache \
-sil-dump-before-ome-to-path \
-sil-dump-functions-before-outliner \
-sil-fso-disable-arg-explosion \
-sil-fso-disable-dead-argument \
-sil-fso-disable-owned-to-guaranteed \
-sil-fso-enable-generics \
-sil-fso-optimize-if-not-called \
-sil-full-demangle \
-sil-generic-verify-after-specialization \
-sil-inline-generics \
-sil-inline-verify-after-inline \
-sil-loop-region-view-cfg-only-function \
-sil-loop-region-view-cfg-only-functions \
-sil-lower-agg-instrs-expand-all \
-sil-mandatory-combine-enable-canon-and-simple-dce \
-sil-merge-stack-slots \
-sil-opt-pass-count \
-sil-opt-remark-ignore-always-infer \
-sil-optimized-access-markers \
-sil-ownership-verifier-enable-testing \
-sil-partial-specialization \
-sil-partial-specialization-with-generic-substitutions \
-sil-print-all \
-sil-print-debuginfo \
-sil-print-functions \
-sil-print-generic-specialization-info \
-sil-print-generic-specialization-loops \
-sil-print-no-color \
-sil-print-on-error \
-sil-print-pass-name \
-sil-print-pass-time \
-sil-opt-pass-count \
-sil-print-function \
-sil-print-functions \
-sil-print-before \
-sil-print-after \
-sil-print-around \
-sil-disable-pass \
-sil-print-sourceinfo \
-sil-semantic-arc-opts-verify-after-transform \
-sil-stats-block-count-delta-threshold \
-sil-stats-dump-all \
-sil-stats-func-block-count-delta-threshold \
-sil-stats-func-block-count-min-threshold \
-sil-stats-func-inst-count-delta-threshold \
-sil-stats-func-inst-count-min-threshold \
-sil-stats-function-count-delta-threshold \
-sil-stats-functions \
-sil-stats-inst-count-delta-threshold \
-sil-stats-modules \
-sil-stats-only-function \
-sil-stats-only-functions \
-sil-stats-output-file \
-sil-stats-used-memory-delta-threshold \
-sil-stats-used-memory-min-threshold \
-sil-verify-force-analysis \
-sil-verify-without-invalidation \
-sil-inline-test-threshold \
-sil-inline-test \
-sil-inline-never-functions \
-sil-view-cfg \
-sil-view-cfg-only-function \
-sil-view-cfg-only-functions \
-sil-view-guaranteed-cfg \
-sil-view-silgen-cfg \
-silcombine-owned-code-sinking \
-simplify-cfg-simplify-unconditional-branches \
-sroa-args-remove-dead-args-after \
-ml \
-sil-print-escapes \
-sil-print-side-effects \
-swift-diagnostics-assert-on-error \
-swift-diagnostics-assert-on-warning \
-verify-abort-on-failure \
-verify-arc-loop-summary \
-verify-continue-on-failure \
-verify-di-holes \
-verify-dump-module-on-failure \
-verify-linetable \
-verify-skip-convert-escape-to-noescape-attributes \
-view-cfg-long-line-behavior \
-view-cfg-max-columns \
-view-cfg-only-for-function \
-view-cfg-remove-use-list-comments \
-view-loop-regions-long-line-behavior \
-view-loop-regions-max-columns \
-view-loop-regions-only-for-function \
-view-loop-regions-remove-use-list-comments \
-debug-only \
" -- ${currentWord}) )
else
Expand Down Expand Up @@ -103,16 +184,16 @@ _ninja_complete()
return 0
}

complete -F _swift_complete swiftc
complete -F _swift_complete swift
complete -F _swift_complete sil-opt
complete -F _swift_complete sil-func-extractor
complete -F _swift_complete swift-demangle
complete -F _swift_complete swift-llvm-opt
complete -F _swift_complete swift-ide-test
complete -F _swift_complete swift-ios-test
complete -F _swift_complete swift-sdk-analyzer
complete -F _swift_complete swift-stdlib-tool
complete -F _swift_complete lldb-moduleimport-test
complete -F _ninja_complete ninja
complete -o default -F _swift_complete swiftc
complete -o default -F _swift_complete swift
complete -o default -F _swift_complete sil-opt
complete -o default -F _swift_complete sil-func-extractor
complete -o default -F _swift_complete swift-demangle
complete -o default -F _swift_complete swift-llvm-opt
complete -o default -F _swift_complete swift-ide-test
complete -o default -F _swift_complete swift-ios-test
complete -o default -F _swift_complete swift-sdk-analyzer
complete -o default -F _swift_complete swift-stdlib-tool
complete -o default -F _swift_complete lldb-moduleimport-test
complete -o default -F _ninja_complete ninja