xref: /llvm-project/clang/lib/Driver/DriverOptions.cpp (revision dd647e3e608ed0b2bac7c588d5859b80ef4a5976)
1 //===--- DriverOptions.cpp - Driver Options Table -------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "clang/Driver/Options.h"
10 #include "llvm/Option/OptTable.h"
11 #include <cassert>
12 
13 using namespace clang::driver;
14 using namespace clang::driver::options;
15 using namespace llvm::opt;
16 
17 #define OPTTABLE_STR_TABLE_CODE
18 #include "clang/Driver/Options.inc"
19 #undef OPTTABLE_STR_TABLE_CODE
20 
21 #define OPTTABLE_VALUES_CODE
22 #include "clang/Driver/Options.inc"
23 #undef OPTTABLE_VALUES_CODE
24 
25 #define OPTTABLE_PREFIXES_TABLE_CODE
26 #include "clang/Driver/Options.inc"
27 #undef OPTTABLE_PREFIXES_TABLE_CODE
28 
29 #define OPTTABLE_PREFIXES_UNION_CODE
30 #include "clang/Driver/Options.inc"
31 #undef OPTTABLE_PREFIXES_UNION_CODE
32 
33 static constexpr OptTable::Info InfoTable[] = {
34 #define OPTION(...) LLVM_CONSTRUCT_OPT_INFO(__VA_ARGS__),
35 #include "clang/Driver/Options.inc"
36 #undef OPTION
37 };
38 
39 namespace {
40 
41 class DriverOptTable : public PrecomputedOptTable {
42 public:
43   DriverOptTable()
44       : PrecomputedOptTable(OptionStrTable, OptionPrefixesTable, InfoTable,
45                             OptionPrefixesUnion) {}
46 };
47 }
48 
49 const llvm::opt::OptTable &clang::driver::getDriverOptTable() {
50   static DriverOptTable Table;
51   return Table;
52 }
53