[cfe-commits] [PATCH] Style and Doc fix for CommonOptionsParser

Edwin Vane edwin.vane at intel.com
Wed Dec 12 11:36:06 PST 2012


Hi klimek,

- 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.

http://llvm-reviews.chandlerc.com/D211

Files:
  docs/LibASTMatchersTutorial.html
  docs/LibTooling.html
  include/clang/Tooling/CommonOptionsParser.h
  lib/Tooling/CommonOptionsParser.cpp
  tools/clang-check/ClangCheck.cpp

Index: docs/LibASTMatchersTutorial.html
===================================================================
--- docs/LibASTMatchersTutorial.html
+++ docs/LibASTMatchersTutorial.html
@@ -153,8 +153,8 @@
 
   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>());
   }
 </pre>
@@ -279,8 +279,8 @@
 <pre class="doc_code">
   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;
Index: docs/LibTooling.html
===================================================================
--- docs/LibTooling.html
+++ docs/LibTooling.html
@@ -78,7 +78,7 @@
   // 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.
 }
 </pre>
@@ -97,7 +97,7 @@
 
   // 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
@@ -131,8 +131,8 @@
 
 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>());
 }
 </pre>
Index: include/clang/Tooling/CommonOptionsParser.h
===================================================================
--- include/clang/Tooling/CommonOptionsParser.h
+++ include/clang/Tooling/CommonOptionsParser.h
@@ -53,8 +53,8 @@
 ///
 /// 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 @@
   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;
   }
 
Index: lib/Tooling/CommonOptionsParser.cpp
===================================================================
--- lib/Tooling/CommonOptionsParser.cpp
+++ lib/Tooling/CommonOptionsParser.cpp
@@ -38,8 +38,8 @@
     "\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"
Index: tools/clang-check/ClangCheck.cpp
===================================================================
--- tools/clang-check/ClangCheck.cpp
+++ tools/clang-check/ClangCheck.cpp
@@ -143,8 +143,8 @@
 
 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D211.1.patch
Type: text/x-patch
Size: 4978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121212/cf2e2f59/attachment.bin>


More information about the cfe-commits mailing list