[clang] [Clang] Fix LibTooling doc (PR #90441)
Maxim Moskalets via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 30 05:59:19 PDT 2024
https://github.com/maxmosk updated https://github.com/llvm/llvm-project/pull/90441
>From 723b4be4076ff9723663f529153b6a0acde27201 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 | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/clang/include/clang/Tooling/CommonOptionsParser.h b/clang/include/clang/Tooling/CommonOptionsParser.h
index 3c0480af377943..5e2cdc6ac45894 100644
--- a/clang/include/clang/Tooling/CommonOptionsParser.h
+++ b/clang/include/clang/Tooling/CommonOptionsParser.h
@@ -49,17 +49,22 @@ 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