1 //===--- DriverOptions.cpp - Driver Options Table -------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "clang/Driver/Options.h"
11 #include "llvm/ADT/STLExtras.h"
12 #include "llvm/Option/OptTable.h"
13 #include "llvm/Option/Option.h"
16 using namespace clang::driver;
17 using namespace clang::driver::options;
18 using namespace llvm::opt;
20 #define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
21 #include "clang/Driver/Options.inc"
24 static const OptTable::Info InfoTable[] = {
25 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
26 HELPTEXT, METAVAR, VALUES) \
27 {PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, \
28 PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS, VALUES},
29 #include "clang/Driver/Options.inc"
35 class DriverOptTable : public OptTable {
38 : OptTable(InfoTable) {}
43 std::unique_ptr<OptTable> clang::driver::createDriverOptTable() {
44 auto Result = llvm::make_unique<DriverOptTable>();
45 // Options.inc is included in DriverOptions.cpp, and calls OptTable's
46 // addValues function.
47 // Opt is a variable used in the code fragment in Options.inc.
48 OptTable &Opt = *Result;
49 #define OPTTABLE_ARG_INIT
50 #include "clang/Driver/Options.inc"
51 #undef OPTTABLE_ARG_INIT
52 return std::move(Result);