]> granicus.if.org Git - clang/commitdiff
Updated tutorial code according to the changes in r197139.
authorAlexander Kornienko <alexfh@google.com>
Wed, 19 Feb 2014 16:11:38 +0000 (16:11 +0000)
committerAlexander Kornienko <alexfh@google.com>
Wed, 19 Feb 2014 16:11:38 +0000 (16:11 +0000)
Thanks to Konrad Kleine for reporting the inconsistency!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201693 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LibASTMatchersTutorial.rst

index 5bd62a133649c7ee9c9f8d06022a5ef32adc6e93..13749fbc41f15601809b0b891ae3172f5fd496ac 100644 (file)
@@ -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());