Add Scanner function that prints source based on SourceLocation

This commit is contained in:
Leonardo Alt
2018-11-13 13:49:29 +01:00
parent 82fadfd1a7
commit 9a4fd946c3
4 changed files with 15 additions and 3 deletions
+3 -1
View File
@@ -37,9 +37,10 @@ SMTChecker::SMTChecker(ErrorReporter& _errorReporter, ReadCallback::Callback con
{
}
void SMTChecker::analyze(SourceUnit const& _source)
void SMTChecker::analyze(SourceUnit const& _source, shared_ptr<Scanner> const& _scanner)
{
m_variableUsage = make_shared<VariableUsage>(_source);
m_scanner = _scanner;
if (_source.annotation().experimentalFeatures.count(ExperimentalFeature::SMTChecker))
_source.accept(*this);
}
@@ -753,6 +754,7 @@ void SMTChecker::checkCondition(
vector<string> expressionNames;
if (m_functionPath.size())
{
solAssert(m_scanner, "");
if (_additionalValue)
{
expressionsToEvaluate.emplace_back(*_additionalValue);
+4 -1
View File
@@ -25,6 +25,8 @@
#include <libsolidity/interface/ReadFile.h>
#include <libsolidity/parsing/Scanner.h>
#include <unordered_map>
#include <string>
#include <vector>
@@ -42,7 +44,7 @@ class SMTChecker: private ASTConstVisitor
public:
SMTChecker(ErrorReporter& _errorReporter, ReadCallback::Callback const& _readCallback);
void analyze(SourceUnit const& _sources);
void analyze(SourceUnit const& _sources, std::shared_ptr<Scanner> const& _scanner);
private:
// TODO: Check that we do not have concurrent reads and writes to a variable,
@@ -193,6 +195,7 @@ private:
std::unordered_map<std::string, std::shared_ptr<SymbolicVariable>> m_specialVariables;
std::vector<smt::Expression> m_pathConditions;
ErrorReporter& m_errorReporter;
std::shared_ptr<Scanner> m_scanner;
/// Stores the current path of function calls.
std::vector<FunctionDefinition const*> m_functionPath;