Skip to content

Commit ce11ebb

Browse files
authored
Merge pull request #11518 from ethereum/command-line-parser
CommandLineParser
2 parents 69233c3 + ef7abd2 commit ce11ebb

File tree

9 files changed

+2104
-1189
lines changed

9 files changed

+2104
-1189
lines changed

libsolidity/formal/ModelCheckerSettings.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ struct ModelCheckerContracts
4444
return has(_source) && contracts.at(_source).count(_contract);
4545
}
4646

47+
bool operator!=(ModelCheckerContracts const& _other) const noexcept { return !(*this == _other); }
48+
bool operator==(ModelCheckerContracts const& _other) const noexcept { return contracts == _other.contracts; }
49+
4750
/// Represents which contracts should be analyzed by the SMTChecker
4851
/// as the most derived.
4952
/// The key is the source file. If the map is empty, all sources must be analyzed.
@@ -79,6 +82,9 @@ struct ModelCheckerEngine
7982
return engineMap.at(_engine);
8083
return {};
8184
}
85+
86+
bool operator!=(ModelCheckerEngine const& _other) const noexcept { return !(*this == _other); }
87+
bool operator==(ModelCheckerEngine const& _other) const noexcept { return bmc == _other.bmc && chc == _other.chc; }
8288
};
8389

8490
enum class VerificationTargetType { ConstantCondition, Underflow, Overflow, UnderOverflow, DivByZero, Balance, Assert, PopEmptyArray, OutOfBounds };
@@ -97,6 +103,9 @@ struct ModelCheckerTargets
97103

98104
static std::map<std::string, VerificationTargetType> const targetStrings;
99105

106+
bool operator!=(ModelCheckerTargets const& _other) const noexcept { return !(*this == _other); }
107+
bool operator==(ModelCheckerTargets const& _other) const noexcept { return targets == _other.targets; }
108+
100109
std::set<VerificationTargetType> targets;
101110
};
102111

@@ -106,6 +115,16 @@ struct ModelCheckerSettings
106115
ModelCheckerEngine engine = ModelCheckerEngine::None();
107116
ModelCheckerTargets targets = ModelCheckerTargets::Default();
108117
std::optional<unsigned> timeout;
118+
119+
bool operator!=(ModelCheckerSettings const& _other) const noexcept { return !(*this == _other); }
120+
bool operator==(ModelCheckerSettings const& _other) const noexcept
121+
{
122+
return
123+
contracts == _other.contracts &&
124+
engine == _other.engine &&
125+
targets == _other.targets &&
126+
timeout == _other.timeout;
127+
}
109128
};
110129

111130
}

libsolidity/interface/ImportRemapper.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class ImportRemapper
3535
public:
3636
struct Remapping
3737
{
38+
bool operator!=(Remapping const& _other) const noexcept { return !(*this == _other); }
39+
bool operator==(Remapping const& _other) const noexcept
40+
{
41+
return
42+
context == _other.context &&
43+
prefix == _other.prefix &&
44+
target == _other.target;
45+
}
46+
3847
std::string context;
3948
std::string prefix;
4049
std::string target;

solc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(libsolcli_sources
22
CommandLineInterface.cpp CommandLineInterface.h
3+
CommandLineParser.cpp CommandLineParser.h
34
)
45

56
add_library(solcli ${libsolcli_sources})

0 commit comments

Comments
 (0)