2011-01-01 01:31:54 +08:00
|
|
|
//===--- DriverOptions.cpp - Driver Options Table -------------------------===//
|
2009-11-19 08:15:11 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-11-19 08:15:11 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Driver/Options.h"
|
2013-07-15 11:38:40 +08:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
2013-06-15 01:17:23 +08:00
|
|
|
#include "llvm/Option/OptTable.h"
|
|
|
|
#include "llvm/Option/Option.h"
|
2017-08-29 08:09:31 +08:00
|
|
|
#include <cassert>
|
2009-11-19 08:15:11 +08:00
|
|
|
|
|
|
|
using namespace clang::driver;
|
|
|
|
using namespace clang::driver::options;
|
2013-06-15 01:17:23 +08:00
|
|
|
using namespace llvm::opt;
|
2009-11-19 08:15:11 +08:00
|
|
|
|
2013-07-18 00:54:06 +08:00
|
|
|
#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
|
2012-10-23 06:13:48 +08:00
|
|
|
#include "clang/Driver/Options.inc"
|
|
|
|
#undef PREFIX
|
|
|
|
|
2009-12-10 08:07:02 +08:00
|
|
|
static const OptTable::Info InfoTable[] = {
|
2017-06-21 00:31:31 +08:00
|
|
|
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
|
|
|
|
HELPTEXT, METAVAR, VALUES) \
|
|
|
|
{PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, \
|
|
|
|
PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS, VALUES},
|
2009-11-19 09:03:50 +08:00
|
|
|
#include "clang/Driver/Options.inc"
|
2013-07-18 00:54:06 +08:00
|
|
|
#undef OPTION
|
2009-11-19 08:15:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class DriverOptTable : public OptTable {
|
|
|
|
public:
|
|
|
|
DriverOptTable()
|
2015-10-22 00:31:33 +08:00
|
|
|
: OptTable(InfoTable) {}
|
2009-11-19 08:15:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-01-14 01:34:15 +08:00
|
|
|
std::unique_ptr<OptTable> clang::driver::createDriverOptTable() {
|
2017-08-29 08:09:31 +08:00
|
|
|
auto Result = llvm::make_unique<DriverOptTable>();
|
|
|
|
// Options.inc is included in DriverOptions.cpp, and calls OptTable's
|
|
|
|
// addValues function.
|
|
|
|
// Opt is a variable used in the code fragment in Options.inc.
|
|
|
|
OptTable &Opt = *Result;
|
|
|
|
#define OPTTABLE_ARG_INIT
|
|
|
|
#include "clang/Driver/Options.inc"
|
|
|
|
#undef OPTTABLE_ARG_INIT
|
|
|
|
return std::move(Result);
|
2009-11-19 08:15:11 +08:00
|
|
|
}
|