cprover
message.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #include "message.h"
11 
13  unsigned level,
14  const std::string &message,
15  int sequence_number,
16  const source_locationt &location)
17 {
18  std::string dest;
19 
20  const irep_idt &file=location.get_file();
21  const irep_idt &line=location.get_line();
22  const irep_idt &column=location.get_column();
23  const irep_idt &function=location.get_function();
24 
25  if(!file.empty())
26  {
27  if(dest!="")
28  dest+=' ';
29  dest+="file "+id2string(file);
30  }
31  if(!line.empty())
32  {
33  if(dest!="")
34  dest+=' ';
35  dest+="line "+id2string(line);
36  }
37  if(!column.empty())
38  {
39  if(dest!="")
40  dest+=' ';
41  dest+="column "+id2string(column);
42  }
43  if(!function.empty())
44  {
45  if(dest!="")
46  dest+=' ';
47  dest+="function "+id2string(function);
48  }
49 
50  if(dest!="")
51  dest+=": ";
52  dest+=message;
53 
54  print(level, dest);
55 }
56 
58  unsigned level,
59  const std::string &message)
60 {
61  if(level>=message_count.size())
62  message_count.resize(level+1, 0);
63  ++message_count[level];
64 }
65 
67 {
68 }
const std::string & id2string(const irep_idt &d)
Definition: irep.h:44
virtual ~messaget()
Definition: message.cpp:66
const irep_idt & get_function() const
const irep_idt & get_column() const
const irep_idt & get_line() const
const irep_idt & get_file() const
std::vector< unsigned > message_count
Definition: message.h:57
bool empty() const
Definition: dstring.h:61
virtual void print(unsigned level, const std::string &message)=0
Definition: message.cpp:57
Definition: kdev_t.h:19