mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11520 from ethereum/local-streams-in-command-line-parser
Local output streams in CommandLineParser
This commit is contained in:
+11
-29
@@ -34,24 +34,16 @@ namespace po = boost::program_options;
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
static bool g_hasOutput = false;
|
||||
|
||||
namespace
|
||||
ostream& CommandLineParser::sout()
|
||||
{
|
||||
|
||||
std::ostream& sout()
|
||||
{
|
||||
g_hasOutput = true;
|
||||
return cout;
|
||||
m_hasOutput = true;
|
||||
return m_sout;
|
||||
}
|
||||
|
||||
std::ostream& serr(bool _used = true)
|
||||
ostream& CommandLineParser::serr()
|
||||
{
|
||||
if (_used)
|
||||
g_hasOutput = true;
|
||||
return cerr;
|
||||
}
|
||||
|
||||
m_hasOutput = true;
|
||||
return m_serr;
|
||||
}
|
||||
|
||||
#define cout
|
||||
@@ -185,8 +177,7 @@ static set<string> const g_metadataHashArgs
|
||||
g_strNone
|
||||
};
|
||||
|
||||
[[noreturn]]
|
||||
static void printVersionAndExit()
|
||||
void CommandLineParser::printVersionAndExit()
|
||||
{
|
||||
sout() <<
|
||||
"solc, the solidity compiler commandline interface" <<
|
||||
@@ -197,8 +188,7 @@ static void printVersionAndExit()
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
[[noreturn]]
|
||||
static void printLicenseAndExit()
|
||||
void CommandLineParser::printLicenseAndExit()
|
||||
{
|
||||
sout() << otherLicenses << endl;
|
||||
// This is a static variable generated by cmake from LICENSE.txt
|
||||
@@ -206,10 +196,8 @@ static void printLicenseAndExit()
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
bool checkMutuallyExclusive(boost::program_options::variables_map const& args, std::string const& _optionA, std::string const& _optionB)
|
||||
bool CommandLineParser::checkMutuallyExclusive(boost::program_options::variables_map const& args, string const& _optionA, string const& _optionB)
|
||||
{
|
||||
if (args.count(_optionA) && args.count(_optionB))
|
||||
{
|
||||
@@ -220,8 +208,6 @@ bool checkMutuallyExclusive(boost::program_options::variables_map const& args, s
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CompilerOutputs::operator==(CompilerOutputs const& _other) const noexcept
|
||||
{
|
||||
static_assert(
|
||||
@@ -441,7 +427,7 @@ bool CommandLineParser::parseLibraryOption(string const& _input)
|
||||
|
||||
bool CommandLineParser::parse(int _argc, char const* const* _argv, bool interactiveTerminal)
|
||||
{
|
||||
g_hasOutput = false;
|
||||
m_hasOutput = false;
|
||||
|
||||
// Declare the supported options.
|
||||
po::options_description desc((R"(solc, the Solidity commandline compiler.
|
||||
@@ -1136,11 +1122,6 @@ General Information)").c_str(),
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandLineParser::hasOutput()
|
||||
{
|
||||
return g_hasOutput;
|
||||
}
|
||||
|
||||
bool CommandLineParser::parseCombinedJsonOption()
|
||||
{
|
||||
if (!m_args.count(g_strCombinedJson))
|
||||
@@ -1192,4 +1173,5 @@ string CommandLineParser::joinOptionNames(vector<string> const& _optionNames, st
|
||||
_separator
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace solidity::frontend
|
||||
|
||||
Reference in New Issue
Block a user