clang 20.0.0git
DriverOptions.cpp
Go to the documentation of this file.
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
10#include "llvm/ADT/STLExtras.h"
11#include "llvm/Option/OptTable.h"
12#include "llvm/Option/Option.h"
13#include <cassert>
14
15using namespace clang::driver;
16using namespace clang::driver::options;
17using 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
30static constexpr const llvm::StringLiteral PrefixTable_init[] =
31#define PREFIX_UNION(VALUES) VALUES
32#include "clang/Driver/Options.inc"
33#undef PREFIX_UNION
34 ;
35static constexpr const llvm::ArrayRef<llvm::StringLiteral>
37
38static constexpr OptTable::Info InfoTable[] = {
39#define OPTION(...) LLVM_CONSTRUCT_OPT_INFO(__VA_ARGS__),
40#include "clang/Driver/Options.inc"
41#undef OPTION
42};
43
44namespace {
45
46class DriverOptTable : public PrecomputedOptTable {
47public:
48 DriverOptTable() : PrecomputedOptTable(InfoTable, PrefixTable) {}
49};
50}
51
52const llvm::opt::OptTable &clang::driver::getDriverOptTable() {
53 static DriverOptTable Table;
54 return Table;
55}
static constexpr const llvm::StringLiteral PrefixTable_init[]
static constexpr OptTable::Info InfoTable[]
static constexpr const llvm::ArrayRef< llvm::StringLiteral > PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1)
const llvm::opt::OptTable & getDriverOptTable()