Add include guards that allow multiple includes of OptParser.td. This
is helpful when defining multiple sets of options in multiple files.
For example, a user could define a HelpOptions.td file that defines
only -h and --help:
// HelpOptions.td include "llvm/Option/OptParser.td" def HelpOptionGroup : OptionGroup<"Help Options">; def help : Flag<["--", "-"], "help">, Group<HelpOptionGroup>, Flags<[]>; def : Flag<["-"], "h">, Group<HelpOptionGroup>, Flags<[]>, Alias<help>;
This file could then be included into any TableGen file that wishes to
define these options:
// MyOptions.td include "llvm/Option/OptParser.td" def MyOptionGroup : OptionGroup<"My Options">; // ...define my options. // And also define `-h` and `--help`: include "HelpOptions.td"
This currently isn't possible, because this would result in
OptParser.td being included twice. Alternatively, the include of
OptParser.td in the HelpOptions.td example above could be removed,
but then llvm-tblgen --gen-opt-parser-defs HelpOptions.td would fail
(because the OptionGroup and Option records are defined in
OptParser.td).