diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2019-01-15 20:40:10 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2019-01-15 23:32:21 +0800 |
commit | 4c8f8e949143d0c680a8257adbcc768d908fae9a (patch) | |
tree | cbaea6e325d355e4050f084936497a0816bb5bcc /libyul/optimiser | |
parent | f9ca5b78fb41c18fe0b538d0be909c9026269fbd (diff) | |
download | dexon-solidity-4c8f8e949143d0c680a8257adbcc768d908fae9a.tar.gz dexon-solidity-4c8f8e949143d0c680a8257adbcc768d908fae9a.tar.zst dexon-solidity-4c8f8e949143d0c680a8257adbcc768d908fae9a.zip |
Disallow mismatching types in switch cases and detect duplicates by value for number literals.
Diffstat (limited to 'libyul/optimiser')
-rw-r--r-- | libyul/optimiser/ExpressionJoiner.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/FullInliner.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/FunctionHoister.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/InlinableExpressionFunctionFinder.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/OptimizerUtilities.cpp (renamed from libyul/optimiser/Utilities.cpp) | 13 | ||||
-rw-r--r-- | libyul/optimiser/OptimizerUtilities.h (renamed from libyul/optimiser/Utilities.h) | 2 | ||||
-rw-r--r-- | libyul/optimiser/SimplificationRules.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/StructuralSimplifier.cpp | 2 | ||||
-rw-r--r-- | libyul/optimiser/UnusedPruner.cpp | 2 |
9 files changed, 9 insertions, 20 deletions
diff --git a/libyul/optimiser/ExpressionJoiner.cpp b/libyul/optimiser/ExpressionJoiner.cpp index de2b5d53..02ac4e45 100644 --- a/libyul/optimiser/ExpressionJoiner.cpp +++ b/libyul/optimiser/ExpressionJoiner.cpp @@ -22,7 +22,7 @@ #include <libyul/optimiser/ExpressionJoiner.h> #include <libyul/optimiser/NameCollector.h> -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/Exceptions.h> #include <libyul/AsmData.h> diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp index 1f267f96..dd969faf 100644 --- a/libyul/optimiser/FullInliner.cpp +++ b/libyul/optimiser/FullInliner.cpp @@ -23,7 +23,7 @@ #include <libyul/optimiser/ASTCopier.h> #include <libyul/optimiser/ASTWalker.h> #include <libyul/optimiser/NameCollector.h> -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/optimiser/Metrics.h> #include <libyul/optimiser/SSAValueTracker.h> #include <libyul/Exceptions.h> diff --git a/libyul/optimiser/FunctionHoister.cpp b/libyul/optimiser/FunctionHoister.cpp index bd1c781b..4863b94d 100644 --- a/libyul/optimiser/FunctionHoister.cpp +++ b/libyul/optimiser/FunctionHoister.cpp @@ -21,7 +21,7 @@ */ #include <libyul/optimiser/FunctionHoister.h> -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/AsmData.h> #include <libdevcore/CommonData.h> diff --git a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp index 662cdf25..f57faa7c 100644 --- a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp +++ b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp @@ -20,7 +20,7 @@ #include <libyul/optimiser/InlinableExpressionFunctionFinder.h> -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/AsmData.h> using namespace std; diff --git a/libyul/optimiser/Utilities.cpp b/libyul/optimiser/OptimizerUtilities.cpp index b3b580d5..f9571a4c 100644 --- a/libyul/optimiser/Utilities.cpp +++ b/libyul/optimiser/OptimizerUtilities.cpp @@ -1,4 +1,4 @@ -/*( +/* This file is part of solidity. solidity is free software: you can redistribute it and/or modify @@ -18,10 +18,9 @@ * Some useful snippets for the optimiser. */ -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/AsmData.h> -#include <libyul/Exceptions.h> #include <libdevcore/CommonData.h> @@ -38,11 +37,3 @@ void yul::removeEmptyBlocks(Block& _block) }; boost::range::remove_erase_if(_block.statements, isEmptyBlock); } - -u256 yul::valueOfNumberLiteral(Literal const& _literal) -{ - assertThrow(_literal.kind == LiteralKind::Number, OptimizerException, ""); - std::string const& literalString = _literal.value.str(); - assertThrow(isValidDecimal(literalString) || isValidHex(literalString), OptimizerException, ""); - return u256(literalString); -} diff --git a/libyul/optimiser/Utilities.h b/libyul/optimiser/OptimizerUtilities.h index 1cfff62b..449a1bc0 100644 --- a/libyul/optimiser/Utilities.h +++ b/libyul/optimiser/OptimizerUtilities.h @@ -29,6 +29,4 @@ namespace yul /// Removes statements that are just empty blocks (non-recursive). void removeEmptyBlocks(Block& _block); -dev::u256 valueOfNumberLiteral(Literal const& _literal); - } diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp index da9c7d9d..037dad97 100644 --- a/libyul/optimiser/SimplificationRules.cpp +++ b/libyul/optimiser/SimplificationRules.cpp @@ -20,11 +20,11 @@ #include <libyul/optimiser/SimplificationRules.h> -#include <libyul/optimiser/Utilities.h> #include <libyul/optimiser/ASTCopier.h> #include <libyul/optimiser/Semantics.h> #include <libyul/optimiser/SyntacticalEquality.h> #include <libyul/AsmData.h> +#include <libyul/Utilities.h> #include <libevmasm/RuleList.h> diff --git a/libyul/optimiser/StructuralSimplifier.cpp b/libyul/optimiser/StructuralSimplifier.cpp index bdf4cb2a..8d7dcd57 100644 --- a/libyul/optimiser/StructuralSimplifier.cpp +++ b/libyul/optimiser/StructuralSimplifier.cpp @@ -16,8 +16,8 @@ */ #include <libyul/optimiser/StructuralSimplifier.h> #include <libyul/optimiser/Semantics.h> -#include <libyul/optimiser/Utilities.h> #include <libyul/AsmData.h> +#include <libyul/Utilities.h> #include <libdevcore/CommonData.h> #include <libdevcore/Visitor.h> diff --git a/libyul/optimiser/UnusedPruner.cpp b/libyul/optimiser/UnusedPruner.cpp index 53c412e3..365b255c 100644 --- a/libyul/optimiser/UnusedPruner.cpp +++ b/libyul/optimiser/UnusedPruner.cpp @@ -22,7 +22,7 @@ #include <libyul/optimiser/NameCollector.h> #include <libyul/optimiser/Semantics.h> -#include <libyul/optimiser/Utilities.h> +#include <libyul/optimiser/OptimizerUtilities.h> #include <libyul/Exceptions.h> #include <libyul/AsmData.h> |