Autocompletion support for llvm opt flags

Hi all,

Thank you for your feedback at the dev meeting.

We are planning to add --autocomplete flag to llvm-opt, which enables us to make a new command-line autocompletion for opt when -mllvm is provided to Clang command invocation.

There are command-line option’s namespace opt::cl in CommandLine.cpp, which provides useful function for parsing options. However we also have OptTable in OptTable.h and we are confused why they have similar classes for options.

Our implementation plan is to build a new OptTable for opt options defined in CommandFlags.h with their values and call its method when --autocomplete flag was passed to opt. We believe that this interface will also be useful to future development for opt command-line flags.

Additionally, these are the type of flags which we already supported:

  • Clang flags
  • Clang flag values
  • CC1 flags when -Xclang or -cc1 is provided to command-line
  • -W and -Wno
  • -analyzer-checker values
  • -std values

Any comments or suggestions will be very helpful. We also want to add support for other shells, so any support for this is also very appriciated.

(If this email doesn’t make sense to you, please take a look at http://blog.llvm.org/2017/09/clang-bash-better-auto-completion-is.html)

Thanks,
Yuka

Additionally, these are the type of flags which we already supported:
* Clang flags
* Clang flag values
* CC1 flags when -Xclang or -cc1 is provided to command-line
* -W<warning> and -Wno<warning>
* -analyzer-checker values
* -std values

Now you want to extend clang work to opt, right?
​ If so, then why here we have clang-related flags?​

Regards,
chenwj

I just wanted to describe which types of flag are already supported and which is not, so that people can suggest to add support for other projects without duplicating.

Sorry to be confusing!

Thanks,
Yuka