| 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/ADT/STLExtras.h" |
| 11 |
#include "llvm/Option/OptTable.h" |
| 12 |
#include "llvm/Option/Option.h" |
| 13 |
#include <cassert> |
| 14 |
|
| 15 |
using namespace clang::driver; |
| 16 |
using namespace clang::driver::options; |
| 17 |
using namespace llvm::opt; |
| 18 |
|
| 19 |
#define OPTTABLE_VALUES_CODE |
| 20 |
#include "clang/Driver/Options.inc" |
| 21 |
#undef OPTTABLE_VALUES_CODE |
| 22 |
|
| 23 |
#define PREFIX(NAME, VALUE) \ |
| 24 |
static constexpr llvm::StringLiteral NAME##_init[] = VALUE; \ |
| 25 |
static constexpr llvm::ArrayRef<llvm::StringLiteral> NAME( \ |
| 26 |
NAME##_init, std::size(NAME##_init) - 1); |
| 27 |
#include "clang/Driver/Options.inc" |
| 28 |
#undef PREFIX |
| 29 |
|
| 30 |
static constexpr const llvm::StringLiteral PrefixTable_init[] = |
| 31 |
#define PREFIX_UNION(VALUES) VALUES |
| 32 |
#include "clang/Driver/Options.inc" |
| 33 |
#undef PREFIX_UNION |
| 34 |
; |
| 35 |
static constexpr const llvm::ArrayRef<llvm::StringLiteral> |
| 36 |
PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1); |
| 37 |
|
| 38 |
static constexpr OptTable::Info InfoTable[] = { |
| 39 |
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ |
| 40 |
HELPTEXT, METAVAR, VALUES) \ |
| 41 |
{PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, \ |
| 42 |
PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS, VALUES}, |
| 43 |
#include "clang/Driver/Options.inc" |
| 44 |
#undef OPTION |
| 45 |
}; |
| 46 |
|
| 47 |
namespace { |
| 48 |
|
| 49 |
class DriverOptTable : public PrecomputedOptTable { |
| 50 |
public: |
| 51 |
DriverOptTable() : PrecomputedOptTable(InfoTable, PrefixTable) {} |
| 52 |
}; |
| 53 |
} |
| 54 |
|
| 55 |
const llvm::opt::OptTable &clang::driver::getDriverOptTable() { |
| 56 |
static DriverOptTable Table; |
| 57 |
return Table; |
| 58 |
} |