Add include file to forward-declare inline assembly structs.

This commit is contained in:
chriseth 2017-06-01 15:41:51 +02:00 committed by Alex Beregszaszi
parent 49b1112117
commit 8e5c4bf21d
7 changed files with 65 additions and 77 deletions

View File

@ -21,6 +21,7 @@
#include <libjulia/backends/evm/EVMAssembly.h>
#include <libsolidity/inlineasm/AsmScope.h>
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>

View File

@ -26,6 +26,8 @@
#include <libjulia/backends/evm/AbstractAssembly.h>
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
#include <functional>
@ -39,21 +41,6 @@ class ErrorReporter;
namespace assembly
{
struct Literal;
struct Block;
struct Label;
struct FunctionalInstruction;
struct Assignment;
struct VariableDeclaration;
struct Instruction;
struct Identifier;
struct StackAssignment;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Switch, Block, ForLoop>;
struct AsmAnalysisInfo;
/**

View File

@ -20,6 +20,8 @@
#pragma once
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
#include <map>
@ -33,24 +35,8 @@ namespace solidity
namespace assembly
{
struct Literal;
struct Block;
struct Label;
struct FunctionalInstruction;
struct Assignment;
struct VariableDeclaration;
struct Instruction;
struct Identifier;
struct StackAssignment;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
struct Scope;
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Switch, ForLoop, Block>;
struct AsmAnalysisInfo
{
using StackHeightInfo = std::map<void const*, int>;

View File

@ -22,10 +22,13 @@
#pragma once
#include <boost/variant.hpp>
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <libevmasm/Instruction.h>
#include <libevmasm/SourceLocation.h>
#include <boost/variant.hpp>
namespace dev
{
namespace solidity
@ -38,24 +41,6 @@ using Type = std::string;
struct TypedName { SourceLocation location; std::string name; Type type; };
using TypedNameList = std::vector<TypedName>;
/// What follows are the AST nodes for assembly.
struct Instruction;
struct Literal;
struct Label;
struct StackAssignment;
struct Identifier;
struct Assignment;
struct VariableDeclaration;
struct FunctionalInstruction;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
struct Block;
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Switch, ForLoop, Block>;
/// Direct EVM instruction (except PUSHi and JUMPDEST)
struct Instruction { SourceLocation location; solidity::Instruction instruction; };
/// Literal number or string (up to 32 bytes)

View File

@ -0,0 +1,52 @@
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @author Christian <c@ethdev.com>
* @date 2016
* Forward declaration of classes for inline assembly / JULIA AST
*/
#pragma once
#include <boost/variant.hpp>
namespace dev
{
namespace solidity
{
namespace assembly
{
struct Instruction;
struct Literal;
struct Label;
struct StackAssignment;
struct Identifier;
struct Assignment;
struct VariableDeclaration;
struct FunctionalInstruction;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
struct Block;
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Switch, ForLoop, Block>;
}
}
}

View File

@ -22,6 +22,8 @@
#pragma once
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
namespace dev
@ -30,19 +32,6 @@ namespace solidity
{
namespace assembly
{
struct Instruction;
struct Literal;
struct Identifier;
struct FunctionalInstruction;
struct Label;
struct StackAssignment;
struct Assignment;
struct VariableDeclaration;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
struct Block;
class AsmPrinter: public boost::static_visitor<std::string>
{

View File

@ -20,6 +20,8 @@
#pragma once
#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
#include <functional>
@ -35,20 +37,6 @@ namespace assembly
{
struct TypedName;
struct Literal;
struct Block;
struct Label;
struct FunctionalInstruction;
struct Assignment;
struct VariableDeclaration;
struct Instruction;
struct Identifier;
struct StackAssignment;
struct FunctionDefinition;
struct FunctionCall;
struct Switch;
struct ForLoop;
struct Scope;
struct AsmAnalysisInfo;