Style and Doc fix for CommonOptionsParser

- Renaming GetCompilations() and GetSourcePathList() to follow LLVM
  style.
- Updating docs to reflect name change.
- Also updating help text to not mention clang-check since this class
  can be used by any tool.

Reviewed By: Alexander Kornienko

llvm-svn: 170229
This commit is contained in:
Edwin Vane 2012-12-14 18:58:25 +00:00
parent 164fdb607b
commit 524741fbbd
5 changed files with 16 additions and 16 deletions

View File

@ -145,8 +145,8 @@ documentation <LibTooling.html>`_.
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
ClangTool Tool(OptionsParser.GetCompilations(),
OptionsParser.GetSourcePathList());
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
}
@ -279,8 +279,8 @@ And change ``main()`` to:
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
ClangTool Tool(OptionsParser.GetCompilations(),
OptionsParser.GetSourcePathList());
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
LoopPrinter Printer;
MatchFinder Finder;

View File

@ -68,7 +68,7 @@ and automatic location of the compilation database using source files paths.
// CompilationDatabase. In case of error it will terminate the program.
CommonOptionsParser OptionsParser(argc, argv);
// Use OptionsParser.GetCompilations() and OptionsParser.GetSourcePathList()
// Use OptionsParser.getCompilations() and OptionsParser.getSourcePathList()
// to retrieve CompilationDatabase and the list of input file paths.
}
@ -88,7 +88,7 @@ our ``FrontendAction`` over some code. For example, to run the
// We hand the CompilationDatabase we created and the sources to run over into
// the tool constructor.
ClangTool Tool(OptionsParser.GetCompilations(), Sources);
ClangTool Tool(OptionsParser.getCompilations(), Sources);
// The ClangTool needs a new FrontendAction for each translation unit we run
// on. Thus, it takes a FrontendActionFactory as parameter. To create a
@ -125,8 +125,8 @@ tool is also checked into the clang tree at
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
ClangTool Tool(OptionsParser.GetCompilations(),
OptionsParser.GetSourcePathList());
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
}

View File

@ -53,8 +53,8 @@ namespace tooling {
///
/// int main(int argc, const char **argv) {
/// CommonOptionsParser OptionsParser(argc, argv);
/// ClangTool Tool(OptionsParser.GetCompilations(),
/// OptionsParser.GetSourcePathListi());
/// ClangTool Tool(OptionsParser.getCompilations(),
/// OptionsParser.getSourcePathListi());
/// return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
/// }
/// \endcode
@ -67,12 +67,12 @@ public:
CommonOptionsParser(int &argc, const char **argv);
/// Returns a reference to the loaded compilations database.
CompilationDatabase &GetCompilations() {
CompilationDatabase &getCompilations() {
return *Compilations;
}
/// Returns a list of source file paths to process.
std::vector<std::string> GetSourcePathList() {
std::vector<std::string> getSourcePathList() {
return SourcePathList;
}

View File

@ -38,8 +38,8 @@ const char *const CommonOptionsParser::HelpMessage =
"\tFor example, it can be a CMake build directory in which a file named\n"
"\tcompile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON\n"
"\tCMake option to get this output). When no build path is specified,\n"
"\tclang-check will attempt to locate it automatically using all parent\n"
"\tpaths of the first input file. See:\n"
"\ta search for compile_commands.json will be attempted through all\n"
"\tparent paths of the first input file . See:\n"
"\thttp://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an\n"
"\texample of setting up Clang Tooling on a source tree.\n"
"\n"

View File

@ -143,8 +143,8 @@ public:
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
ClangTool Tool(OptionsParser.GetCompilations(),
OptionsParser.GetSourcePathList());
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
if (Fixit)
return Tool.run(newFrontendActionFactory<FixItAction>());
clang_check::ClangCheckActionFactory Factory;