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

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 01:55:26 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kohei Asano (khei4)

<details>
<summary>Changes</summary>

This patch fixes the code example on CommonOptionParser on https://intel.github.io/llvm-docs/clang/LibTooling.html

CommonOptionParser's constructor is protected and we can use `CommonOptionParser::create` instead of that.

I'm still not so sure whether other old examples are around there.

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


1 Files Affected:

- (modified) clang/docs/LibTooling.rst (+1-1) 


``````````diff
diff --git a/clang/docs/LibTooling.rst b/clang/docs/LibTooling.rst
index df50dcebf9b83c7..cf0e0d005f45e16 100644
--- a/clang/docs/LibTooling.rst
+++ b/clang/docs/LibTooling.rst
@@ -71,7 +71,7 @@ and automatic location of the compilation database using source files paths.
   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);
+    auto OptionsParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
 
     // Use OptionsParser.getCompilations() and OptionsParser.getSourcePathList()
     // to retrieve CompilationDatabase and the list of input file paths.

``````````

</details>


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


More information about the cfe-commits mailing list