Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/DriverOptions.cpp
Line
Count
Source
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 PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
20
#include "clang/Driver/Options.inc"
21
#undef PREFIX
22
23
static const OptTable::Info InfoTable[] = {
24
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
25
               HELPTEXT, METAVAR, VALUES)                                      \
26
  {PREFIX, NAME,  HELPTEXT,    METAVAR,     OPT_##ID,  Option::KIND##Class,    \
27
   PARAM,  FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS, VALUES},
28
#include "clang/Driver/Options.inc"
29
#undef OPTION
30
};
31
32
namespace {
33
34
class DriverOptTable : public OptTable {
35
public:
36
  DriverOptTable()
37
50.1k
    : OptTable(InfoTable) {}
38
};
39
40
}
41
42
863k
const llvm::opt::OptTable &clang::driver::getDriverOptTable() {
43
863k
  static const DriverOptTable *Table = []() {
44
50.1k
    auto Result = std::make_unique<DriverOptTable>();
45
50.1k
    // Options.inc is included in DriverOptions.cpp, and calls OptTable's
46
50.1k
    // addValues function.
47
50.1k
    // Opt is a variable used in the code fragment in Options.inc.
48
50.1k
    OptTable &Opt = *Result;
49
50.1k
#define OPTTABLE_ARG_INIT
50
50.1k
#include "clang/Driver/Options.inc"
51
50.1k
#undef OPTTABLE_ARG_INIT
52
50.1k
    return Result.release();
53
50.1k
  }();
54
863k
  return *Table;
55
863k
}