54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#include "elna/gcc/elna-diagnostic.h"
|
|
#include "elna/gcc/elna-tree.h"
|
|
|
|
namespace elna
|
|
{
|
|
namespace gcc
|
|
{
|
|
location_t get_location(const elna::source::position *position)
|
|
{
|
|
linemap_line_start(line_table, position->line, 0);
|
|
|
|
return linemap_position_for_column(line_table, position->column);
|
|
}
|
|
|
|
const char *print_type(tree type)
|
|
{
|
|
gcc_assert(TYPE_P(type));
|
|
|
|
if (type == integer_type_node)
|
|
{
|
|
return "Int";
|
|
}
|
|
else if (type == boolean_type_node)
|
|
{
|
|
return "Bool";
|
|
}
|
|
else if (type == double_type_node)
|
|
{
|
|
return "Float";
|
|
}
|
|
else if (type == elna_char_type_node)
|
|
{
|
|
return "Char";
|
|
}
|
|
else if (is_string_type(type))
|
|
{
|
|
return "String";
|
|
}
|
|
else if (is_pointer_type(type))
|
|
{
|
|
return "pointer";
|
|
}
|
|
else if (is_array_type(type))
|
|
{
|
|
return "array";
|
|
}
|
|
else
|
|
{
|
|
return "<<unknown-type>>";
|
|
}
|
|
}
|
|
}
|
|
}
|