本文整理汇总了C++中typet::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ typet::clear方法的具体用法?C++ typet::clear怎么用?C++ typet::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typet
的用法示例。
在下文中一共展示了typet::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void ansi_c_convert_typet::write(typet &type)
{
type.clear();
// first, do "other"
if(!other.empty())
{
if(
double_cnt || float_cnt || signed_cnt || unsigned_cnt || int_cnt ||
bool_cnt || short_cnt || char_cnt || int8_cnt || int16_cnt || int32_cnt ||
int64_cnt || ptr32_cnt || ptr64_cnt || long_cnt)
{
err_location(location);
error("illegal type modifier for defined type");
throw 0;
}
if(other.size() != 1)
{
err_location(location);
error("illegal combination of defined types");
throw 0;
}
type.swap(other.front());
}
else if(double_cnt || float_cnt)
{
if(
signed_cnt || unsigned_cnt || int_cnt || bool_cnt || int8_cnt ||
int16_cnt || int32_cnt || int64_cnt || ptr32_cnt || ptr64_cnt ||
short_cnt || char_cnt)
{
err_location(location);
error("cannot conbine integer type with float");
throw 0;
}
if(double_cnt && float_cnt)
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
if(long_cnt == 0)
{
if(double_cnt != 0)
type = double_type();
else
type = float_type();
}
else if(long_cnt == 1 || long_cnt == 2)
{
if(double_cnt != 0)
type = long_double_type();
else
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
}
else
{
err_location(location);
error("illegal type modifier for float");
throw 0;
}
}
else if(bool_cnt)
{
if(
signed_cnt || unsigned_cnt || int_cnt || short_cnt || int8_cnt ||
int16_cnt || int32_cnt || int64_cnt || ptr32_cnt || ptr64_cnt ||
char_cnt || long_cnt)
{
err_location(location);
error("illegal type modifier for boolean type");
throw 0;
}
type.id("bool");
}
else if(ptr32_cnt || ptr64_cnt)
{
type.id("pointer");
type.subtype() = typet("empty");
}
else
{
// it is integer -- signed or unsigned?
if(signed_cnt && unsigned_cnt)
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
//.........这里部分代码省略.........
示例2: write
void ansi_c_convert_typet::write(typet &type)
{
type.clear();
// first, do "other"
if(!other.empty())
{
if(double_cnt || float_cnt || signed_cnt ||
unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
short_cnt || char_cnt || complex_cnt || long_cnt ||
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
gcc_float128_cnt || gcc_int128_cnt || bv_cnt)
{
err_location(location);
error("illegal type modifier for defined type");
throw 0;
}
if(other.size()!=1)
{
err_location(location);
error("illegal combination of defined types");
throw 0;
}
type.swap(other.front());
}
else if(gcc_float128_cnt)
{
if(signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
gcc_int128_cnt || bv_cnt ||
short_cnt || char_cnt)
{
err_location(location);
error("cannot combine integer type with float");
throw 0;
}
if(long_cnt || double_cnt || float_cnt)
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
type=long_double_type();
}
else if(double_cnt || float_cnt)
{
if(signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
gcc_int128_cnt|| bv_cnt ||
short_cnt || char_cnt)
{
err_location(location);
error("cannot combine integer type with float");
throw 0;
}
if(double_cnt && float_cnt)
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
if(long_cnt==0)
{
if(double_cnt!=0)
type=double_type();
else
type=float_type();
}
else if(long_cnt==1 || long_cnt==2)
{
if(double_cnt!=0)
type=long_double_type();
else
{
err_location(location);
error("conflicting type modifiers");
throw 0;
}
}
else
{
err_location(location);
error("illegal type modifier for float");
throw 0;
}
}
else if(c_bool_cnt)
{
if(signed_cnt || unsigned_cnt || int_cnt || short_cnt ||
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
char_cnt || long_cnt)
{
//.........这里部分代码省略.........