mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update test/tools/ossfuzz/protoToYul.h
Co-Authored-By: Leonardo <leo@ethereum.org>
This commit is contained in:
parent
62e5ccec90
commit
5113af1df0
@ -372,7 +372,9 @@ void ProtoConverter::scopeVariables(vector<string> const& _varNames)
|
||||
if (forInitScopeExtendVariable)
|
||||
{
|
||||
yulAssert(
|
||||
!m_funcForLoopInitVars.empty() && !m_funcForLoopInitVars.back().empty(), "Proto fuzzer: Invalid operation");
|
||||
!m_funcForLoopInitVars.empty() && !m_funcForLoopInitVars.back().empty(),
|
||||
"Proto fuzzer: Invalid operation"
|
||||
);
|
||||
for (auto const& varName: _varNames)
|
||||
m_funcForLoopInitVars.back().back().push_back(varName);
|
||||
}
|
||||
@ -697,7 +699,7 @@ void ProtoConverter::visit(CopyFunc const& _x)
|
||||
CopyFunc_CopyType type = _x.ct();
|
||||
|
||||
// datacopy() is valid only if we are inside
|
||||
// a yul object.
|
||||
// a Yul object.
|
||||
if (type == CopyFunc::DATA && !m_isObject)
|
||||
return;
|
||||
|
||||
@ -1131,7 +1133,8 @@ void ProtoConverter::visit(ForStmt const& _x)
|
||||
{
|
||||
yulAssert(
|
||||
!m_funcForLoopInitVars.empty() && !m_funcForLoopInitVars.back().empty(),
|
||||
"Proto fuzzer: Invalid data structure");
|
||||
"Proto fuzzer: Invalid data structure"
|
||||
);
|
||||
// Remove variables in for-init
|
||||
m_funcForLoopInitVars.back().pop_back();
|
||||
}
|
||||
@ -1647,7 +1650,7 @@ void ProtoConverter::fillFunctionCallInput(unsigned _numInParams)
|
||||
{
|
||||
// Throw a 4-sided dice to choose whether to populate function input
|
||||
// argument from a pseudo-randomly chosen slot in one of the following
|
||||
// locations: calldata, memory, storage, or yul optimizer dictionary.
|
||||
// locations: calldata, memory, storage, or Yul optimizer dictionary.
|
||||
unsigned diceValue = counter() % 4;
|
||||
// Pseudo-randomly choose one of the first ten 32-byte
|
||||
// aligned slots.
|
||||
@ -1878,7 +1881,7 @@ void ProtoConverter::visit(Program const& _x)
|
||||
// Record EVM Version
|
||||
m_evmVersion = evmVersionMapping(_x.ver());
|
||||
|
||||
// Program is either a yul object or a block of
|
||||
// Program is either a Yul object or a block of
|
||||
// statements.
|
||||
switch (_x.program_oneof_case())
|
||||
{
|
||||
@ -1895,7 +1898,7 @@ void ProtoConverter::visit(Program const& _x)
|
||||
visit(_x.obj());
|
||||
break;
|
||||
case Program::PROGRAM_ONEOF_NOT_SET:
|
||||
// {} is a trivial yul program
|
||||
// {} is a trivial Yul program
|
||||
m_output << "{}";
|
||||
break;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
void visit(BinaryOp const&);
|
||||
|
||||
/// Visits a basic block optionally adding @a _funcParams to scope.
|
||||
/// @param _block Reference to a basic block of yul statements.
|
||||
/// @param _block Reference to a basic block of Yul statements.
|
||||
/// @param _funcParams List of function parameter names, defaults to
|
||||
/// an empty vector.
|
||||
void visit(Block const& _block);
|
||||
@ -197,7 +197,7 @@ private:
|
||||
/// false otherwise
|
||||
bool functionValid(FunctionCall_Returns _type, unsigned _numOutParams);
|
||||
|
||||
/// Converts protobuf function call to a yul function call and appends
|
||||
/// Converts protobuf function call to a Yul function call and appends
|
||||
/// it to output stream.
|
||||
/// @param _x Protobuf function call
|
||||
/// @param _name Function name
|
||||
@ -211,7 +211,7 @@ private:
|
||||
bool _newLine = true
|
||||
);
|
||||
|
||||
/// Prints a yul formatted variable declaration statement to the output
|
||||
/// Prints a Yul formatted variable declaration statement to the output
|
||||
/// stream.
|
||||
/// Example 1: createVarDecls(0, 1, true) returns {"x_0"} and prints
|
||||
/// let x_0 :=
|
||||
@ -236,26 +236,26 @@ private:
|
||||
/// @return A vector of strings containing the printed variable names.
|
||||
std::vector<std::string> createVars(unsigned _startIdx, unsigned _endIdx);
|
||||
|
||||
/// Manages scope of yul variables
|
||||
/// @param _varNames is a list of yul variable names whose scope needs
|
||||
/// to be tracked according to yul scoping rules.
|
||||
/// Manages scope of Yul variables
|
||||
/// @param _varNames is a list of Yul variable names whose scope needs
|
||||
/// to be tracked according to Yul scoping rules.
|
||||
void scopeVariables(std::vector<std::string> const& _varNames);
|
||||
|
||||
/// Print the yul syntax to make a call to a function named @a _funcName to
|
||||
/// Print the Yul syntax to make a call to a function named @a _funcName to
|
||||
/// the output stream.
|
||||
/// @param _funcName Name of the function to be called
|
||||
/// @param _numInParams Number of input parameters in function signature
|
||||
/// @param _numOutParams Number of output parameters in function signature
|
||||
void createFunctionCall(std::string _funcName, unsigned _numInParams, unsigned _numOutParams);
|
||||
|
||||
/// Print the yul syntax to pass input arguments to a function that has
|
||||
/// Print the Yul syntax to pass input arguments to a function that has
|
||||
/// @a _numInParams number of input parameters to the output stream.
|
||||
/// The input arguments are pseudo-randomly chosen from calldata, memory,
|
||||
/// storage, or the yul optimizer hex dictionary.
|
||||
/// storage, or the Yul optimizer hex dictionary.
|
||||
/// @param _numInParams Number of input arguments to fill
|
||||
void fillFunctionCallInput(unsigned _numInParams);
|
||||
|
||||
/// Print the yul syntax to save values returned by a function call
|
||||
/// Print the Yul syntax to save values returned by a function call
|
||||
/// to the output stream. The values are either stored to memory or
|
||||
/// storage based on a simulated coin flip. The saved location is
|
||||
/// decided pseudo-randomly.
|
||||
@ -272,7 +272,7 @@ private:
|
||||
|
||||
/// Build a tree of objects that contains the object/data
|
||||
/// identifiers that are in scope in a given object.
|
||||
/// @param _x root object of the yul protobuf specification.
|
||||
/// @param _x root object of the Yul protobuf specification.
|
||||
void buildObjectScopeTree(Object const& _x);
|
||||
|
||||
/// Returns a pseudo-random dictionary token.
|
||||
|
Loading…
Reference in New Issue
Block a user