Skip to content

Commit

Permalink
Do not collect stacktrace for compiler errors
Browse files Browse the repository at this point in the history
These exceptions are used for compiler errors and collecting the
stacktrace slows them down.
  • Loading branch information
certik committed Aug 24, 2020
1 parent 5e7e71c commit 394b550
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lfortran/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class LFortranException : public std::exception
: m_msg(msg), ec(error)
{
#if defined(HAVE_LFORTRAN_STACKTRACE)
m_stacktrace = LFortran::get_stacktrace(stacktrace_dept);
if (ec != lfortran_exceptions_t::LFORTRAN_TOKENIZER_ERROR &&
ec != lfortran_exceptions_t::LFORTRAN_PARSER_ERROR &&
ec != lfortran_exceptions_t::LFORTRAN_SEMANTIC_ERROR) {
m_stacktrace = LFortran::get_stacktrace(stacktrace_dept);
}
#endif
}
LFortranException(const std::string &msg)
Expand Down

0 comments on commit 394b550

Please sign in to comment.