25 if(src[0]==
'u' && src[1]==
'8')
30 std::basic_string<char32_t> value =
37 value.resize(utf8_value.size());
38 for(std::size_t i=0; i<utf8_value.size(); i++)
39 value[i]=utf8_value[i];
43 else if(src[0]==
'L' || src[0]==
'u' || src[0]==
'U')
55 std::string char_value=
59 std::basic_string<char32_t> value;
60 value.resize(char_value.size());
61 for(std::size_t i=0; i<char_value.size(); i++)
62 value[i]=char_value[i];
74 std::basic_string<char32_t> value;
78 for(std::size_t i=0; i<src.size(); i++)
83 if(ch!=
'L' && ch!=
'u' && ch!=
'U' && ch!=
'"')
88 if((ch==
'u' || ch==
'U') && i+1<src.size() && src[i+1]==
'"')
92 std::size_t j=src.find(
'"', i);
96 for(++j; j<src.size() && src[j]!=
'"'; ++j)
100 INVARIANT(j < src.size(),
"non-terminated string constant '" + src +
"'");
102 std::string tmp_src=std::string(src, i, j-i+1);
104 value.append(tmp_value);
126 result.
set(ID_C_string_constant,
true);
130 result.
operands().resize(value.size());
131 for(std::size_t i=0; i<value.size(); i++)
138 std::string char_value;
140 char_value.resize(value.size());
142 for(std::size_t i=0; i<value.size(); i++)
146 char_value[i]=value[i];
unsignedbv_typet char32_t_type()
bitvector_typet wchar_t_type()
bitvector_typet c_index_type()
unsignedbv_typet char16_t_type()
Base class for all expressions.
typet & type()
Return the type of the expression.
void set(const irep_idt &name, const irep_idt &value)
The type of an expression, extends irept.
std::basic_string< char32_t > convert_one_string_literal(const std::string &src)
exprt convert_string_literal(const std::string &src)
C/C++ Language Conversion.
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
std::basic_string< char32_t > unescape_wide_string(const std::string &src)
std::string unescape_string(const std::string &src)
ANSI-C Language Conversion.
std::string utf32_native_endian_to_utf8(const std::basic_string< char32_t > &s)