From: Edwin Vane Date: Fri, 14 Dec 2012 18:58:25 +0000 (+0000) Subject: Style and Doc fix for CommonOptionsParser X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1f67dbbb12dec8304434c76c72e01336bf186e4;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170229 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LibASTMatchersTutorial.rst b/docs/LibASTMatchersTutorial.rst index 21d26897f3..3d0af67cb5 100644 --- a/docs/LibASTMatchersTutorial.rst +++ b/docs/LibASTMatchersTutorial.rst @@ -145,8 +145,8 @@ documentation `_. 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()); } @@ -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; diff --git a/docs/LibTooling.rst b/docs/LibTooling.rst index d9c17f681e..8c2a126fcc 100644 --- a/docs/LibTooling.rst +++ b/docs/LibTooling.rst @@ -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()); } diff --git a/include/clang/Tooling/CommonOptionsParser.h b/include/clang/Tooling/CommonOptionsParser.h index a1bad1269d..d313773d3d 100644 --- a/include/clang/Tooling/CommonOptionsParser.h +++ b/include/clang/Tooling/CommonOptionsParser.h @@ -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()); /// } /// \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 GetSourcePathList() { + std::vector getSourcePathList() { return SourcePathList; } diff --git a/lib/Tooling/CommonOptionsParser.cpp b/lib/Tooling/CommonOptionsParser.cpp index 15091c7e90..99aff9f4e9 100644 --- a/lib/Tooling/CommonOptionsParser.cpp +++ b/lib/Tooling/CommonOptionsParser.cpp @@ -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" diff --git a/tools/clang-check/ClangCheck.cpp b/tools/clang-check/ClangCheck.cpp index 6c081ac076..6f62228ffa 100644 --- a/tools/clang-check/ClangCheck.cpp +++ b/tools/clang-check/ClangCheck.cpp @@ -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()); clang_check::ClangCheckActionFactory Factory;