Make use of Error and Expected to bubble up diagnostics and force
checking of errors in the callers.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 33562 Build 33561: arc lint + arc unit
Event Timeline
Comment Actions
Looks good to me. Just two minor comments:
This adds quite a lot of return make_error<ParseErrorInfo>(SM.GetMessage(SMLoc::getFromPointer(Foo.data()), SourceMgr::DK_Error, "...")));
Maybe adding a helper would make sense? Something like:
Error ParseErrorInfo::get(const SourceManager& SM, const char* LocPtr, const Twine& ErrMsg) { return make_error<ParseErrorInfo>(SM.GetMessage(SMLoc::getFromPointer(LocPtr), SourceMgr::DK_Error, ErrMsg))); }
Then the above can just be return ParseErrorInfo::get(SM, Foo.data(), "...");
Comment Actions
- Fix bugs in unit test when running with Error checks enabled
- Make eval() functions return an Expected instead of Optional
- Create helper functions to create ParseError and its associated diagnostic
- Rename ParseErrorInfo into FileCheckParseError
Comment Actions
- Remove useless llvm_unreachable from handleAllErrors
- Move comment to apply to both ignored errors
This can be simplified to Diagnostic.print(nullptr, OS);