|
36 | 36 |
|
37 | 37 | #ifdef USE_DSTRING
|
38 | 38 |
|
39 |
| -#define IREP_ID_ONE(the_id) extern const dstringt ID_##the_id; |
40 |
| -#define IREP_ID_TWO(the_id, str) extern const dstringt ID_##the_id; |
| 39 | +enum class idt : unsigned |
| 40 | +{ |
| 41 | +#define IREP_ID_ONE(the_id) id_##the_id, |
| 42 | +#define IREP_ID_TWO(the_id, str) id_##the_id, |
| 43 | + |
| 44 | +#include "irep_ids.def" // NOLINT(build/include) |
| 45 | +}; |
| 46 | + |
| 47 | +#ifdef __GNUC__ |
| 48 | +#define IREP_ID_ONE(the_id) \ |
| 49 | + constexpr dstringt ID_##the_id=dstringt::make_from_table_index( \ |
| 50 | + static_cast<unsigned>(idt::id_##the_id)); |
| 51 | +#define IREP_ID_TWO(the_id, str) \ |
| 52 | + constexpr dstringt ID_##the_id=dstringt::make_from_table_index( \ |
| 53 | + static_cast<unsigned>(idt::id_##the_id)); |
| 54 | +#else |
| 55 | +#define IREP_ID_ONE(the_id) \ |
| 56 | + const dstringt ID_##the_id=dstringt::make_from_table_index( \ |
| 57 | + static_cast<unsigned>(idt::id_##the_id)); |
| 58 | +#define IREP_ID_TWO(the_id, str) \ |
| 59 | + const const dstringt ID_##the_id=dstringt::make_from_table_index( \ |
| 60 | + static_cast<unsigned>(idt::id_##the_id)); |
| 61 | +#endif |
| 62 | + |
| 63 | +template <> |
| 64 | +struct diagnostics_helpert<irep_idt> |
| 65 | +{ |
| 66 | + static std::string diagnostics_as_string(const irep_idt &irep_id) |
| 67 | + { |
| 68 | + return as_string(irep_id); |
| 69 | + } |
| 70 | +}; |
41 | 71 |
|
42 | 72 | #else
|
43 | 73 |
|
|
0 commit comments