forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffblue#2294 from tautschnig/c++-built-ins
C++ front-end: Use C factory for compiler builtins
- Loading branch information
Showing
28 changed files
with
395 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-programs/goto_convert_functions.h> | ||
#include <goto-programs/goto_inline.h> | ||
#include <goto-programs/initialize_goto_model.h> | ||
#include <goto-programs/link_to_library.h> | ||
#include <goto-programs/read_goto_binary.h> | ||
#include <goto-programs/remove_complex.h> | ||
#include <goto-programs/remove_function_pointers.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "ansi_c_language.h" | ||
|
||
struct cprover_library_entryt | ||
{ | ||
const char *function; | ||
const char *model; | ||
} cprover_library[]= | ||
#include "cprover_library.inc" | ||
; // NOLINT(whitespace/semicolon) | ||
|
||
std::string get_cprover_library_text( | ||
static std::string get_cprover_library_text( | ||
const std::set<irep_idt> &functions, | ||
const symbol_tablet &symbol_table) | ||
{ | ||
|
@@ -35,10 +27,29 @@ std::string get_cprover_library_text( | |
if(config.ansi_c.string_abstraction) | ||
library_text << "#define __CPROVER_STRING_ABSTRACTION\n"; | ||
|
||
// cprover_library.inc may not have been generated when running Doxygen, thus | ||
// make Doxygen skip this part | ||
/// \cond | ||
const struct cprover_library_entryt cprover_library[] = | ||
#include "cprover_library.inc" | ||
; // NOLINT(whitespace/semicolon) | ||
/// \endcond | ||
|
||
return get_cprover_library_text( | ||
functions, symbol_table, cprover_library, library_text.str()); | ||
} | ||
|
||
std::string get_cprover_library_text( | ||
const std::set<irep_idt> &functions, | ||
const symbol_tablet &symbol_table, | ||
const struct cprover_library_entryt cprover_library[], | ||
const std::string &prologue) | ||
{ | ||
std::ostringstream library_text(prologue); | ||
|
||
std::size_t count=0; | ||
|
||
for(cprover_library_entryt *e=cprover_library; | ||
e->function!=nullptr; | ||
for(const cprover_library_entryt *e = cprover_library; e->function != nullptr; | ||
e++) | ||
{ | ||
irep_idt id=e->function; | ||
|
@@ -63,7 +74,7 @@ std::string get_cprover_library_text( | |
return library_text.str(); | ||
} | ||
|
||
void add_cprover_library( | ||
void cprover_c_library_factory( | ||
const std::set<irep_idt> &functions, | ||
symbol_tablet &symbol_table, | ||
message_handlert &message_handler) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,24 @@ Author: Daniel Kroening, [email protected] | |
#include <util/symbol_table.h> | ||
#include <util/message.h> | ||
|
||
struct cprover_library_entryt | ||
{ | ||
const char *function; | ||
const char *model; | ||
}; | ||
|
||
std::string get_cprover_library_text( | ||
const std::set<irep_idt> &functions, | ||
const symbol_tablet &); | ||
const symbol_tablet &, | ||
const struct cprover_library_entryt[], | ||
const std::string &prologue); | ||
|
||
void add_library( | ||
const std::string &src, | ||
symbol_tablet &, | ||
message_handlert &); | ||
|
||
void add_cprover_library( | ||
void cprover_c_library_factory( | ||
const std::set<irep_idt> &functions, | ||
symbol_tablet &, | ||
message_handlert &); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ Author: Daniel Kroening, [email protected] | |
#include <langapi/language.h> | ||
|
||
#include <ansi-c/c_preprocess.h> | ||
#include <ansi-c/cprover_library.h> | ||
|
||
#include <cpp/cprover_library.h> | ||
|
||
#include <goto-programs/adjust_float_expressions.h> | ||
#include <goto-programs/initialize_goto_model.h> | ||
|
@@ -711,7 +714,12 @@ bool cbmc_parse_optionst::process_goto_program( | |
remove_asm(goto_model); | ||
|
||
// add the library | ||
link_to_library(goto_model, log.get_message_handler()); | ||
log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")" | ||
<< eom; | ||
link_to_library( | ||
goto_model, log.get_message_handler(), cprover_cpp_library_factory); | ||
link_to_library( | ||
goto_model, log.get_message_handler(), cprover_c_library_factory); | ||
|
||
if(options.get_bool_option("string-abstraction")) | ||
string_instrumentation(goto_model, log.get_message_handler()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-programs/set_properties.h> | ||
#include <goto-programs/read_goto_binary.h> | ||
#include <goto-programs/loop_ids.h> | ||
#include <goto-programs/link_to_library.h> | ||
#include <goto-programs/goto_inline.h> | ||
#include <goto-programs/xml_goto_trace.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.