2011-01-01 01:31:54 +08:00
|
|
|
//===--- DriverOptions.cpp - Driver Options Table -------------------------===//
|
2009-11-19 08:15:11 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#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"
|
[Bash-autocompletion] Add support for static analyzer flags
Summary:
This is a patch for clang autocomplete feature.
It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.
Reviewers: v.g.vassilev, teemperor, ruiu
Subscribers: hiraditya, cfe-commits
Differential Revision: https://reviews.llvm.org/D36782
llvm-svn: 311552
2017-08-23 21:39:47 +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() {
|
[Bash-autocompletion] Add support for static analyzer flags
Summary:
This is a patch for clang autocomplete feature.
It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.
Reviewers: v.g.vassilev, teemperor, ruiu
Subscribers: hiraditya, cfe-commits
Differential Revision: https://reviews.llvm.org/D36782
llvm-svn: 311552
2017-08-23 21:39:47 +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
|
|
|
}
|