Skip to content

Commit

Permalink
Add Yul CFG export tests
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Oct 16, 2024
1 parent 78ecc7c commit 6dd31bb
Show file tree
Hide file tree
Showing 9 changed files with 8,400 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/cmdlineTests/standard_yul_cfg_json_export/in.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;

interface I {
function f() external pure returns (uint);
}

contract C is I {
function f() public pure override returns (uint) {
return 42;
}
}

contract D {
function f() public returns (uint) {
C c = new C();
return c.f();
}
}
13 changes: 13 additions & 0 deletions test/cmdlineTests/standard_yul_cfg_json_export/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_yul_cfg_json_export/in.sol"]}
},
"settings": {
"optimizer": {
"enabled": true
},
"viaIR": true,
"outputSelection": {"*": {"*": ["yulCFGJson"]}}
}
}
3,969 changes: 3,969 additions & 0 deletions test/cmdlineTests/standard_yul_cfg_json_export/output.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_yul_cfg_json_export/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--strict-assembly --optimize --yul-cfg-json --pretty-json --json-indent 4
36 changes: 36 additions & 0 deletions test/cmdlineTests/strict_asm_yul_cfg_json_export/input.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// @use-src 0:"input.sol"
object "C_19" {
code {
{
/// @src 0:124:223 "contract C is I {..."
let _1 := memoryguard(0x80)
mstore(64, _1)
if callvalue() { revert(0, 0) }
let _2 := datasize("C_19_deployed")
codecopy(_1, dataoffset("C_19_deployed"), _2)
return(_1, _2)
}
}
/// @use-src 0:"input.sol"
object "C_19_deployed" {
code {
{
/// @src 0:124:223 "contract C is I {..."
let _1 := memoryguard(0x80)
mstore(64, _1)
if iszero(lt(calldatasize(), 4))
{
if eq(0x26121ff0, shr(224, calldataload(0)))
{
if callvalue() { revert(0, 0) }
if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) }
mstore(_1, /** @src 0:212:214 "42" */ 0x2a)
/// @src 0:124:223 "contract C is I {..."
return(_1, 32)
}
}
revert(0, 0)
}
}
}
}
Loading

0 comments on commit 6dd31bb

Please sign in to comment.