CBMC
typecheck.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #include "typecheck.h"
10 
11 #include "exception_utils.h"
12 #include "invariant.h"
13 
15 {
17 
18  const unsigned errors_before=
20 
21  try
22  {
23  typecheck();
24  }
25 
26  catch(int)
27  {
28  error();
29  }
30 
31  catch(const char *e)
32  {
33  error() << e << eom;
34  }
35 
36  catch(const std::string &e)
37  {
38  error() << e << eom;
39  }
40 
41  catch(const invalid_source_file_exceptiont &e)
42  {
44  error() << e.get_reason() << messaget::eom;
45  }
46 
47  return message_handler->get_message_count(messaget::M_ERROR)!=errors_before;
48 }
exception_utils.h
invariant.h
invalid_source_file_exceptiont
Thrown when we can't handle something in an input source file.
Definition: exception_utils.h:171
messaget::eom
static eomt eom
Definition: message.h:297
invalid_source_file_exceptiont::get_source_location
const source_locationt & get_source_location() const
Definition: exception_utils.h:184
messaget::error
mstreamt & error() const
Definition: message.h:399
messaget::mstreamt::source_location
source_locationt source_location
Definition: message.h:247
typecheck.h
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
messaget::M_ERROR
@ M_ERROR
Definition: message.h:170
messaget::message_handler
message_handlert * message_handler
Definition: message.h:439
invalid_source_file_exceptiont::get_reason
const std::string & get_reason() const
Definition: exception_utils.h:179
typecheckt::typecheck
virtual void typecheck()=0
typecheckt::typecheck_main
virtual bool typecheck_main()
Definition: typecheck.cpp:14
message_handlert::get_message_count
std::size_t get_message_count(unsigned level) const
Definition: message.h:56