aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/SpecialFunctionHandler.h
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-01-29 16:50:52 +0000
committerMartin Nowack <martin@se.inf.tu-dresden.de>2014-02-06 23:55:29 +0100
commitebaad172d4aab5fbaeca8c2658aaa94fc2e9b08e (patch)
treeb4f81977ede05119b41881787e5b0476dae04cb9 /lib/Core/SpecialFunctionHandler.h
parentd3202c9705ebd840051574956c04d12322c8afe6 (diff)
downloadklee-ebaad172d4aab5fbaeca8c2658aaa94fc2e9b08e.tar.gz
Implement const_iterator interface for SpecialFunctionHandler so
that clients can access HandlerInfo nicely.
Diffstat (limited to 'lib/Core/SpecialFunctionHandler.h')
-rw-r--r--lib/Core/SpecialFunctionHandler.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Core/SpecialFunctionHandler.h b/lib/Core/SpecialFunctionHandler.h
index 02e70ed4..f68c6edb 100644
--- a/lib/Core/SpecialFunctionHandler.h
+++ b/lib/Core/SpecialFunctionHandler.h
@@ -10,6 +10,7 @@
#ifndef KLEE_SPECIALFUNCTIONHANDLER_H
#define KLEE_SPECIALFUNCTIONHANDLER_H
+#include <iterator>
#include <map>
#include <vector>
#include <string>
@@ -37,6 +38,38 @@ namespace klee {
handlers_ty handlers;
class Executor &executor;
+ 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
+ };
+
+ // const_iterator to iterate over stored HandlerInfo
+ // FIXME: Implement >, >=, <=, < operators
+ class const_iterator : public std::iterator<std::random_access_iterator_tag, HandlerInfo>
+ {
+ private:
+ value_type* base;
+ int index;
+ public:
+ const_iterator(value_type* hi) : base(hi), index(0) {};
+ const_iterator& operator++(); // pre-fix
+ const_iterator operator++(int); // post-fix
+ const value_type& operator*() { return base[index];}
+ const value_type* operator->() { return &(base[index]);}
+ const value_type& operator[](int i) { return base[i];}
+ bool operator==(const_iterator& rhs) { return (rhs.base + rhs.index) == (this->base + this->index);}
+ bool operator!=(const_iterator& rhs) { return !(*this == rhs);}
+ };
+
+ static const_iterator begin();
+ static const_iterator end();
+ static int size();
+
+
+
public:
SpecialFunctionHandler(Executor &_executor);