diff --git a/src/analyses/goto_check.cpp b/src/analyses/goto_check.cpp index 354d12503ec..75c039343b2 100644 --- a/src/analyses/goto_check.cpp +++ b/src/analyses/goto_check.cpp @@ -1689,21 +1689,21 @@ void goto_checkt::goto_check( { i_it->source_location.id(irep_idt()); - if(it->source_location.get_file()!=irep_idt()) + if(!it->source_location.get_file().empty()) i_it->source_location.set_file(it->source_location.get_file()); - if(it->source_location.get_line()!=irep_idt()) + if(!it->source_location.get_line().empty()) i_it->source_location.set_line(it->source_location.get_line()); - if(it->source_location.get_function()!=irep_idt()) + if(!it->source_location.get_function().empty()) i_it->source_location.set_function( it->source_location.get_function()); - if(it->source_location.get_column()!=irep_idt()) + if(!it->source_location.get_column().empty()) i_it->source_location.set_column(it->source_location.get_column()); } - if(i_it->function==irep_idt()) + if(i_it->function.empty()) i_it->function=it->function; } diff --git a/src/ansi-c/ansi_c_declaration.cpp b/src/ansi-c/ansi_c_declaration.cpp index 75726b7471e..74915af0f42 100644 --- a/src/ansi-c/ansi_c_declaration.cpp +++ b/src/ansi-c/ansi_c_declaration.cpp @@ -33,7 +33,7 @@ void ansi_c_declaratort::build(irept &src) t.make_nil(); break; } - else if(t.id()==irep_idt() || + else if(t.id().empty() || t.is_nil()) { assert(0); diff --git a/src/ansi-c/c_typecheck_base.cpp b/src/ansi-c/c_typecheck_base.cpp index f508c952322..74a0f33f962 100644 --- a/src/ansi-c/c_typecheck_base.cpp +++ b/src/ansi-c/c_typecheck_base.cpp @@ -539,7 +539,7 @@ void c_typecheck_baset::typecheck_function_body(symbolt &symbol) p_it++) { // may be anonymous - if(p_it->get_base_name()==irep_idt()) + if(p_it->get_base_name().empty()) { irep_idt base_name="#anon"+std::to_string(anon_counter++); p_it->set_base_name(base_name); diff --git a/src/ansi-c/c_typecheck_expr.cpp b/src/ansi-c/c_typecheck_expr.cpp index 58806f5f6b1..185c576e401 100644 --- a/src/ansi-c/c_typecheck_expr.cpp +++ b/src/ansi-c/c_typecheck_expr.cpp @@ -1522,7 +1522,7 @@ void c_typecheck_baset::typecheck_expr_member(exprt &expr) // copy method identifier const irep_idt &identifier=component.get(ID_C_identifier); - if(identifier!=irep_idt()) + if(!identifier.empty()) expr.set(ID_C_identifier, identifier); const irep_idt &access=component.get_access(); diff --git a/src/ansi-c/c_typecheck_type.cpp b/src/ansi-c/c_typecheck_type.cpp index 8a6ec9e154c..448df44cef4 100644 --- a/src/ansi-c/c_typecheck_type.cpp +++ b/src/ansi-c/c_typecheck_type.cpp @@ -428,7 +428,7 @@ void c_typecheck_baset::typecheck_code_type(code_typet &type) irep_idt identifier=declaration.declarator().get_name(); // abstract or not? - if(identifier==irep_idt()) + if(identifier.empty()) { // abstract parameter.add_source_location()=declaration.type().source_location(); @@ -550,7 +550,7 @@ void c_typecheck_baset::typecheck_array_type(array_typet &type) { // not a constant and not infinity - assert(current_symbol_id!=irep_idt()); + assert(!current_symbol_id.empty()); const symbolt &base_symbol=lookup(current_symbol_id); @@ -862,7 +862,7 @@ void c_typecheck_baset::typecheck_compound_body( // scan for anonymous members, and name them for(auto &member : components) { - if(member.get_name()!=irep_idt()) + if(!member.get_name().empty()) continue; member.set_name("$anon"+std::to_string(anon_member_counter++)); diff --git a/src/ansi-c/type2name.cpp b/src/ansi-c/type2name.cpp index 6e3ce05b757..e9a564d35b2 100644 --- a/src/ansi-c/type2name.cpp +++ b/src/ansi-c/type2name.cpp @@ -110,7 +110,7 @@ static std::string type2name( if(!type.source_location().get_function().empty()) result+='l'; - if(type.id()==irep_idt()) + if(type.id().empty()) throw "empty type encountered"; else if(type.id()==ID_empty) result+='V'; diff --git a/src/cpp/cpp_declarator.cpp b/src/cpp/cpp_declarator.cpp index aa671c45a5f..cbf97d6a06e 100644 --- a/src/cpp/cpp_declarator.cpp +++ b/src/cpp/cpp_declarator.cpp @@ -49,7 +49,7 @@ typet cpp_declaratort::merge_type(const typet &declaration_type) const } else { - assert(t.id()!=irep_idt()); + assert(!t.id().empty()); p=&t.subtype(); } } diff --git a/src/cpp/cpp_exception_id.cpp b/src/cpp/cpp_exception_id.cpp index d3a4b8f7081..18649696f53 100644 --- a/src/cpp/cpp_exception_id.cpp +++ b/src/cpp/cpp_exception_id.cpp @@ -59,7 +59,7 @@ void cpp_exception_list_rec( // grab C/C++ type irep_idt c_type=src.get(ID_C_c_type); - if(c_type!=irep_idt()) + if(!c_type.empty()) { dest.push_back(id2string(c_type)+suffix); return; diff --git a/src/cpp/cpp_instantiate_template.cpp b/src/cpp/cpp_instantiate_template.cpp index e4ee0403ed6..79e3de89b06 100644 --- a/src/cpp/cpp_instantiate_template.cpp +++ b/src/cpp/cpp_instantiate_template.cpp @@ -485,7 +485,7 @@ const symbolt &cpp_typecheckt::instantiate_template( bool is_static=new_decl.storage_spec().is_static(); irep_idt access = new_decl.get(ID_C_access); - assert(access != irep_idt()); + assert(!access.empty()); assert(symb.type.id()==ID_struct); typecheck_compound_declarator( diff --git a/src/cpp/cpp_type2name.cpp b/src/cpp/cpp_type2name.cpp index 6a938a9a4f0..c92c32eb2a2 100644 --- a/src/cpp/cpp_type2name.cpp +++ b/src/cpp/cpp_type2name.cpp @@ -119,7 +119,7 @@ std::string cpp_type2name(const typet &type) // we try to use #c_type const irep_idt c_type=type.get(ID_C_c_type); - if(c_type!=irep_idt()) + if(!c_type.empty()) result+=id2string(c_type); else if(type.id()==ID_unsignedbv) result+="unsigned_int"; @@ -131,7 +131,7 @@ std::string cpp_type2name(const typet &type) // we try to use #c_type const irep_idt c_type=type.get(ID_C_c_type); - if(c_type!=irep_idt()) + if(!c_type.empty()) result+=id2string(c_type); else result+="double"; diff --git a/src/cpp/cpp_typecheck_bases.cpp b/src/cpp/cpp_typecheck_bases.cpp index 7432b7a382b..9d8060301d5 100644 --- a/src/cpp/cpp_typecheck_bases.cpp +++ b/src/cpp/cpp_typecheck_bases.cpp @@ -71,7 +71,7 @@ void cpp_typecheckt::typecheck_compound_bases(struct_typet &type) bool virtual_base = base_it->get_bool(ID_virtual); irep_idt class_access = base_it->get(ID_protection); - if(class_access==irep_idt()) + if(class_access.empty()) class_access = default_class_access; base_symbol_expr.id(ID_base); diff --git a/src/cpp/cpp_typecheck_compound_type.cpp b/src/cpp/cpp_typecheck_compound_type.cpp index 0549197fc90..6e2cce31d74 100644 --- a/src/cpp/cpp_typecheck_compound_type.cpp +++ b/src/cpp/cpp_typecheck_compound_type.cpp @@ -602,7 +602,7 @@ void cpp_typecheckt::typecheck_compound_declarator( { irep_idt base_name=arg.get_base_name(); - if(base_name==irep_idt()) + if(base_name.empty()) base_name="arg"+std::to_string(i++); symbolt arg_symb; @@ -769,7 +769,7 @@ void cpp_typecheckt::put_compound_into_scope( const irep_idt &name=compound.get_name(); // nothing to do if no base_name (e.g., an anonymous bitfield) - if(base_name==irep_idt()) + if(base_name.empty()) return; if(compound.type().id()==ID_code) @@ -983,7 +983,7 @@ void cpp_typecheckt::typecheck_compound_body(symbolt &symbol) continue; } - if(declaration.type().id()==irep_idt()) // empty? + if(declaration.type().id().empty()) continue; bool is_typedef=declaration.is_typedef(); @@ -1259,7 +1259,7 @@ void cpp_typecheckt::typecheck_member_function( if(component.get_bool(ID_is_static)) { - if(method_qualifier.id()!=irep_idt()) + if(!method_qualifier.id().empty()) { error().source_location=component.source_location(); error() << "method is static -- no qualifiers allowed" << eom; diff --git a/src/cpp/cpp_typecheck_expr.cpp b/src/cpp/cpp_typecheck_expr.cpp index fb2981ce188..979572c717e 100644 --- a/src/cpp/cpp_typecheck_expr.cpp +++ b/src/cpp/cpp_typecheck_expr.cpp @@ -571,7 +571,7 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr) } for(const operator_entryt *e=operators; - e->id!=irep_idt(); + !e->id.empty(); e++) if(expr.id()==e->id) { diff --git a/src/cpp/cpp_typecheck_type.cpp b/src/cpp/cpp_typecheck_type.cpp index 24dc19c74dd..376efd6f9e1 100644 --- a/src/cpp/cpp_typecheck_type.cpp +++ b/src/cpp/cpp_typecheck_type.cpp @@ -20,7 +20,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu void cpp_typecheckt::typecheck_type(typet &type) { - assert(type.id()!=irep_idt()); + assert(!type.id().empty()); assert(type.is_not_nil()); try diff --git a/src/cpp/expr2cpp.cpp b/src/cpp/expr2cpp.cpp index c5169aebf80..1ed9ff738c4 100644 --- a/src/cpp/expr2cpp.cpp +++ b/src/cpp/expr2cpp.cpp @@ -150,7 +150,7 @@ std::string expr2cppt::convert_rec( { return q+convert(src.subtype())+" &&"+d; } - else if(src.get(ID_C_c_type)!=irep_idt()) + else if(!src.get(ID_C_c_type).empty()) { const irep_idt c_type=src.get(ID_C_c_type); @@ -208,7 +208,7 @@ std::string expr2cppt::convert_rec( else dest+="struct"; - if(symbol.pretty_name!=irep_idt()) + if(!symbol.pretty_name.empty()) dest+=" "+id2string(symbol.pretty_name); dest+=d; @@ -221,7 +221,7 @@ std::string expr2cppt::convert_rec( dest+="enum"; - if(symbol.pretty_name!=irep_idt()) + if(!symbol.pretty_name.empty()) dest+=" "+id2string(symbol.pretty_name); dest+=d; diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index ff59d80ebf5..190e9e1e8ce 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -398,7 +398,7 @@ class Parser // NOLINT(readability/identifiers) { typet *p=&dest; - while(p->id()!=irep_idt() && p->is_not_nil()) + while(!p->id().empty() && p->is_not_nil()) { if(p->id()==ID_merged_type) { @@ -2224,7 +2224,7 @@ bool Parser::optIntegralTypeOrClassSpec(typet &p) default: type_id=irep_idt(); } - if(type_id!=irep_idt()) + if(!type_id.empty()) { cpp_tokent tk; typet kw; @@ -3467,7 +3467,7 @@ bool Parser::rOperatorName(irept &name) return rCastOperatorName(name); } - assert(operator_id!=irep_idt()); + assert(!operator_id.empty()); lex.get_token(tk); name=irept(operator_id); set_location(name, tk); diff --git a/src/goto-programs/goto_inline_class.cpp b/src/goto-programs/goto_inline_class.cpp index 1e4dd8d99d5..592630f1443 100644 --- a/src/goto-programs/goto_inline_class.cpp +++ b/src/goto-programs/goto_inline_class.cpp @@ -57,7 +57,7 @@ void goto_inlinet::parameter_assignments( const irep_idt &identifier=parameter.get_identifier(); - if(identifier==irep_idt()) + if(identifier.empty()) { error().source_location=source_location; error() << "no identifier for function parameter" << eom; @@ -182,7 +182,7 @@ void goto_inlinet::parameter_destruction( const irep_idt &identifier=parameter.get_identifier(); - if(identifier==irep_idt()) + if(identifier.empty()) { error().source_location=source_location; error() << "no identifier for function parameter" << eom; @@ -328,13 +328,13 @@ void replace_location( dest=new_location; - if(comment!=irep_idt()) + if(!comment.empty()) dest.set_comment(comment); - if(property_class!=irep_idt()) + if(!property_class.empty()) dest.set_property_class(property_class); - if(property_id!=irep_idt()) + if(!property_id.empty()) dest.set_property_id(property_id); } diff --git a/src/goto-symex/symex_builtin_functions.cpp b/src/goto-symex/symex_builtin_functions.cpp index 44e7d532c42..a85d6e5b18d 100644 --- a/src/goto-symex/symex_builtin_functions.cpp +++ b/src/goto-symex/symex_builtin_functions.cpp @@ -221,7 +221,7 @@ void goto_symext::symex_gcc_builtin_va_arg_next( exprt rhs=zero_initializer(lhs.type(), code.source_location(), ns); - if(id!=irep_idt()) + if(!id.empty()) { // strip last name off id to get function name std::size_t pos=id2string(id).rfind("::"); diff --git a/src/goto-symex/symex_function_call.cpp b/src/goto-symex/symex_function_call.cpp index 18813a9ec97..e50d1c8ea7f 100644 --- a/src/goto-symex/symex_function_call.cpp +++ b/src/goto-symex/symex_function_call.cpp @@ -62,7 +62,7 @@ void goto_symext::parameter_assignments( const irep_idt &identifier=parameter.get_identifier(); - if(identifier==irep_idt()) + if(identifier.empty()) throw "no identifier for function parameter"; const symbolt &symbol=ns.lookup(identifier); diff --git a/src/java_bytecode/java_bytecode_convert_method.cpp b/src/java_bytecode/java_bytecode_convert_method.cpp index 1aaeac39005..f9f75e45dbe 100644 --- a/src/java_bytecode/java_bytecode_convert_method.cpp +++ b/src/java_bytecode/java_bytecode_convert_method.cpp @@ -2309,7 +2309,7 @@ codet java_bytecode_convert_methodt::convert_instructions( if(v.is_parameter) continue; // Skip anonymous variables: - if(v.symbol_expr.get_identifier()==irep_idt()) + if(v.symbol_expr.get_identifier().empty()) continue; auto &block=get_block_for_pcrange( root, diff --git a/src/java_bytecode/java_bytecode_language.cpp b/src/java_bytecode/java_bytecode_language.cpp index 7fb765f1a4c..7ba75b1d8f4 100644 --- a/src/java_bytecode/java_bytecode_language.cpp +++ b/src/java_bytecode/java_bytecode_language.cpp @@ -203,9 +203,9 @@ static void get_virtual_method_targets( assert(called_function.id()==ID_virtual_function); const auto &call_class=called_function.get(ID_C_class); - assert(call_class!=irep_idt()); + assert(!call_class.empty()); const auto &call_basename=called_function.get(ID_component_name); - assert(call_basename!=irep_idt()); + assert(!call_basename.empty()); auto old_size=needed_methods.size(); @@ -218,7 +218,7 @@ static void get_virtual_method_targets( call_basename, child_class, symbol_table); - if(child_method!=irep_idt()) + if(!child_method.empty()) needed_methods.push_back(child_method); } @@ -231,7 +231,7 @@ static void get_virtual_method_targets( call_basename, parent_class_id, symbol_table); - if(parent_method!=irep_idt()) + if(!parent_method.empty()) { needed_methods.push_back(parent_method); break; diff --git a/src/java_bytecode/java_bytecode_parse_tree.cpp b/src/java_bytecode/java_bytecode_parse_tree.cpp index 148e5a72212..6da1a7f1872 100644 --- a/src/java_bytecode/java_bytecode_parse_tree.cpp +++ b/src/java_bytecode/java_bytecode_parse_tree.cpp @@ -157,7 +157,7 @@ void java_bytecode_parse_treet::methodt::output(std::ostream &out) const for(const auto &i : instructions) { - if(i.source_location.get_line()!=irep_idt()) + if(!i.source_location.get_line().empty()) out << " // " << i.source_location << '\n'; out << " " << i.address << ": "; diff --git a/src/path-symex/build_goto_trace.cpp b/src/path-symex/build_goto_trace.cpp index fed73f16457..eefb5361f5c 100644 --- a/src/path-symex/build_goto_trace.cpp +++ b/src/path-symex/build_goto_trace.cpp @@ -105,7 +105,7 @@ void build_goto_trace( const irep_idt &comment= instruction.source_location.get_comment(); - if(comment!=irep_idt()) + if(!comment.empty()) trace_step.comment=id2string(comment); else trace_step.comment="assertion"; diff --git a/src/path-symex/path_symex.cpp b/src/path-symex/path_symex.cpp index 356474cc294..3ae6b858b7f 100644 --- a/src/path-symex/path_symex.cpp +++ b/src/path-symex/path_symex.cpp @@ -699,7 +699,7 @@ void path_symext::function_call_rec( const code_typet::parametert &function_parameter=function_parameters[i]; irep_idt identifier=function_parameter.get_identifier(); - if(identifier==irep_idt()) + if(identifier.empty()) throw "function_call " + id2string(function_identifier) + " no identifier for function parameter"; diff --git a/src/path-symex/path_symex_state_read.cpp b/src/path-symex/path_symex_state_read.cpp index 89783226300..4e60dd91ff7 100644 --- a/src/path-symex/path_symex_state_read.cpp +++ b/src/path-symex/path_symex_state_read.cpp @@ -407,7 +407,7 @@ exprt path_symex_statet::read_symbol_member_index( else { // we do some SSA symbol - if(var_state.ssa_symbol.get_identifier()==irep_idt()) + if(var_state.ssa_symbol.get_identifier().empty()) { // produce one var_state.ssa_symbol=var_info.ssa_symbol(); diff --git a/src/path-symex/var_map.cpp b/src/path-symex/var_map.cpp index 83193f4abc5..97563e31240 100644 --- a/src/path-symex/var_map.cpp +++ b/src/path-symex/var_map.cpp @@ -22,7 +22,7 @@ var_mapt::var_infot &var_mapt::operator()( const irep_idt &suffix, const typet &type) { - assert(symbol!=irep_idt()); + assert(!symbol.empty()); std::string full_identifier= id2string(symbol)+id2string(suffix); diff --git a/src/pointer-analysis/add_failed_symbols.cpp b/src/pointer-analysis/add_failed_symbols.cpp index ef8688285e7..5def51a4499 100644 --- a/src/pointer-analysis/add_failed_symbols.cpp +++ b/src/pointer-analysis/add_failed_symbols.cpp @@ -76,7 +76,7 @@ exprt get_failed_symbol( const symbolt &symbol=ns.lookup(expr); irep_idt failed_symbol_id=symbol.type.get(ID_C_failed_symbol); - if(failed_symbol_id==irep_idt()) + if(failed_symbol_id.empty()) return nil_exprt(); const symbolt &failed_symbol=ns.lookup(failed_symbol_id); diff --git a/src/pointer-analysis/goto_program_dereference.cpp b/src/pointer-analysis/goto_program_dereference.cpp index 5665816cf67..44340aa0fc4 100644 --- a/src/pointer-analysis/goto_program_dereference.cpp +++ b/src/pointer-analysis/goto_program_dereference.cpp @@ -32,7 +32,7 @@ bool goto_program_dereferencet::has_failed_symbol( const irep_idt &failed_symbol= ptr_symbol.type.get("#failed_symbol"); - if(failed_symbol==irep_idt()) + if(failed_symbol.empty()) return false; return !ns.lookup(failed_symbol, symbol); diff --git a/src/pointer-analysis/value_set_analysis.cpp b/src/pointer-analysis/value_set_analysis.cpp index d1367f4e061..549fd53a348 100644 --- a/src/pointer-analysis/value_set_analysis.cpp +++ b/src/pointer-analysis/value_set_analysis.cpp @@ -44,7 +44,7 @@ void value_set_analysist::convert( if(location==previous_location) continue; - if(location.is_nil() || location.get_file()==irep_idt()) + if(location.is_nil() || location.get_file().empty()) continue; // find value set diff --git a/src/util/find_symbols.cpp b/src/util/find_symbols.cpp index 15501ae239a..32e10d33627 100644 --- a/src/util/find_symbols.cpp +++ b/src/util/find_symbols.cpp @@ -153,7 +153,7 @@ void find_symbols(kindt kind, const typet &src, find_symbols_sett &dest) find_symbols(kind, *it, dest); // irep_idt identifier=it->get_identifier(); - // if(identifier!=irep_idt() && (kind==F_TYPE || kind==F_BOTH)) + // if(!identifier.empty() && (kind==F_TYPE || kind==F_BOTH)) // dest.insert(identifier); } } diff --git a/src/util/simplify_expr.cpp b/src/util/simplify_expr.cpp index d8d62fee483..23d814b75a9 100644 --- a/src/util/simplify_expr.cpp +++ b/src/util/simplify_expr.cpp @@ -2322,7 +2322,7 @@ bool simplify_exprt::simplify_rec(exprt &expr) { const exprt &new_expr=cache_result.first->second; - if(new_expr.id()==irep_idt()) + if(new_expr.id().empty()) return true; // no change expr=new_expr; diff --git a/src/util/simplify_utils.cpp b/src/util/simplify_utils.cpp index d5583226f71..482d6ba4fee 100644 --- a/src/util/simplify_utils.cpp +++ b/src/util/simplify_utils.cpp @@ -99,7 +99,7 @@ static bool sort_and_join( const struct saj_tablet &saj_entry, const irep_idt &type_id) { - for(unsigned i=0; saj_entry.type_ids[i]!=irep_idt(); i++) + for(unsigned i=0; !saj_entry.type_ids[i].empty(); i++) if(type_id==saj_entry.type_ids[i]) return true; @@ -112,7 +112,7 @@ static const struct saj_tablet &sort_and_join( { unsigned i=0; - for( ; saj_table[i].id!=irep_idt(); i++) + for( ; !saj_table[i].id.empty(); i++) if(id==saj_table[i].id && sort_and_join(saj_table[i], type_id)) return saj_table[i]; @@ -129,7 +129,7 @@ bool sort_and_join(exprt &expr) const struct saj_tablet &saj_entry= sort_and_join(expr.id(), expr.type().id()); - if(saj_entry.id==irep_idt()) + if(saj_entry.id.empty()) return true; // check operand types diff --git a/src/util/std_types.cpp b/src/util/std_types.cpp index 6da91652bc1..b06af1ecf77 100644 --- a/src/util/std_types.cpp +++ b/src/util/std_types.cpp @@ -15,14 +15,14 @@ Author: Daniel Kroening, kroening@kroening.com std::size_t fixedbv_typet::get_integer_bits() const { const irep_idt integer_bits=get(ID_integer_bits); - assert(integer_bits!=irep_idt()); + assert(!integer_bits.empty()); return unsafe_string2unsigned(id2string(integer_bits)); } std::size_t floatbv_typet::get_f() const { const irep_idt &f=get(ID_f); - assert(f!=irep_idt()); + assert(!f.empty()); return unsafe_string2unsigned(id2string(f)); }