aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/SpecialFunctionHandler.cpp
diff options
context:
space:
mode:
authorDan Liew <delcypher@gmail.com>2014-02-14 14:16:35 +0000
committerDan Liew <delcypher@gmail.com>2014-02-14 14:16:35 +0000
commit2ad968e1c05cfa40c75d0e5ba689beb91ed9d572 (patch)
tree4c5c66a2792379e9c87fcb113d8061cd6408c575 /lib/Core/SpecialFunctionHandler.cpp
parent3c24ce15982948b911bb7910f6ab4481aced8818 (diff)
parentfd0c6614ec5eb93fb00de029a79de4247511d0ef (diff)
downloadklee-2ad968e1c05cfa40c75d0e5ba689beb91ed9d572.tar.gz
Merge pull request #70 from MartinNowack/feature_reading_archive
Add support for archive and single bc file linking
Diffstat (limited to 'lib/Core/SpecialFunctionHandler.cpp')
-rw-r--r--lib/Core/SpecialFunctionHandler.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
index 04f32780..ca9f7b63 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
@@ -38,20 +38,14 @@ using namespace klee;
///
-struct HandlerInfo {
- const char *name;
- SpecialFunctionHandler::Handler handler;
- bool doesNotReturn; /// Intrinsic terminates the process
- bool hasReturnValue; /// Intrinsic has a return value
- bool doNotOverride; /// Intrinsic should not be used if already defined
-};
+
// FIXME: We are more or less committed to requiring an intrinsic
// library these days. We can move some of this stuff there,
// especially things like realloc which have complicated semantics
// w.r.t. forking. Among other things this makes delayed query
// dispatch easier to implement.
-HandlerInfo handlerInfo[] = {
+static SpecialFunctionHandler::HandlerInfo handlerInfo[] = {
#define add(name, handler, ret) { name, \
&SpecialFunctionHandler::handler, \
false, ret, false }
@@ -117,12 +111,37 @@ HandlerInfo handlerInfo[] = {
#undef add
};
+SpecialFunctionHandler::const_iterator SpecialFunctionHandler::begin() {
+ return SpecialFunctionHandler::const_iterator(handlerInfo);
+}
+
+SpecialFunctionHandler::const_iterator SpecialFunctionHandler::end() {
+ // NULL pointer is sentinel
+ return SpecialFunctionHandler::const_iterator(0);
+}
+
+SpecialFunctionHandler::const_iterator& SpecialFunctionHandler::const_iterator::operator++() {
+ ++index;
+ if ( index >= SpecialFunctionHandler::size())
+ {
+ // Out of range, return .end()
+ base=0; // Sentinel
+ index=0;
+ }
+
+ return *this;
+}
+
+int SpecialFunctionHandler::size() {
+ return sizeof(handlerInfo)/sizeof(handlerInfo[0]);
+}
+
SpecialFunctionHandler::SpecialFunctionHandler(Executor &_executor)
: executor(_executor) {}
void SpecialFunctionHandler::prepare() {
- unsigned N = sizeof(handlerInfo)/sizeof(handlerInfo[0]);
+ unsigned N = size();
for (unsigned i=0; i<N; ++i) {
HandlerInfo &hi = handlerInfo[i];
@@ -715,3 +734,5 @@ void SpecialFunctionHandler::handleMarkGlobal(ExecutionState &state,
mo->isGlobal = true;
}
}
+
+