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
3b547557
Commit
3b547557
authored
Jan 24, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Verify types of sink variables.
From-SVN: r183482
parent
f1d4a790
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
gcc/go/gofrontend/gogo.cc
+16
-0
gcc/go/gofrontend/gogo.h
+7
-0
gcc/go/gofrontend/parse.cc
+2
-0
No files found.
gcc/go/gofrontend/gogo.cc
View file @
3b547557
...
...
@@ -37,6 +37,7 @@ Gogo::Gogo(Backend* backend, Linemap* linemap, int int_type_size,
imported_init_fns_
(),
unique_prefix_
(),
unique_prefix_specified_
(
false
),
verify_types_
(),
interface_types_
(),
specific_type_functions_
(),
specific_type_functions_are_written_
(
false
),
...
...
@@ -1282,6 +1283,15 @@ Gogo::traverse(Traverse* traverse)
}
}
// Add a type to verify. This is used for types of sink variables, in
// order to give appropriate error messages.
void
Gogo
::
add_type_to_verify
(
Type
*
type
)
{
this
->
verify_types_
.
push_back
(
type
);
}
// Traversal class used to verify types.
class
Verify_types
:
public
Traverse
...
...
@@ -1312,6 +1322,12 @@ Gogo::verify_types()
{
Verify_types
traverse
;
this
->
traverse
(
&
traverse
);
for
(
std
::
vector
<
Type
*>::
iterator
p
=
this
->
verify_types_
.
begin
();
p
!=
this
->
verify_types_
.
end
();
++
p
)
(
*
p
)
->
verify
();
this
->
verify_types_
.
clear
();
}
// Traversal class used to lower parse tree.
...
...
gcc/go/gofrontend/gogo.h
View file @
3b547557
...
...
@@ -344,6 +344,11 @@ class Gogo
Named_object
*
add_sink
();
// Add a type which needs to be verified. This is used for sink
// types, just to give appropriate error messages.
void
add_type_to_verify
(
Type
*
type
);
// Add a named object to the current namespace. This is used for
// import . "package".
void
...
...
@@ -683,6 +688,8 @@ class Gogo
std
::
string
unique_prefix_
;
// Whether an explicit unique prefix was set by -fgo-prefix.
bool
unique_prefix_specified_
;
// A list of types to verify.
std
::
vector
<
Type
*>
verify_types_
;
// A list of interface types defined while parsing.
std
::
vector
<
Interface_type
*>
interface_types_
;
// Type specific functions to write out.
...
...
gcc/go/gofrontend/parse.cc
View file @
3b547557
...
...
@@ -1911,6 +1911,8 @@ Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
return
this
->
gogo_
->
add_variable
(
buf
,
var
);
}
}
if
(
type
!=
NULL
)
this
->
gogo_
->
add_type_to_verify
(
type
);
return
this
->
gogo_
->
add_sink
();
}
...
...
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