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

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


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

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.

>From 5b781734df6d3c49a6c387374c980693392fcabf Mon Sep 17 00:00:00 2001
From: khei4 <kk.asano.luxy at gmail.com>
Date: Fri, 27 Oct 2023 17:46:34 +0900
Subject: [PATCH] use: create instead of protected Constructor

---
 clang/docs/LibTooling.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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.



More information about the cfe-commits mailing list