clang
9.0.0
|
A parser for options common to all command-line Clang tools. More...
#include "clang/Tooling/CommonOptionsParser.h"
Public Member Functions | |
CommonOptionsParser (int &argc, const char **argv, llvm::cl::OptionCategory &Category, const char *Overview=nullptr) | |
Parses command-line, initializes a compilation database. More... | |
CommonOptionsParser (int &argc, const char **argv, llvm::cl::OptionCategory &Category, llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview=nullptr) | |
Parses command-line, initializes a compilation database. More... | |
CompilationDatabase & | getCompilations () |
Returns a reference to the loaded compilations database. More... | |
const std::vector< std::string > & | getSourcePathList () const |
Returns a list of source file paths to process. More... | |
ArgumentsAdjuster | getArgumentsAdjuster () |
Returns the argument adjuster calculated from "--extra-arg" and. More... | |
Static Public Member Functions | |
static llvm::Expected< CommonOptionsParser > | create (int &argc, const char **argv, llvm::cl::OptionCategory &Category, llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview=nullptr) |
A factory method that is similar to the above constructor, except this returns an error instead exiting the program on error. More... | |
Static Public Attributes | |
static const char *const | HelpMessage |
A parser for options common to all command-line Clang tools.
Parses a common subset of command-line arguments, locates and loads a compilation commands database and runs a tool with user-specified action. It also contains a help message for the common command-line options.
An example of usage:
Definition at line 65 of file CommonOptionsParser.h.
|
inline |
Parses command-line, initializes a compilation database.
This constructor can change argc and argv contents, e.g. consume command-line options used for creating FixedCompilationDatabase.
All options not belonging to Category
become hidden.
This constructor exits program in case of error.
Definition at line 75 of file CommonOptionsParser.h.
clang::tooling::CommonOptionsParser::CommonOptionsParser | ( | int & | argc, |
const char ** | argv, | ||
llvm::cl::OptionCategory & | Category, | ||
llvm::cl::NumOccurrencesFlag | OccurrencesFlag, | ||
const char * | Overview = nullptr |
||
) |
Parses command-line, initializes a compilation database.
This constructor can change argc and argv contents, e.g. consume command-line options used for creating FixedCompilationDatabase.
All options not belonging to Category
become hidden.
It also allows calls to set the required number of positional parameters.
|
static |
A factory method that is similar to the above constructor, except this returns an error instead exiting the program on error.
Definition at line 157 of file CommonOptionsParser.cpp.
References Category, clang::Error, and toString().
Referenced by CommonOptionsParser(), and clang::tooling::internal::createExecutorFromCommandLineArgsImpl().
|
inline |
Returns the argument adjuster calculated from "--extra-arg" and.
Definition at line 113 of file CommonOptionsParser.h.
|
inline |
Returns a reference to the loaded compilations database.
Definition at line 102 of file CommonOptionsParser.h.
|
inline |
Returns a list of source file paths to process.
Definition at line 107 of file CommonOptionsParser.h.
Referenced by clang::tooling::StandaloneToolExecutorPlugin::create(), and clang::tooling::AllTUsToolExecutorPlugin::create().
|
static |
Definition at line 115 of file CommonOptionsParser.h.