]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Driver/DriverOptions.cpp
Import libxo-0.9.0:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Driver / DriverOptions.cpp
1 //===--- DriverOptions.cpp - Driver Options Table -------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "clang/Driver/Options.h"
11 #include "llvm/ADT/STLExtras.h"
12 #include "llvm/Option/OptTable.h"
13 #include "llvm/Option/Option.h"
14 #include <cassert>
15
16 using namespace clang::driver;
17 using namespace clang::driver::options;
18 using namespace llvm::opt;
19
20 #define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
21 #include "clang/Driver/Options.inc"
22 #undef PREFIX
23
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"
30 #undef OPTION
31 };
32
33 namespace {
34
35 class DriverOptTable : public OptTable {
36 public:
37   DriverOptTable()
38     : OptTable(InfoTable) {}
39 };
40
41 }
42
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);
53 }