aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2020-05-21 17:53:24 +0100
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:15 +0000
commitd3cb8c3cd9278693db8737614bdc2deaa6b5d3cc (patch)
treed2a2999a6daa188453f7b21649c608d7c5aa60e7 /gcc
parentf641587ed0683d6ff2479f59576f4c95eac2bf61 (diff)
downloadgcc-d3cb8c3cd9278693db8737614bdc2deaa6b5d3cc.zip
gcc-d3cb8c3cd9278693db8737614bdc2deaa6b5d3cc.tar.gz
gcc-d3cb8c3cd9278693db8737614bdc2deaa6b5d3cc.tar.bz2
We need to analyse and store the locals per block for compilation
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast.h4
-rw-r--r--gcc/rust/ast/rust-item.h4
-rw-r--r--gcc/rust/ast/rust-stmt.h2
3 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 7e85fb3..9ad2c4c 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -804,6 +804,10 @@ public:
virtual void accept_vis (ASTVisitor &vis) = 0;
+ // HACK: slow way of getting location from base expression through virtual
+ // methods.
+ virtual Location get_locus_slow () const { return Location (); }
+
protected:
// Clone function implementation as pure virtual method
virtual Stmt *clone_stmt_impl () const = 0;
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index cfcb5ee..e8eb215 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -1306,6 +1306,8 @@ protected:
::std::vector<FunctionParam> function_params;
};*/
+class LetStmt;
+
// Rust function declaration AST node
class Function : public VisItem, public InherentImplItem, public TraitImplItem
{
@@ -1334,6 +1336,8 @@ public:
Location locus;
+ ::std::vector<LetStmt *> locals;
+
/*~Function() {
delete function_body;
}*/
diff --git a/gcc/rust/ast/rust-stmt.h b/gcc/rust/ast/rust-stmt.h
index f19ba2c..addb5f9 100644
--- a/gcc/rust/ast/rust-stmt.h
+++ b/gcc/rust/ast/rust-stmt.h
@@ -213,6 +213,8 @@ public:
::std::string as_string () const;
+ ::std::vector<LetStmt *> locals;
+
ExprStmtWithBlock (::std::unique_ptr<ExprWithBlock> expr, Location locus)
: ExprStmt (locus), expr (::std::move (expr))
{}