aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2020-05-20 17:54:47 +0100
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:14 +0000
commit2c6cb7e543ffa19b80ab9daf78bb1b9af8061c05 (patch)
treeba4c1b78b9c8eee419f2f67f04c08f891c61ffc6
parent1acf8eba36b06ab816866821542d189935ba360e (diff)
downloadgcc-2c6cb7e543ffa19b80ab9daf78bb1b9af8061c05.zip
gcc-2c6cb7e543ffa19b80ab9daf78bb1b9af8061c05.tar.gz
gcc-2c6cb7e543ffa19b80ab9daf78bb1b9af8061c05.tar.bz2
Add the referenced function to the CallExpr when resolved
-rw-r--r--gcc/rust/analysis/rust-type-resolution.cc2
-rw-r--r--gcc/rust/ast/rust-expr.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rust/analysis/rust-type-resolution.cc b/gcc/rust/analysis/rust-type-resolution.cc
index 0045420..48ea699 100644
--- a/gcc/rust/analysis/rust-type-resolution.cc
+++ b/gcc/rust/analysis/rust-type-resolution.cc
@@ -439,11 +439,13 @@ TypeResolution::visit (AST::EnumExprFieldless &expr)
void
TypeResolution::visit (AST::CallExpr &expr)
{
+ // this look up should probably be moved to name resolution
auto fndecl = lookupFndecl (expr.function.get ());
if (fndecl == NULL)
return;
typeBuffer.push_back (fndecl->return_type.get ());
+ expr.fndeclRef = fndecl;
auto before = typeBuffer.size ();
for (auto &item : expr.params)
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index e0f9536..827ca0d 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -23,6 +23,7 @@ class Statement;*/ // decls no longer required as definitions moved to rust-ast.
// Decl as definition moved to rust-ast.h
class ExprWithoutBlock;
+class Function;
// AST node for an expression with an accompanying block - abstract
class ExprWithBlock : public Expr
@@ -2534,6 +2535,8 @@ public:
Location locus;
+ Function *fndeclRef;
+
/*~CallExpr() {
delete function;
}*/