[clang] [Clang] Fix LibTooling doc (PR #90441)
Maxim Moskalets via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 30 02:57:08 PDT 2024
https://github.com/maxmosk updated https://github.com/llvm/llvm-project/pull/90441
>From a09f0c836a4e8296ccae3c51889f90dea38c304c Mon Sep 17 00:00:00 2001
From: Maxim Moskalets <Maxim.Moskalets at kaspersky.com>
Date: Tue, 30 Apr 2024 12:51:43 +0300
Subject: [PATCH] [Clang][Docs] Synchronize the LibTooling example
Synchronize the example in LibTooling documentation and header CommonOptionsParser.h
---
clang/include/clang/Tooling/CommonOptionsParser.h | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/clang/include/clang/Tooling/CommonOptionsParser.h b/clang/include/clang/Tooling/CommonOptionsParser.h
index 3c0480af377943..337e62cd7b7ed5 100644
--- a/clang/include/clang/Tooling/CommonOptionsParser.h
+++ b/clang/include/clang/Tooling/CommonOptionsParser.h
@@ -49,17 +49,20 @@ namespace tooling {
/// using namespace clang::tooling;
/// using namespace llvm;
///
-/// static cl::OptionCategory MyToolCategory("My tool options");
+/// static cl::OptionCategory MyToolCategory("my-tool options");
/// static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
/// static cl::extrahelp MoreHelp("\nMore help text...\n");
-/// static cl::opt<bool> YourOwnOption(...);
-/// ...
///
/// int main(int argc, const char **argv) {
-/// CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
+/// auto ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
+/// if (!ExpectedParser) {
+/// llvm::errs() << ExpectedParser.takeError();
+/// return 1;
+/// }
+/// CommonOptionsParser& OptionsParser = ExpectedParser.get();
/// ClangTool Tool(OptionsParser.getCompilations(),
/// OptionsParser.getSourcePathList());
-/// return Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
+/// return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>().get());
/// }
/// \endcode
class CommonOptionsParser {
More information about the cfe-commits
mailing list