Merge pull request #12746 from tfire/fix/remove-namespace-ast-annotations

Remove use of `using namespace` in header file
This commit is contained in:
Daniel Kirchner
2022-03-11 12:49:13 +01:00
committed by GitHub
39 changed files with 123 additions and 121 deletions
+4 -4
View File
@@ -70,10 +70,10 @@ SemanticTest::SemanticTest(
static set<string> const legacyRunTriggers{"also", "false", "default"};
string compileViaYul = m_reader.stringSetting("compileViaYul", "default");
if (!contains(compileViaYulAllowedValues, compileViaYul))
if (!util::contains(compileViaYulAllowedValues, compileViaYul))
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + compileViaYul + "."));
m_testCaseWantsYulRun = contains(yulRunTriggers, compileViaYul);
m_testCaseWantsLegacyRun = contains(legacyRunTriggers, compileViaYul);
m_testCaseWantsYulRun = util::contains(yulRunTriggers, compileViaYul);
m_testCaseWantsLegacyRun = util::contains(legacyRunTriggers, compileViaYul);
// Do not enforce via yul and ewasm, if via yul was explicitly denied.
if (compileViaYul == "false")
@@ -189,7 +189,7 @@ vector<SideEffectHook> SemanticTest::makeSideEffectHooks() const
{
vector<string> result;
for (auto const& argument: _call.arguments.parameters)
result.emplace_back(toHex(argument.rawBytes));
result.emplace_back(util::toHex(argument.rawBytes));
return result;
}
return {};
+2 -2
View File
@@ -4102,12 +4102,12 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings)
m_optimiserSettings == OptimiserSettings::none()
)
// check that the reason string IS part of the binary.
BOOST_CHECK(toHex(m_output).find("736f6d6520726561736f6e") != std::string::npos);
BOOST_CHECK(util::toHex(m_output).find("736f6d6520726561736f6e") != std::string::npos);
m_revertStrings = RevertStrings::Strip;
compileAndRun(sourceCode, 0, "C");
// check that the reason string is NOT part of the binary.
BOOST_CHECK(toHex(m_output).find("736f6d6520726561736f6e") == std::string::npos);
BOOST_CHECK(util::toHex(m_output).find("736f6d6520726561736f6e") == std::string::npos);
ABI_CHECK(callContractFunction("f(bool)", true), encodeArgs(7));
ABI_CHECK(callContractFunction("f(bool)", false), encodeArgs());
@@ -350,7 +350,7 @@ BOOST_AUTO_TEST_CASE(arithmetic)
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::PUSH32)
} +
fromHex("4E487B7100000000000000000000000000000000000000000000000000000000") +
util::fromHex("4E487B7100000000000000000000000000000000000000000000000000000000") +
bytes{
uint8_t(Instruction::PUSH1), 0x0,
uint8_t(Instruction::MSTORE),
+2 -2
View File
@@ -98,8 +98,8 @@ public:
BOOST_CHECK_MESSAGE(!optimizedOutput.empty(), "No optimized output for " + _sig);
BOOST_CHECK_MESSAGE(!nonOptimizedOutput.empty(), "No un-optimized output for " + _sig);
BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match."
"\nNon-Optimized: " + toHex(nonOptimizedOutput) +
"\nOptimized: " + toHex(optimizedOutput));
"\nNon-Optimized: " + util::toHex(nonOptimizedOutput) +
"\nOptimized: " + util::toHex(optimizedOutput));
}
/// @returns the number of instructions in the given bytecode, not taking the metadata hash
@@ -47,6 +47,7 @@
#include <vector>
using namespace std;
using namespace solidity::util;
using namespace solidity::langutil;
using namespace solidity::frontend;
+1 -1
View File
@@ -220,7 +220,7 @@ string BytesUtils::formatString(bytes const& _bytes, size_t _cutOff)
if (isPrint(static_cast<char>(v)))
os << v;
else
os << "\\x" << toHex(v, HexCase::Lower);
os << "\\x" << util::toHex(v, HexCase::Lower);
}
}
os << "\"";
+4 -1
View File
@@ -16,6 +16,9 @@
*/
// SPDX-License-Identifier: GPL-3.0
#include <libsolutil/StringUtils.h>
#include <test/libsolidity/util/TestFileParser.h>
#include <test/libsolidity/util/BytesUtils.h>
@@ -34,6 +37,7 @@
#include <stdexcept>
using namespace solidity;
using namespace solidity::util;
using namespace solidity::frontend;
using namespace solidity::frontend::test;
using namespace std;
@@ -763,7 +767,6 @@ string TestFileParser::Scanner::scanString()
char TestFileParser::Scanner::scanHexPart()
{
auto toLower = [](char _c) -> char { return tolower(_c, locale::classic()); };
auto isDigit = [](char _c) -> bool { return isdigit(_c, locale::classic()); };
advance(); // skip 'x'
+1 -1
View File
@@ -324,7 +324,7 @@ string TestFunctionCall::formatRawParameters(
for (auto const c: param.rawString)
// NOTE: Even though we have a toHex() overload specifically for uint8_t, the compiler
// chooses the one for bytes if the second argument is omitted.
os << (c >= ' ' ? string(1, c) : "\\x" + toHex(static_cast<uint8_t>(c), HexCase::Lower));
os << (c >= ' ' ? string(1, c) : "\\x" + util::toHex(static_cast<uint8_t>(c), HexCase::Lower));
if (&param != &_params.back())
os << ", ";
}