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.
Refactor add_cprover_library to make parts re-usable by the C++ front…
…-end
- Loading branch information
1 parent
0ea6143
commit ed05d3e
Showing
7 changed files
with
39 additions
and
19 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
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 add_cprover_c_library( | ||
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 add_cprover_c_library( | ||
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
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