[clang][doc] Improve error handling for LibTooling example code avoiding core dump (#98129)

Resolves #97983
This commit is contained in:
Rajveer Singh Bharadwaj authored and GitHub committed 2026-03-15 20:04:17 +01:00
1 parent dcbbfb26cb
commit 89c331560e
1 file changed
+2 -2
+2 -2
View File
@@ -75,7 +75,7 @@ and automatic location of the compilation database using source files paths.
auto ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
if (!ExpectedParser) {
// Fail gracefully for unsupported options.
llvm::errs() << ExpectedParser.takeError();
llvm::errs() << toString(ExpectedParser.takeError());
return 1;
}
CommonOptionsParser& OptionsParser = ExpectedParser.get();
@@ -142,7 +142,7 @@ version of this example tool is also checked into the clang tree at
int main(int argc, const char **argv) {
auto ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
if (!ExpectedParser) {
llvm::errs() << ExpectedParser.takeError();
llvm::errs() << toString(ExpectedParser.takeError());
return 1;
}
CommonOptionsParser& OptionsParser = ExpectedParser.get();