Author: Rajveer Singh Bharadwaj
Date: 2026-03-15T20:04:17+01:00
New Revision: 89c331560eb4376f51b43ceafb79c8a5cc85a3ce

URL: 
https://github.com/llvm/llvm-project/commit/89c331560eb4376f51b43ceafb79c8a5cc85a3ce
DIFF: 
https://github.com/llvm/llvm-project/commit/89c331560eb4376f51b43ceafb79c8a5cc85a3ce.diff

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

Resolves #97983

Added: 
    

Modified: 
    clang/docs/LibTooling.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/LibTooling.rst b/clang/docs/LibTooling.rst
index 87d84321ab283..c6687fb9642f9 100644
--- a/clang/docs/LibTooling.rst
+++ b/clang/docs/LibTooling.rst
@@ -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();


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to