void do_resolve (std::vector <std::string> const& names, HandlerType const& handler, CompletionCounter) { check_precondition (! names.empty()); if (m_called_stop.load () == 0) { // TODO NIKB use emplace_back once we move to C++11 m_work.push_back(Work(names, handler)); m_journal.debug << "Queued new job with " << names.size() << " tasks. " << m_work.size() << " jobs outstanding."; if (m_work.size() == 1) { check_precondition (m_idle); m_journal.trace << "Waking up"; m_idle = false; m_io_service.post (m_strand.wrap (boost::bind ( &NameResolverImpl::do_work, this, CompletionCounter(this)))); } } }
void resolve ( std::vector <std::string> const& names, HandlerType const& handler) { check_precondition (m_called_stop.load () == 0); check_precondition (!names.empty()); // TODO NIKB use rvalue references to construct and move // reducing cost. m_io_service.dispatch (m_strand.wrap (boost::bind ( &NameResolverImpl::do_resolve, this, names, handler, CompletionCounter(this)))); }
void summarizer_fwt::inline_summaries(const function_namet &function_name, local_SSAt &SSA, const exprt &precondition, bool context_sensitive) { for(local_SSAt::nodest::const_iterator n_it = SSA.nodes.begin(); n_it != SSA.nodes.end(); n_it++) { for(local_SSAt::nodet::function_callst::const_iterator f_it = n_it->function_calls.begin(); f_it != n_it->function_calls.end(); f_it++) { assert(f_it->function().id()==ID_symbol); //no function pointers if(!check_call_reachable(function_name,SSA,n_it,f_it,precondition,true)) { continue; } if(!check_precondition(function_name,SSA,n_it,f_it, precondition,context_sensitive)) { exprt precondition_call = true_exprt(); if(context_sensitive) precondition_call = compute_calling_context( function_name,SSA,n_it,f_it,precondition,true); irep_idt fname = to_symbol_expr(f_it->function()).get_identifier(); status() << "Recursively summarizing function " << fname << eom; compute_summary_rec(fname,precondition_call,context_sensitive); summaries_used++; } } } }
void summarizer_fw_termt::inline_summaries( const function_namet &function_name, local_SSAt &SSA, exprt precondition, bool context_sensitive, threevalt &calls_terminate, bool &has_function_calls) { for(local_SSAt::nodest::iterator n_it=SSA.nodes.begin(); n_it!=SSA.nodes.end(); n_it++) { for(local_SSAt::nodet::function_callst::iterator f_it= n_it->function_calls.begin(); f_it!=n_it->function_calls.end(); f_it++) { assert(f_it->function().id()==ID_symbol); // no function pointers exprt::operandst c; c.push_back(precondition); get_assertions(SSA, c); // assertions as assumptions precondition=conjunction(c); if(!options.get_bool_option("competition-mode") && !check_call_reachable( function_name, SSA, n_it, f_it, precondition, true)) continue; has_function_calls=true; irep_idt fname=to_symbol_expr(f_it->function()).get_identifier(); if(!check_precondition( function_name, SSA, n_it, f_it, precondition, context_sensitive)) { exprt precondition_call=true_exprt(); if(context_sensitive) precondition_call=compute_calling_context( function_name, SSA, n_it, f_it, precondition, true); status() << "Recursively summarizing function " << fname << eom; compute_summary_rec(fname, precondition_call, context_sensitive); summaries_used++; } // get information about callee termination if(summary_db.exists(fname) && summary_db.get(fname).terminates!=YES) { // cannot propagate NO // because call reachability might be over-approximating calls_terminate=UNKNOWN; break; } } } }
Error statement_imp::execute() { Error error; check_precondition (m_stmt != nullptr); // ??? m_bGotData = false; m_session.set_got_data(m_bGotData); // binds int iCol = 0; for (intos_t::iterator iter = m_intos.begin(); iter != m_intos.end(); ++iter) (*iter)->bind(*this, iCol); int iParam = 1; for (uses_t::iterator iter = m_uses.begin(); iter != m_uses.end(); ++iter) (*iter)->bind(*this, iParam); // reset error = detail::sqliteError(__FILE__, __LINE__, sqlite3_reset(m_stmt)); if (!error) { // set input variables do_uses(); m_bReady = true; m_bFirstTime = true; } return error; }
~NameResolverImpl () { check_precondition (m_work.empty()); check_precondition (m_stopped); }
void standard_into_type::do_into() { int colType = sqlite3_column_type(m_st->m_stmt, m_iCol); if (colType == SQLITE_NULL) { // null encountered with no indicator check_precondition (m_ind != nullptr); *m_ind = i_null; } else { if (m_ind) *m_ind = i_ok; switch (colType) { case SQLITE_INTEGER: { sqlite3_int64 v = sqlite3_column_int64(m_st->m_stmt, m_iCol); switch (m_type) { case x_bool: as<bool>(m_data) = v != 0; break; case x_char: integer_into<char>(m_data, v); break; case x_short: integer_into<short>(m_data, v); break; case x_int: integer_into<int>(m_data, v); break; case x_long: integer_into<long>(m_data, v); break; case x_int64: integer_into<int64>(m_data, v); break; case x_uchar: integer_into<unsigned char>(m_data, v); break; case x_ushort: integer_into<unsigned short>(m_data, v); break; case x_uint: integer_into<unsigned int>(m_data, v); break; case x_ulong: integer_into<unsigned long>(m_data, v); break; case x_uint64: integer_into<uint64>(m_data, v); break; case x_beastString: as <String> (m_data) = String(v); break; default: fatal_error ("unknown case"); } } break; case SQLITE_FLOAT: { double v = sqlite3_column_double(m_st->m_stmt, m_iCol); switch (m_type) { case x_float: as<float>(m_data) = static_cast<float>(v); break; case x_double: as<double>(m_data) = v; break; case x_beastString: as <String> (m_data) = String(v); break; default: fatal_error ("unknown case"); }; } break; case SQLITE_TEXT: { switch (m_type) { case x_stdstring: { // excludes terminator int bytes = sqlite3_column_bytes(m_st->m_stmt, m_iCol); unsigned char const* v = sqlite3_column_text(m_st->m_stmt, m_iCol); std::string& result = as<std::string>(m_data); result.assign(reinterpret_cast<char const*>(v), bytes); } break; case x_stdwstring: fatal_error ("invalid case"); break; case x_beastString: { // excludes terminator int bytes = sqlite3_column_bytes(m_st->m_stmt, m_iCol); const CharPointer_UTF8::CharType* c = reinterpret_cast <const CharPointer_UTF8::CharType*> (sqlite3_column_text(m_st->m_stmt, m_iCol)); String& s = as <String> (m_data); s = String(CharPointer_UTF8(c), CharPointer_UTF8(c + bytes)); } break; default: { sqlite3_int64 v = sqlite3_column_int64(m_st->m_stmt, m_iCol); switch (m_type) { case x_bool: as<bool>(m_data) = v != 0; break; case x_char: integer_into<char>(m_data, v); break; case x_short: integer_into<short>(m_data, v); break; case x_int: integer_into<int>(m_data, v); break; case x_long: integer_into<long>(m_data, v); break; case x_int64: integer_into<int64>(m_data, v); break; case x_uchar: integer_into<unsigned char>(m_data, v); break; case x_ushort: integer_into<unsigned short>(m_data, v); break; case x_uint: integer_into<unsigned int>(m_data, v); break; case x_ulong: integer_into<unsigned long>(m_data, v); break; case x_uint64: integer_into<uint64>(m_data, v); break; default: fatal_error ("unknown case"); } } break; }; } break; case SQLITE_BLOB: fatal_error ("invalid case"); default: fatal_error ("unknown case"); }; } convert_from_base(); }