diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-05-25 15:37:03 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-05-25 15:37:03 +0000 |
commit | 958e9f99e3837ea018f18799c0055d8dc8075c4d (patch) | |
tree | 174c85de58ce112bf69ce21e5f24d85a1cb71468 /lib/Core/Executor.cpp | |
parent | 243a217c15fdbf920f91fabfae460f957b25e0ec (diff) | |
download | klee-958e9f99e3837ea018f18799c0055d8dc8075c4d.tar.gz |
Name symbolic arrays using the 3rd argument to klee_make_symbolic,
and make sure the name is unique. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@132054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/Executor.cpp')
-rw-r--r-- | lib/Core/Executor.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 0dbaab80..1826a4d6 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -3066,12 +3066,18 @@ void Executor::executeMemoryOperation(ExecutionState &state, } void Executor::executeMakeSymbolic(ExecutionState &state, - const MemoryObject *mo) { + const MemoryObject *mo, + const std::string &name) { // Create a new object state for the memory object (instead of a copy). if (!replayOut) { - static unsigned id = 0; - const Array *array = new Array("arr" + llvm::utostr(++id), - mo->size); + // Find a unique name for this array. First try the original name, + // or if that fails try adding a unique identifier. + unsigned id = 0; + std::string uniqueName = name; + while (!state.arrayNames.insert(uniqueName).second) { + uniqueName = name + "_" + llvm::utostr(++id); + } + const Array *array = new Array(uniqueName, mo->size); bindObjectInState(state, mo, false, array); state.addSymbolic(mo, array); |