Skip to content

Commit a09f0c8

Browse files
committed
[Clang][Docs] Synchronize the LibTooling example
Synchronize the example in LibTooling documentation and header CommonOptionsParser.h
1 parent 10aab63 commit a09f0c8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

clang/include/clang/Tooling/CommonOptionsParser.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,20 @@ namespace tooling {
4949
/// using namespace clang::tooling;
5050
/// using namespace llvm;
5151
///
52-
/// static cl::OptionCategory MyToolCategory("My tool options");
52+
/// static cl::OptionCategory MyToolCategory("my-tool options");
5353
/// static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
5454
/// static cl::extrahelp MoreHelp("\nMore help text...\n");
55-
/// static cl::opt<bool> YourOwnOption(...);
56-
/// ...
5755
///
5856
/// int main(int argc, const char **argv) {
59-
/// CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
57+
/// auto ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
58+
/// if (!ExpectedParser) {
59+
/// llvm::errs() << ExpectedParser.takeError();
60+
/// return 1;
61+
/// }
62+
/// CommonOptionsParser& OptionsParser = ExpectedParser.get();
6063
/// ClangTool Tool(OptionsParser.getCompilations(),
6164
/// OptionsParser.getSourcePathList());
62-
/// return Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
65+
/// return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>().get());
6366
/// }
6467
/// \endcode
6568
class CommonOptionsParser {

0 commit comments

Comments
 (0)