[clang] [Clang][Docs] use CommonOptionsParser::create instead of protected constructor on libTooling tutorial (NFC) (PR #70427)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 02:53:35 PDT 2024


================
@@ -63,15 +63,22 @@ and automatic location of the compilation database using source files paths.
   #include "llvm/Support/CommandLine.h"
 
   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");
+  static cl::OptionCategory MyToolCategory("my-tool options");
 
   int main(int argc, const char **argv) {
-    // CommonOptionsParser constructor will parse arguments and create a
-    // CompilationDatabase.  In case of error it will terminate the program.
-    CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
+    // CommonOptionsParser::create will parse arguments and create a
+    // CompilationDatabase. In case of error it will terminate the program.
----------------
Sirraide wrote:

```suggestion
    // CompilationDatabase.
```
That’s no longer true.

https://github.com/llvm/llvm-project/pull/70427


More information about the cfe-commits mailing list