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
059e2a26
Commit
059e2a26
authored
Dec 21, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash when declaring methods on unknown name.
From-SVN: r168131
parent
7a8de70f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
gcc/go/gofrontend/gogo.cc
+12
-0
gcc/go/gofrontend/gogo.h
+4
-0
gcc/go/gofrontend/types.cc
+4
-2
No files found.
gcc/go/gofrontend/gogo.cc
View file @
059e2a26
...
...
@@ -3710,6 +3710,18 @@ Named_object::set_function_value(Function* function)
this
->
u_
.
func_value
=
function
;
}
// Declare an unknown object as a type declaration.
void
Named_object
::
declare_as_type
()
{
gcc_assert
(
this
->
classification_
==
NAMED_OBJECT_UNKNOWN
);
Unknown_name
*
unk
=
this
->
u_
.
unknown_value
;
this
->
classification_
=
NAMED_OBJECT_TYPE_DECLARATION
;
this
->
u_
.
type_declaration
=
new
Type_declaration
(
unk
->
location
());
delete
unk
;
}
// Return the location of a named object.
source_location
...
...
gcc/go/gofrontend/gogo.h
View file @
059e2a26
...
...
@@ -1815,6 +1815,10 @@ class Named_object
void
set_function_value
(
Function
*
);
// Declare an unknown name as a type declaration.
void
declare_as_type
();
// Export this object.
void
export_named_object
(
Export
*
)
const
;
...
...
gcc/go/gofrontend/types.cc
View file @
059e2a26
...
...
@@ -8013,7 +8013,8 @@ Forward_declaration_type::add_method(const std::string& name,
Function
*
function
)
{
Named_object
*
no
=
this
->
named_object
();
gcc_assert
(
no
->
is_type_declaration
());
if
(
no
->
is_unknown
())
no
->
declare_as_type
();
return
no
->
type_declaration_value
()
->
add_method
(
name
,
function
);
}
...
...
@@ -8026,7 +8027,8 @@ Forward_declaration_type::add_method_declaration(const std::string& name,
source_location
location
)
{
Named_object
*
no
=
this
->
named_object
();
gcc_assert
(
no
->
is_type_declaration
());
if
(
no
->
is_unknown
())
no
->
declare_as_type
();
Type_declaration
*
td
=
no
->
type_declaration_value
();
return
td
->
add_method_declaration
(
name
,
type
,
location
);
}
...
...
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