diff options
author | chriseth <chris@ethereum.org> | 2018-12-03 22:48:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 22:48:03 +0800 |
commit | c8a2cb62832afb2dc09ccee6fd42c1516dfdb981 (patch) | |
tree | 7977e9dcbbc215088c05b847f849871ef5d4ae66 /solc | |
parent | 1d4f565a64988a3400847d2655ca24f73f234bc6 (diff) | |
parent | 590be1d84cea9850ce69b68be3dc5294b39041e5 (diff) | |
download | dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar.gz dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar.bz2 dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar.lz dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar.xz dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.tar.zst dexon-solidity-c8a2cb62832afb2dc09ccee6fd42c1516dfdb981.zip |
Merge pull request #5571 from ethereum/develop
Version 0.5.1
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 247 | ||||
-rw-r--r-- | solc/CommandLineInterface.h | 4 |
2 files changed, 154 insertions, 97 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 844cef90..38e778c6 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -26,15 +26,15 @@ #include "license.h" #include <libsolidity/interface/Version.h> -#include <libsolidity/parsing/Scanner.h> +#include <liblangutil/Scanner.h> #include <libsolidity/parsing/Parser.h> #include <libsolidity/ast/ASTPrinter.h> #include <libsolidity/ast/ASTJsonConverter.h> #include <libsolidity/analysis/NameAndTypeResolver.h> -#include <libsolidity/interface/Exceptions.h> +#include <liblangutil/Exceptions.h> #include <libsolidity/interface/CompilerStack.h> #include <libsolidity/interface/StandardCompiler.h> -#include <libsolidity/interface/SourceReferenceFormatter.h> +#include <liblangutil/SourceReferenceFormatter.h> #include <libsolidity/interface/GasEstimator.h> #include <libsolidity/interface/AssemblyStack.h> @@ -62,6 +62,7 @@ #include <fstream> using namespace std; +using namespace langutil; namespace po = boost::program_options; namespace dev @@ -69,6 +70,24 @@ namespace dev namespace solidity { +bool g_hasOutput = false; + +std::ostream& sout() +{ + g_hasOutput = true; + return cout; +} + +std::ostream& serr(bool _used = true) +{ + if (_used) + g_hasOutput = true; + return cerr; +} + +#define cout +#define cerr + static string const g_stdinFileNameStr = "<stdin>"; static string const g_strAbi = "abi"; static string const g_strAllowPaths = "allow-paths"; @@ -180,7 +199,7 @@ static set<string> const g_machineArgs static void version() { - cout << + sout() << "solc, the solidity compiler commandline interface" << endl << "Version: " << @@ -191,9 +210,9 @@ static void version() static void license() { - cout << otherLicenses << endl; + sout() << otherLicenses << endl; // This is a static variable generated by cmake from LICENSE.txt - cout << licenseText << endl; + sout() << licenseText << endl; exit(0); } @@ -229,8 +248,8 @@ void CommandLineInterface::handleBinary(string const& _contract) createFile(m_compiler->filesystemFriendlyName(_contract) + ".bin", objectWithLinkRefsHex(m_compiler->object(_contract))); else { - cout << "Binary: " << endl; - cout << objectWithLinkRefsHex(m_compiler->object(_contract)) << endl; + sout() << "Binary: " << endl; + sout() << objectWithLinkRefsHex(m_compiler->object(_contract)) << endl; } } if (m_args.count(g_argBinaryRuntime)) @@ -239,8 +258,8 @@ void CommandLineInterface::handleBinary(string const& _contract) createFile(m_compiler->filesystemFriendlyName(_contract) + ".bin-runtime", objectWithLinkRefsHex(m_compiler->runtimeObject(_contract))); else { - cout << "Binary of the runtime part: " << endl; - cout << objectWithLinkRefsHex(m_compiler->runtimeObject(_contract)) << endl; + sout() << "Binary of the runtime part: " << endl; + sout() << objectWithLinkRefsHex(m_compiler->runtimeObject(_contract)) << endl; } } } @@ -251,9 +270,9 @@ void CommandLineInterface::handleOpcode(string const& _contract) createFile(m_compiler->filesystemFriendlyName(_contract) + ".opcode", solidity::disassemble(m_compiler->object(_contract).bytecode)); else { - cout << "Opcodes: " << endl; - cout << solidity::disassemble(m_compiler->object(_contract).bytecode); - cout << endl; + sout() << "Opcodes: " << endl; + sout() << solidity::disassemble(m_compiler->object(_contract).bytecode); + sout() << endl; } } @@ -278,7 +297,7 @@ void CommandLineInterface::handleSignatureHashes(string const& _contract) if (m_args.count(g_argOutputDir)) createFile(m_compiler->filesystemFriendlyName(_contract) + ".signatures", out); else - cout << "Function signatures: " << endl << out; + sout() << "Function signatures: " << endl << out; } void CommandLineInterface::handleMetadata(string const& _contract) @@ -290,7 +309,7 @@ void CommandLineInterface::handleMetadata(string const& _contract) if (m_args.count(g_argOutputDir)) createFile(m_compiler->filesystemFriendlyName(_contract) + "_meta.json", data); else - cout << "Metadata: " << endl << data << endl; + sout() << "Metadata: " << endl << data << endl; } void CommandLineInterface::handleABI(string const& _contract) @@ -302,7 +321,7 @@ void CommandLineInterface::handleABI(string const& _contract) if (m_args.count(g_argOutputDir)) createFile(m_compiler->filesystemFriendlyName(_contract) + ".abi", data); else - cout << "Contract JSON ABI " << endl << data << endl; + sout() << "Contract JSON ABI " << endl << data << endl; } void CommandLineInterface::handleNatspec(bool _natspecDev, string const& _contract) @@ -336,8 +355,8 @@ void CommandLineInterface::handleNatspec(bool _natspecDev, string const& _contra createFile(m_compiler->filesystemFriendlyName(_contract) + suffix, output); else { - cout << title << endl; - cout << output << endl; + sout() << title << endl; + sout() << output << endl; } } @@ -346,39 +365,39 @@ void CommandLineInterface::handleNatspec(bool _natspecDev, string const& _contra void CommandLineInterface::handleGasEstimation(string const& _contract) { Json::Value estimates = m_compiler->gasEstimates(_contract); - cout << "Gas estimation:" << endl; + sout() << "Gas estimation:" << endl; if (estimates["creation"].isObject()) { Json::Value creation = estimates["creation"]; - cout << "construction:" << endl; - cout << " " << creation["executionCost"].asString(); - cout << " + " << creation["codeDepositCost"].asString(); - cout << " = " << creation["totalCost"].asString() << endl; + sout() << "construction:" << endl; + sout() << " " << creation["executionCost"].asString(); + sout() << " + " << creation["codeDepositCost"].asString(); + sout() << " = " << creation["totalCost"].asString() << endl; } if (estimates["external"].isObject()) { Json::Value externalFunctions = estimates["external"]; - cout << "external:" << endl; + sout() << "external:" << endl; for (auto const& name: externalFunctions.getMemberNames()) { if (name.empty()) - cout << " fallback:\t"; + sout() << " fallback:\t"; else - cout << " " << name << ":\t"; - cout << externalFunctions[name].asString() << endl; + sout() << " " << name << ":\t"; + sout() << externalFunctions[name].asString() << endl; } } if (estimates["internal"].isObject()) { Json::Value internalFunctions = estimates["internal"]; - cout << "internal:" << endl; + sout() << "internal:" << endl; for (auto const& name: internalFunctions.getMemberNames()) { - cout << " " << name << ":\t"; - cout << internalFunctions[name].asString() << endl; + sout() << " " << name << ":\t"; + sout() << internalFunctions[name].asString() << endl; } } } @@ -400,7 +419,7 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings() } else { - cerr << "Invalid remapping: \"" << path << "\"." << endl; + serr() << "Invalid remapping: \"" << path << "\"." << endl; return false; } } @@ -413,11 +432,11 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings() { if (!ignoreMissing) { - cerr << infile << " is not found." << endl; + serr() << infile << " is not found." << endl; return false; } else - cerr << infile << " is not found. Skipping." << endl; + serr() << infile << " is not found. Skipping." << endl; continue; } @@ -426,11 +445,11 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings() { if (!ignoreMissing) { - cerr << infile << " is not a valid file." << endl; + serr() << infile << " is not a valid file." << endl; return false; } else - cerr << infile << " is not a valid file. Skipping." << endl; + serr() << infile << " is not a valid file. Skipping." << endl; continue; } @@ -444,7 +463,7 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings() m_sourceCodes[g_stdinFileName] = dev::readStandardInput(); if (m_sourceCodes.size() == 0) { - cerr << "No input files given. If you wish to use the standard input please specify \"-\" explicitly." << endl; + serr() << "No input files given. If you wish to use the standard input please specify \"-\" explicitly." << endl; return false; } @@ -475,7 +494,7 @@ bool CommandLineInterface::parseLibraryOption(string const& _input) auto colon = lib.rfind(':'); if (colon == string::npos) { - cerr << "Colon separator missing in library address specifier \"" << lib << "\"" << endl; + serr() << "Colon separator missing in library address specifier \"" << lib << "\"" << endl; return false; } string libName(lib.begin(), lib.begin() + colon); @@ -486,26 +505,26 @@ bool CommandLineInterface::parseLibraryOption(string const& _input) addrString = addrString.substr(2); if (addrString.empty()) { - cerr << "Empty address provided for library \"" << libName << "\": " << endl; - cerr << "Note that there should not be any whitespace after the colon." << endl; + serr() << "Empty address provided for library \"" << libName << "\": " << endl; + serr() << "Note that there should not be any whitespace after the colon." << endl; return false; } else if (addrString.length() != 40) { - cerr << "Invalid length for address for library \"" << libName << "\": " << addrString.length() << " instead of 40 characters." << endl; + serr() << "Invalid length for address for library \"" << libName << "\": " << addrString.length() << " instead of 40 characters." << endl; return false; } if (!passesAddressChecksum(addrString, false)) { - cerr << "Invalid checksum on address for library \"" << libName << "\": " << addrString << endl; - cerr << "The correct checksum is " << dev::getChecksummedAddress(addrString) << endl; + serr() << "Invalid checksum on address for library \"" << libName << "\": " << addrString << endl; + serr() << "The correct checksum is " << dev::getChecksummedAddress(addrString) << endl; return false; } bytes binAddr = fromHex(addrString); h160 address(binAddr, h160::AlignRight); if (binAddr.size() > 20 || address == h160()) { - cerr << "Invalid address for library \"" << libName << "\": " << addrString << endl; + serr() << "Invalid address for library \"" << libName << "\": " << addrString << endl; return false; } m_libraries[libName] = address; @@ -525,7 +544,7 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da string pathName = (p / _fileName).string(); if (fs::exists(pathName) && !m_args.count(g_strOverwrite)) { - cerr << "Refusing to overwrite existing file \"" << pathName << "\" (use --overwrite to force)." << endl; + serr() << "Refusing to overwrite existing file \"" << pathName << "\" (use --overwrite to force)." << endl; m_error = true; return; } @@ -542,6 +561,8 @@ void CommandLineInterface::createJson(string const& _fileName, string const& _js bool CommandLineInterface::parseArguments(int _argc, char** _argv) { + g_hasOutput = false; + // Declare the supported options. po::options_description desc(R"(solc, the Solidity commandline compiler. @@ -605,15 +626,15 @@ Allowed options)", ) ( g_argAssemble.c_str(), - "Switch to assembly mode, ignoring all options except --machine and assumes input is assembly." + "Switch to assembly mode, ignoring all options except --machine and --optimize and assumes input is assembly." ) ( g_argYul.c_str(), - "Switch to Yul mode, ignoring all options except --machine and assumes input is Yul." + "Switch to Yul mode, ignoring all options except --machine and --optimize and assumes input is Yul." ) ( g_argStrictAssembly.c_str(), - "Switch to strict assembly mode, ignoring all options except --machine and assumes input is strict assembly." + "Switch to strict assembly mode, ignoring all options except --machine and --optimize and assumes input is strict assembly." ) ( g_argMachine.c_str(), @@ -666,13 +687,13 @@ Allowed options)", } catch (po::error const& _exception) { - cerr << _exception.what() << endl; + serr() << _exception.what() << endl; return false; } if (m_args.count(g_argHelp) || (isatty(fileno(stdin)) && _argc == 1)) { - cout << desc; + sout() << desc; return false; } @@ -694,7 +715,7 @@ Allowed options)", for (string const& item: boost::split(requests, m_args[g_argCombinedJson].as<string>(), boost::is_any_of(","))) if (!g_combinedJsonArgs.count(item)) { - cerr << "Invalid option to --combined-json: " << item << endl; + serr() << "Invalid option to --combined-json: " << item << endl; return false; } } @@ -758,9 +779,7 @@ bool CommandLineInterface::processInput() // path comparison in later parts of the code, so we need to strip // it. if (filesystem_path.filename() == ".") - { filesystem_path.remove_filename(); - } m_allowedDirectories.push_back(filesystem_path); } } @@ -769,7 +788,7 @@ bool CommandLineInterface::processInput() { string input = dev::readStandardInput(); StandardCompiler compiler(fileReader); - cout << compiler.compile(input) << endl; + sout() << compiler.compile(input) << endl; return true; } @@ -787,7 +806,7 @@ bool CommandLineInterface::processInput() boost::optional<EVMVersion> versionOption = EVMVersion::fromString(versionOptionStr); if (!versionOption) { - cerr << "Invalid option for --evm-version: " << versionOptionStr << endl; + serr() << "Invalid option for --evm-version: " << versionOptionStr << endl; return false; } m_evmVersion = *versionOption; @@ -801,6 +820,7 @@ bool CommandLineInterface::processInput() using Machine = AssemblyStack::Machine; Input inputLanguage = m_args.count(g_argYul) ? Input::Yul : (m_args.count(g_argStrictAssembly) ? Input::StrictAssembly : Input::Assembly); Machine targetMachine = Machine::EVM; + bool optimize = m_args.count(g_argOptimize); if (m_args.count(g_argMachine)) { string machine = m_args[g_argMachine].as<string>(); @@ -812,11 +832,22 @@ bool CommandLineInterface::processInput() targetMachine = Machine::eWasm; else { - cerr << "Invalid option for --machine: " << machine << endl; + serr() << "Invalid option for --machine: " << machine << endl; return false; } } - return assemble(inputLanguage, targetMachine); + if (optimize && inputLanguage == Input::Assembly) + { + serr() << + "Optimizer cannot be used for loose assembly. Use --" << + g_strStrictAssembly << + " or --" << + g_strYul << + "." << + endl; + return false; + } + return assemble(inputLanguage, targetMachine, optimize); } if (m_args.count(g_argLink)) { @@ -827,8 +858,8 @@ bool CommandLineInterface::processInput() m_compiler.reset(new CompilerStack(fileReader)); - auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); }; - SourceReferenceFormatter formatter(cerr, scannerFromSourceName); + auto scannerFromSourceName = [&](string const& _sourceName) -> Scanner const& { return m_compiler->scanner(_sourceName); }; + SourceReferenceFormatter formatter(serr(false), scannerFromSourceName); try { @@ -849,48 +880,55 @@ bool CommandLineInterface::processInput() bool successful = m_compiler->compile(); for (auto const& error: m_compiler->errors()) + { + g_hasOutput = true; formatter.printExceptionInformation( *error, (error->type() == Error::Type::Warning) ? "Warning" : "Error" ); + } if (!successful) return false; } catch (CompilerError const& _exception) { + g_hasOutput = true; formatter.printExceptionInformation(_exception, "Compiler error"); return false; } catch (InternalCompilerError const& _exception) { - cerr << "Internal compiler error during compilation:" << endl + serr() << "Internal compiler error during compilation:" << endl << boost::diagnostic_information(_exception); return false; } catch (UnimplementedFeatureError const& _exception) { - cerr << "Unimplemented feature:" << endl + serr() << "Unimplemented feature:" << endl << boost::diagnostic_information(_exception); return false; } catch (Error const& _error) { if (_error.type() == Error::Type::DocstringParsingError) - cerr << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl; + serr() << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl; else + { + g_hasOutput = true; formatter.printExceptionInformation(_error, _error.typeName()); + } return false; } catch (Exception const& _exception) { - cerr << "Exception during compilation: " << boost::diagnostic_information(_exception) << endl; + serr() << "Exception during compilation: " << boost::diagnostic_information(_exception) << endl; return false; } catch (...) { - cerr << "Unknown exception during compilation." << endl; + serr() << "Unknown exception during compilation." << endl; return false; } @@ -971,7 +1009,7 @@ void CommandLineInterface::handleCombinedJSON() if (m_args.count(g_argOutputDir)) createJson("combined", json); else - cout << json << endl; + sout() << json << endl; } void CommandLineInterface::handleAst(string const& _argStr) @@ -996,12 +1034,16 @@ void CommandLineInterface::handleAst(string const& _argStr) map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts; for (auto const& contract : m_compiler->contractNames()) { - auto ret = GasEstimator::breakToStatementLevel( - GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(contract), asts), - asts - ); - for (auto const& it: ret) - gasCosts[it.first] += it.second; + if (auto const* assemblyItems = m_compiler->runtimeAssemblyItems(contract)) + { + auto ret = GasEstimator::breakToStatementLevel( + GasEstimator(m_evmVersion).structuralEstimation(*assemblyItems, asts), + asts + ); + for (auto const& it: ret) + gasCosts[it.first] += it.second; + } + } bool legacyFormat = !m_args.count(g_argAstCompactJson); @@ -1027,10 +1069,10 @@ void CommandLineInterface::handleAst(string const& _argStr) } else { - cout << title << endl << endl; + sout() << title << endl << endl; for (auto const& sourceCode: m_sourceCodes) { - cout << endl << "======= " << sourceCode.first << " =======" << endl; + sout() << endl << "======= " << sourceCode.first << " =======" << endl; if (_argStr == g_argAst) { ASTPrinter printer( @@ -1038,10 +1080,10 @@ void CommandLineInterface::handleAst(string const& _argStr) sourceCode.second, gasCosts ); - printer.print(cout); + printer.print(sout()); } else - ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(cout, m_compiler->ast(sourceCode.first)); + ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(sout(), m_compiler->ast(sourceCode.first)); } } } @@ -1089,7 +1131,7 @@ bool CommandLineInterface::link() if (it == end) break; if (end - it < placeholderSize) { - cerr << "Error in binary object file " << src.first << " at position " << (end - src.second.begin()) << endl; + serr() << "Error in binary object file " << src.first << " at position " << (end - src.second.begin()) << endl; return false; } @@ -1100,7 +1142,7 @@ bool CommandLineInterface::link() copy(hexStr.begin(), hexStr.end(), it); } else - cerr << "Reference \"" << name << "\" in file \"" << src.first << "\" still unresolved." << endl; + serr() << "Reference \"" << name << "\" in file \"" << src.first << "\" still unresolved." << endl; it += placeholderSize; } // Remove hints for resolved libraries. @@ -1116,17 +1158,18 @@ void CommandLineInterface::writeLinkedFiles() { for (auto const& src: m_sourceCodes) if (src.first == g_stdinFileName) - cout << src.second << endl; + sout() << src.second << endl; else { ofstream outFile(src.first); outFile << src.second; if (!outFile) { - cerr << "Could not write to file " << src.first << ". Aborting." << endl; + serr() << "Could not write to file " << src.first << ". Aborting." << endl; return; } } + sout() << "Linking completed." << endl; } string CommandLineInterface::libraryPlaceholderHint(string const& _libraryName) @@ -1148,7 +1191,8 @@ string CommandLineInterface::objectWithLinkRefsHex(eth::LinkerObject const& _obj bool CommandLineInterface::assemble( AssemblyStack::Language _language, - AssemblyStack::Machine _targetMachine + AssemblyStack::Machine _targetMachine, + bool _optimize ) { bool successful = true; @@ -1160,15 +1204,17 @@ bool CommandLineInterface::assemble( { if (!stack.parseAndAnalyze(src.first, src.second)) successful = false; + else if (_optimize) + stack.optimize(); } catch (Exception const& _exception) { - cerr << "Exception in assembler: " << boost::diagnostic_information(_exception) << endl; + serr() << "Exception in assembler: " << boost::diagnostic_information(_exception) << endl; return false; } catch (...) { - cerr << "Unknown exception in assembler." << endl; + serr() << "Unknown exception in assembler." << endl; return false; } } @@ -1177,13 +1223,16 @@ bool CommandLineInterface::assemble( { auto const& stack = sourceAndStack.second; auto scannerFromSourceName = [&](string const&) -> Scanner const& { return stack.scanner(); }; - SourceReferenceFormatter formatter(cerr, scannerFromSourceName); + SourceReferenceFormatter formatter(serr(false), scannerFromSourceName); for (auto const& error: stack.errors()) + { + g_hasOutput = true; formatter.printExceptionInformation( *error, (error->type() == Error::Type::Warning) ? "Warning" : "Error" ); + } if (!Error::containsOnlyWarnings(stack.errors())) successful = false; } @@ -1197,11 +1246,11 @@ bool CommandLineInterface::assemble( _targetMachine == AssemblyStack::Machine::EVM ? "EVM" : _targetMachine == AssemblyStack::Machine::EVM15 ? "EVM 1.5" : "eWasm"; - cout << endl << "======= " << src.first << " (" << machine << ") =======" << endl; + sout() << endl << "======= " << src.first << " (" << machine << ") =======" << endl; AssemblyStack& stack = assemblyStacks[src.first]; - cout << endl << "Pretty printed source:" << endl; - cout << stack.print() << endl; + sout() << endl << "Pretty printed source:" << endl; + sout() << stack.print() << endl; MachineAssemblyObject object; try @@ -1210,26 +1259,26 @@ bool CommandLineInterface::assemble( } catch (Exception const& _exception) { - cerr << "Exception while assembling: " << boost::diagnostic_information(_exception) << endl; + serr() << "Exception while assembling: " << boost::diagnostic_information(_exception) << endl; return false; } catch (...) { - cerr << "Unknown exception while assembling." << endl; + serr() << "Unknown exception while assembling." << endl; return false; } - cout << endl << "Binary representation:" << endl; + sout() << endl << "Binary representation:" << endl; if (object.bytecode) - cout << object.bytecode->toHex() << endl; + sout() << object.bytecode->toHex() << endl; else - cerr << "No binary representation found." << endl; + serr() << "No binary representation found." << endl; - cout << endl << "Text representation:" << endl; + sout() << endl << "Text representation:" << endl; if (!object.assembly.empty()) - cout << object.assembly << endl; + sout() << object.assembly << endl; else - cerr << "No text representation found." << endl; + serr() << "No text representation found." << endl; } return true; @@ -1248,7 +1297,7 @@ void CommandLineInterface::outputCompilationResults() for (string const& contract: contracts) { if (needsHumanTargetedStdout(m_args)) - cout << endl << "======= " << contract << " =======" << endl; + sout() << endl << "======= " << contract << " =======" << endl; // do we need EVM assembly? if (m_args.count(g_argAsm) || m_args.count(g_argAsmJson)) @@ -1265,7 +1314,7 @@ void CommandLineInterface::outputCompilationResults() } else { - cout << "EVM assembly:" << endl << ret << endl; + sout() << "EVM assembly:" << endl << ret << endl; } } @@ -1279,6 +1328,14 @@ void CommandLineInterface::outputCompilationResults() handleNatspec(true, contract); handleNatspec(false, contract); } // end of contracts iteration + + if (!g_hasOutput) + { + if (m_args.count(g_argOutputDir)) + sout() << "Compiler run successful. Artifact(s) can be found in directory " << m_args.at(g_argOutputDir).as<string>() << "." << endl; + else + serr() << "Compiler run successful, no output requested." << endl; + } } } diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index aa49383a..0b22ca29 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -23,7 +23,7 @@ #include <libsolidity/interface/CompilerStack.h> #include <libsolidity/interface/AssemblyStack.h> -#include <libsolidity/interface/EVMVersion.h> +#include <liblangutil/EVMVersion.h> #include <boost/program_options.hpp> #include <boost/filesystem/path.hpp> @@ -59,7 +59,7 @@ private: /// @returns the full object with library placeholder hints in hex. static std::string objectWithLinkRefsHex(eth::LinkerObject const& _obj); - bool assemble(AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine); + bool assemble(AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine, bool _optimize); void outputCompilationResults(); |