================ @@ -71,9 +71,9 @@ and automatic location of the compilation database using source files paths. int main(int argc, const char **argv) { // CommonOptionsParser constructor will parse arguments and create a // CompilationDatabase. In case of error it will terminate the program. - CommonOptionsParser OptionsParser(argc, argv, MyToolCategory); + auto OptionsParser = CommonOptionsParser::create(argc, argv, MyToolCategory); ---------------- Sirraide wrote:
```suggestion Expected<CommonOptionsParser> ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory); if (auto E = ExpectedParser.takeError()) { errs() << "Error creating options parser: " << toString(std::move(E)) << "\n"; return 1; } auto& OptionsParser = ExpectedParser.get(); ``` Using `->` or `*` on an `Expected` will assert if the `Expected` hasn’t been checked for errors, even if it does not contain an error. Something like this should work, but please verify that this actually compiles. Furthermore, we normally spell out types instead of using `auto` in cases where the type isn’t obvious from the context. Moreover, I think there’s value in being a bit more verbose here since this documentation is mainly intended for people new to libtooling. https://github.com/llvm/llvm-project/pull/90441 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits