Commit Graph
5 Commits
Author SHA1 Message Date
Jon Meow 52096e4299 Apply clang-tidy fixes to the common dir (#884) 2021-10-14 13:39:05 -07:00
Chandler CarruthandGeoff Romer a2c91eae89 Rework exiting system to have better backtraces. (#863)
Previously, the program exit was triggered by the destructor.
Unfortunately, C++ doesn't make it precisely clear where the destructor
is run, and Clang doesn't generate reliable debug information for that
to give good backtraces. Among other things, when combining separate
cleanup regions in Clang there may be no single canonical location.

Instead, move the ExitingStream system to use an explicit
low-precedence operator overload to flush the output and exit. This
ensures the stream and other actions are completed first but then
immediately exits the program in a way that has a definitive source
location and produces reliable backtraces.

I've tried to add comments and helpers to make this as clear as possible
given that it is a subtle and surprising issue.

Co-authored-by: Geoff Romer <gromer@google.com>
2021-10-05 00:30:43 -07:00
Jon Meow 2e9e4f4cb3 Migrate remaining exits to FATAL_*_ERROR calls (#704)
Adds FATAL for things that are most likely programming errors in executable_semantics.
2021-08-06 13:06:25 -07:00
Jon MeowandChandler Carruth f0af3cb795 Switch from llvm::errs()+exit() to FATAL_USER_ERROR() stream-based handling. (#670)
This is intended to:

- Standardize use of line_num (and highlight where no line_num is available).
- Standardize indications of runtime/compilation errors.
- Make it incrementally easier to write new errors.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-07-28 10:47:33 -07:00
Jon Meow 034f3600e3 Add a FatalUserError macro to help print user-caused errors. (#668) 2021-07-21 12:38:56 -07:00