Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
20532210
Commit
20532210
authored
Mar 03, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Determine call types even if first call result is not used.
From-SVN: r170637
parent
4bb90140
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
gcc/go/gofrontend/expressions.cc
+22
-2
gcc/go/gofrontend/expressions.h
+9
-4
No files found.
gcc/go/gofrontend/expressions.cc
View file @
20532210
...
@@ -7250,6 +7250,9 @@ Builtin_call_expression::do_type()
...
@@ -7250,6 +7250,9 @@ Builtin_call_expression::do_type()
void
void
Builtin_call_expression
::
do_determine_type
(
const
Type_context
*
context
)
Builtin_call_expression
::
do_determine_type
(
const
Type_context
*
context
)
{
{
if
(
!
this
->
determining_types
())
return
;
this
->
fn
()
->
determine_type_no_context
();
this
->
fn
()
->
determine_type_no_context
();
const
Expression_list
*
args
=
this
->
args
();
const
Expression_list
*
args
=
this
->
args
();
...
@@ -8486,6 +8489,9 @@ Call_expression::do_type()
...
@@ -8486,6 +8489,9 @@ Call_expression::do_type()
void
void
Call_expression
::
do_determine_type
(
const
Type_context
*
)
Call_expression
::
do_determine_type
(
const
Type_context
*
)
{
{
if
(
!
this
->
determining_types
())
return
;
this
->
fn_
->
determine_type_no_context
();
this
->
fn_
->
determine_type_no_context
();
Function_type
*
fntype
=
this
->
get_function_type
();
Function_type
*
fntype
=
this
->
get_function_type
();
const
Typed_identifier_list
*
parameters
=
NULL
;
const
Typed_identifier_list
*
parameters
=
NULL
;
...
@@ -8512,6 +8518,21 @@ Call_expression::do_determine_type(const Type_context*)
...
@@ -8512,6 +8518,21 @@ Call_expression::do_determine_type(const Type_context*)
}
}
}
}
// Called when determining types for a Call_expression. Return true
// if we should go ahead, false if they have already been determined.
bool
Call_expression
::
determining_types
()
{
if
(
this
->
types_are_determined_
)
return
false
;
else
{
this
->
types_are_determined_
=
true
;
return
true
;
}
}
// Check types for parameter I.
// Check types for parameter I.
bool
bool
...
@@ -9004,8 +9025,7 @@ Call_result_expression::do_check_types(Gogo*)
...
@@ -9004,8 +9025,7 @@ Call_result_expression::do_check_types(Gogo*)
void
void
Call_result_expression
::
do_determine_type
(
const
Type_context
*
)
Call_result_expression
::
do_determine_type
(
const
Type_context
*
)
{
{
if
(
this
->
index_
==
0
)
this
->
call_
->
determine_type_no_context
();
this
->
call_
->
determine_type_no_context
();
}
}
// Return the tree.
// Return the tree.
...
...
gcc/go/gofrontend/expressions.h
View file @
20532210
...
@@ -1161,7 +1161,7 @@ class Call_expression : public Expression
...
@@ -1161,7 +1161,7 @@ class Call_expression : public Expression
source_location
location
)
source_location
location
)
:
Expression
(
EXPRESSION_CALL
,
location
),
:
Expression
(
EXPRESSION_CALL
,
location
),
fn_
(
fn
),
args_
(
args
),
type_
(
NULL
),
tree_
(
NULL
),
is_varargs_
(
is_varargs
),
fn_
(
fn
),
args_
(
args
),
type_
(
NULL
),
tree_
(
NULL
),
is_varargs_
(
is_varargs
),
is_value_discarded_
(
false
),
varargs_are_lower
ed_
(
false
),
varargs_are_lowered_
(
false
),
types_are_determin
ed_
(
false
),
is_deferred_
(
false
)
is_deferred_
(
false
)
{
}
{
}
...
@@ -1220,7 +1220,7 @@ class Call_expression : public Expression
...
@@ -1220,7 +1220,7 @@ class Call_expression : public Expression
void
void
do_discarding_value
()
do_discarding_value
()
{
this
->
is_value_discarded_
=
true
;
}
{
}
virtual
Type
*
virtual
Type
*
do_type
();
do_type
();
...
@@ -1263,6 +1263,11 @@ class Call_expression : public Expression
...
@@ -1263,6 +1263,11 @@ class Call_expression : public Expression
lower_varargs
(
Gogo
*
,
Named_object
*
function
,
Type
*
varargs_type
,
lower_varargs
(
Gogo
*
,
Named_object
*
function
,
Type
*
varargs_type
,
size_t
param_count
);
size_t
param_count
);
// Let a builtin expression check whether types have been
// determined.
bool
determining_types
();
private
:
private
:
bool
bool
check_argument_type
(
int
,
const
Type
*
,
const
Type
*
,
source_location
,
bool
);
check_argument_type
(
int
,
const
Type
*
,
const
Type
*
,
source_location
,
bool
);
...
@@ -1286,10 +1291,10 @@ class Call_expression : public Expression
...
@@ -1286,10 +1291,10 @@ class Call_expression : public Expression
tree
tree_
;
tree
tree_
;
// True if the last argument is a varargs argument (f(a...)).
// True if the last argument is a varargs argument (f(a...)).
bool
is_varargs_
;
bool
is_varargs_
;
// True if the value is being discarded.
bool
is_value_discarded_
;
// True if varargs have already been lowered.
// True if varargs have already been lowered.
bool
varargs_are_lowered_
;
bool
varargs_are_lowered_
;
// True if types have been determined.
bool
types_are_determined_
;
// True if the call is an argument to a defer statement.
// True if the call is an argument to a defer statement.
bool
is_deferred_
;
bool
is_deferred_
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment