This is an archive of the discontinued LLVM Phabricator instance.

[clang-tooling] Prevent llvm::fatal_error on invalid CLI option
ClosedPublic

Authored by serge-sans-paille on Jan 11 2021, 8:12 AM.

Details

Summary

Fail gracefully instead. Prevent further misuse by enforcing the factory builder instead of the constructor.

Diff Detail

Event Timeline

serge-sans-paille requested review of this revision.Jan 11 2021, 8:12 AM
serge-sans-paille created this revision.

ping ? This change looks harmless to me, I'd appreciate an ack though.

alexfh requested changes to this revision.Jan 19 2021, 5:51 PM

This is quite a bit of extra boilerplate, but it results in a more transparent error handling. However, the documentation would need to be changed (clang/docs/LibASTMatchersTutorial.rst). And what about other tools (e.g. clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp, clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp, etc.)?

This revision now requires changes to proceed.Jan 19 2021, 5:51 PM

Address doc + tool-extra issues

Thanks @alexfh ! Should be good now.

alexfh accepted this revision.Jan 28 2021, 5:34 PM

Thanks! Looks good now.

This revision is now accepted and ready to land.Jan 28 2021, 5:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2021, 1:21 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nridge added a subscriber: nridge.Feb 28 2022, 11:46 PM

It would be nice to update the code example in the LibTooling documentation as well

Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2022, 11:46 PM