Introduce unchecked basic blocks.

This commit is contained in:
Bhargava Shastry 2021-05-03 10:12:29 +02:00
parent 86fec73a8c
commit fdb1bc0b3d
2 changed files with 4 additions and 1 deletions

View File

@ -303,7 +303,9 @@ string BlockStmtGenerator::visit()
return "\n";
incrementNestingDepth();
ostringstream block;
block << indentation() + "{\n";
// Make block unchecked with a small probability
bool unchecked = uRandDist->probable(s_uncheckedInvProb);
block << indentation() + (unchecked ? "unchecked " : "") + "{\n";
state->indent();
block << visitChildren();
state->unindent();

View File

@ -876,6 +876,7 @@ private:
size_t m_nestingDepth;
static constexpr unsigned s_maxStatements = 4;
static constexpr unsigned s_maxNestingDepth = 3;
static constexpr size_t s_uncheckedInvProb = 13;
};
class SolidityGenerator: public std::enable_shared_from_this<SolidityGenerator>