r201693 - Updated tutorial code according to the changes in r197139.

Alexander Kornienko alexfh at google.com
Wed Feb 19 08:11:38 PST 2014


Author: alexfh
Date: Wed Feb 19 10:11:38 2014
New Revision: 201693

URL: http://llvm.org/viewvc/llvm-project?rev=201693&view=rev
Log:
Updated tutorial code according to the changes in r197139.

Thanks to Konrad Kleine for reporting the inconsistency!

Modified:
    cfe/trunk/docs/LibASTMatchersTutorial.rst

Modified: cfe/trunk/docs/LibASTMatchersTutorial.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersTutorial.rst?rev=201693&r1=201692&r2=201693&view=diff
==============================================================================
--- cfe/trunk/docs/LibASTMatchersTutorial.rst (original)
+++ cfe/trunk/docs/LibASTMatchersTutorial.rst Wed Feb 19 10:11:38 2014
@@ -137,6 +137,10 @@ documentation <LibTooling.html>`_.
       using namespace clang::tooling;
       using namespace llvm;
 
+      // Apply a custom category to all command-line options so that they are the
+      // only ones displayed.
+      static llvm::cl::OptionCategory MyToolCategory("my-tool options");
+
       // CommonOptionsParser declares HelpMessage with a description of the common
       // command-line options related to the compilation database and input files.
       // It's nice to have this help message in all tools.
@@ -146,7 +150,7 @@ documentation <LibTooling.html>`_.
       static cl::extrahelp MoreHelp("\nMore help text...");
 
       int main(int argc, const char **argv) {
-        CommonOptionsParser OptionsParser(argc, argv);
+        CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
         ClangTool Tool(OptionsParser.getCompilations(),
                        OptionsParser.getSourcePathList());
         return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
@@ -287,7 +291,7 @@ And change ``main()`` to:
 .. code-block:: c++
 
       int main(int argc, const char **argv) {
-        CommonOptionsParser OptionsParser(argc, argv);
+        CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
         ClangTool Tool(OptionsParser.getCompilations(),
                        OptionsParser.getSourcePathList());
 





More information about the cfe-commits mailing list