mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add CLI option to choose model checker engine
This commit is contained in:
@@ -146,6 +146,7 @@ static string const g_strMachine = "machine";
|
||||
static string const g_strMetadata = "metadata";
|
||||
static string const g_strMetadataHash = "metadata-hash";
|
||||
static string const g_strMetadataLiteral = "metadata-literal";
|
||||
static string const g_strModelCheckerEngine = "model-checker-engine";
|
||||
static string const g_strNatspecDev = "devdoc";
|
||||
static string const g_strNatspecUser = "userdoc";
|
||||
static string const g_strNone = "none";
|
||||
@@ -215,6 +216,7 @@ static string const g_argMachine = g_strMachine;
|
||||
static string const g_argMetadata = g_strMetadata;
|
||||
static string const g_argMetadataHash = g_strMetadataHash;
|
||||
static string const g_argMetadataLiteral = g_strMetadataLiteral;
|
||||
static string const g_argModelCheckerEngine = g_strModelCheckerEngine;
|
||||
static string const g_argNatspecDev = g_strNatspecDev;
|
||||
static string const g_argNatspecUser = g_strNatspecUser;
|
||||
static string const g_argOpcodes = g_strOpcodes;
|
||||
@@ -993,6 +995,16 @@ General Information)").c_str(),
|
||||
;
|
||||
desc.add(optimizerOptions);
|
||||
|
||||
po::options_description smtCheckerOptions("Model Checker Options");
|
||||
smtCheckerOptions.add_options()
|
||||
(
|
||||
g_strModelCheckerEngine.c_str(),
|
||||
po::value<string>()->value_name("all,bmc,chc,none")->default_value("all"),
|
||||
"Select model checker engine."
|
||||
)
|
||||
;
|
||||
desc.add(smtCheckerOptions);
|
||||
|
||||
po::options_description allOptions = desc;
|
||||
allOptions.add_options()(g_argInputFile.c_str(), po::value<vector<string>>(), "input file");
|
||||
|
||||
@@ -1379,6 +1391,18 @@ bool CommandLineInterface::processInput()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_args.count(g_argModelCheckerEngine))
|
||||
{
|
||||
string engineStr = m_args[g_argModelCheckerEngine].as<string>();
|
||||
optional<ModelCheckerEngine> engine = ModelCheckerEngine::fromString(engineStr);
|
||||
if (!engine)
|
||||
{
|
||||
serr() << "Invalid option for --" << g_argModelCheckerEngine << ": " << engineStr << endl;
|
||||
return false;
|
||||
}
|
||||
m_modelCheckerEngine = *engine;
|
||||
}
|
||||
|
||||
m_compiler = make_unique<CompilerStack>(fileReader);
|
||||
|
||||
unique_ptr<SourceReferenceFormatter> formatter;
|
||||
@@ -1393,6 +1417,8 @@ bool CommandLineInterface::processInput()
|
||||
m_compiler->useMetadataLiteralSources(true);
|
||||
if (m_args.count(g_argMetadataHash))
|
||||
m_compiler->setMetadataHash(m_metadataHash);
|
||||
if (m_args.count(g_argModelCheckerEngine))
|
||||
m_compiler->setModelCheckerEngine(m_modelCheckerEngine);
|
||||
if (m_args.count(g_argInputFile))
|
||||
m_compiler->setRemappings(m_remappings);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user