Skip to content

Add reset_temporary_counter to fresh_symbol #1423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/util/fresh_symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Author: Chris Smowton, [email protected]

#include "fresh_symbol.h"

// This needs to be outside get_fresh_aux_symbol
// to make it available for both reset_temporary_counter
// and get_fresh_aux_symbol
static size_t temporary_counter=0;

// This is useful with loading multiple GOTO models
void reset_temporary_counter()
{
temporary_counter=0;
}

/// Installs a fresh-named symbol with the requested name pattern
/// \par parameters: `type`: type of new symbol
/// `name_prefix`, `basename_prefix`: new symbol will be named
Expand All @@ -27,7 +38,6 @@ symbolt &get_fresh_aux_symbol(
const irep_idt &symbol_mode,
symbol_tablet &symbol_table)
{
static size_t temporary_counter=0;
auxiliary_symbolt new_symbol;
symbolt *symbol_ptr;

Expand Down
2 changes: 2 additions & 0 deletions src/util/fresh_symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Author: Chris Smowton, [email protected]
#include <util/symbol_table.h>
#include <util/type.h>

void reset_temporary_counter();

symbolt &get_fresh_aux_symbol(
const typet &type,
const std::string &name_prefix,
Expand Down