Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endif

# Select optimisation or debug info
#CXXFLAGS += -O2 -DNDEBUG
#CXXFLAGS += -O0 -g
#CXXFLAGS += -O0 -g -DPRETTYPRINT

# If GLPK is available; this is used by goto-instrument and musketeer.
#LIB_GLPK = -lglpk
Expand Down
15 changes: 14 additions & 1 deletion src/util/string_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,21 @@ unsigned string_containert::get(const std::string &s)
return r;
}

const std::string &
NOINLINE_WHEN_GCC_AND_DEBUG() string_containert::get_string_slowly(
size_t no) const
{
return *string_vector[no];
}

bool NOINLINE_WHEN_GCC_AND_DEBUG() string_containert::is_number_valid(
const size_t no) const
{
return no < string_vector.size() && string_vector.at(no) != nullptr;
}

/// Get a reference to the global string container.
string_containert &get_string_container()
string_containert & NOINLINE_WHEN_GCC_AND_DEBUG() get_string_container()
{
static string_containert ret;
return ret;
Expand Down
13 changes: 12 additions & 1 deletion src/util/string_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Author: Daniel Kroening, [email protected]

#include "string_hash.h"

#if defined(__GNUC__) && defined(PRETTYPRINT)
#define NOINLINE_WHEN_GCC_AND_DEBUG() __attribute__ ((noinline, used))
#else
#define NOINLINE_WHEN_GCC_AND_DEBUG()
#endif

struct string_ptrt
{
const char *s;
Expand Down Expand Up @@ -73,6 +79,11 @@ class string_containert
return *string_vector[no];
}

const std::string &
NOINLINE_WHEN_GCC_AND_DEBUG() get_string_slowly(size_t no) const;

bool NOINLINE_WHEN_GCC_AND_DEBUG() is_number_valid(const size_t no) const;

protected:
// the 'unsigned' ought to be size_t
typedef std::unordered_map<string_ptrt, unsigned, string_ptr_hash>
Expand All @@ -89,6 +100,6 @@ class string_containert
string_vectort string_vector;
};

string_containert &get_string_container();
string_containert & NOINLINE_WHEN_GCC_AND_DEBUG() get_string_container();

#endif // CPROVER_UTIL_STRING_CONTAINER_H