@@ -32,6 +32,7 @@ class BasicBlock;
3232class Function ;
3333class LLVMContext ;
3434class Module ;
35+ class Type ;
3536class raw_ostream ;
3637class raw_fd_ostream ;
3738} // namespace llvm
@@ -61,6 +62,13 @@ class InterpreterHandler {
6162 const char *suffix, bool isError = false ) = 0;
6263};
6364
65+ enum class MockStrategy {
66+ None, // No mocks are generated
67+ Naive, // For each function call new symbolic value is generated
68+ Deterministic, // Each function is treated as uninterpreted function in SMT.
69+ // Compatible with Z3 solver only
70+ };
71+
6472class Interpreter {
6573public:
6674 enum class GuidanceKind {
@@ -77,6 +85,8 @@ class Interpreter {
7785 std::string LibraryDir;
7886 std::string EntryPoint;
7987 std::string OptSuffix;
88+ std::string MainCurrentName;
89+ std::string MainNameAfterMock;
8090 bool Optimize;
8191 bool Simplify;
8292 bool CheckDivZero;
@@ -86,13 +96,16 @@ class Interpreter {
8696
8797 ModuleOptions (const std::string &_LibraryDir,
8898 const std::string &_EntryPoint, const std::string &_OptSuffix,
89- bool _Optimize, bool _Simplify, bool _CheckDivZero,
90- bool _CheckOvershift, bool _WithFPRuntime,
91- bool _WithPOSIXRuntime)
99+ const std::string &_MainCurrentName,
100+ const std::string &_MainNameAfterMock, bool _Optimize,
101+ bool _Simplify, bool _CheckDivZero, bool _CheckOvershift,
102+ bool _WithFPRuntime, bool _WithPOSIXRuntime)
92103 : LibraryDir(_LibraryDir), EntryPoint(_EntryPoint),
93- OptSuffix (_OptSuffix), Optimize(_Optimize), Simplify(_Simplify),
94- CheckDivZero(_CheckDivZero), CheckOvershift(_CheckOvershift),
95- WithFPRuntime(_WithFPRuntime), WithPOSIXRuntime(_WithPOSIXRuntime) {}
104+ OptSuffix (_OptSuffix), MainCurrentName(_MainCurrentName),
105+ MainNameAfterMock(_MainNameAfterMock), Optimize(_Optimize),
106+ Simplify(_Simplify), CheckDivZero(_CheckDivZero),
107+ CheckOvershift(_CheckOvershift), WithFPRuntime(_WithFPRuntime),
108+ WithPOSIXRuntime(_WithPOSIXRuntime) {}
96109 };
97110
98111 enum LogType {
@@ -110,10 +123,11 @@ class Interpreter {
110123 unsigned MakeConcreteSymbolic;
111124 GuidanceKind Guidance;
112125 nonstd::optional<SarifReport> Paths;
126+ enum MockStrategy MockStrategy;
113127
114128 InterpreterOptions (nonstd::optional<SarifReport> Paths)
115129 : MakeConcreteSymbolic(false ), Guidance(GuidanceKind::NoGuidance),
116- Paths (std::move(Paths)) {}
130+ Paths (std::move(Paths)), MockStrategy(MockStrategy::None) {}
117131 };
118132
119133protected:
@@ -142,7 +156,11 @@ class Interpreter {
142156 const ModuleOptions &opts,
143157 const std::unordered_set<std::string> &mainModuleFunctions,
144158 const std::unordered_set<std::string> &mainModuleGlobals,
145- std::unique_ptr<InstructionInfoTable> origInfos) = 0 ;
159+ std::unique_ptr<InstructionInfoTable> origInfos,
160+ const std::set<std::string> &ignoredExternals) = 0 ;
161+
162+ virtual std::map<std::string, llvm::Type *>
163+ getAllExternals (const std::set<std::string> &ignoredExternals) = 0 ;
146164
147165 // supply a tree stream writer which the interpreter will use
148166 // to record the concrete path (as a stream of '0' and '1' bytes).
0 commit comments