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
ffe08917
Commit
ffe08917
authored
Sep 14, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of structs with embedded global types.
From-SVN: r178870
parent
fe0aee6c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
gcc/go/gofrontend/expressions.cc
+15
-2
gcc/go/gofrontend/types.cc
+0
-0
gcc/go/gofrontend/types.h
+4
-0
No files found.
gcc/go/gofrontend/expressions.cc
View file @
ffe08917
...
@@ -12640,6 +12640,16 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
...
@@ -12640,6 +12640,16 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
{
{
const
Struct_field
*
sf
=
st
->
field
(
fre
->
field_index
());
const
Struct_field
*
sf
=
st
->
field
(
fre
->
field_index
());
name
=
sf
->
field_name
();
name
=
sf
->
field_name
();
// See below. FIXME.
if
(
!
Gogo
::
is_hidden_name
(
name
)
&&
name
[
0
]
>=
'a'
&&
name
[
0
]
<=
'z'
)
{
if
(
gogo
->
lookup_global
(
name
.
c_str
())
!=
NULL
)
name
=
gogo
->
pack_hidden_name
(
name
,
false
);
}
char
buf
[
20
];
char
buf
[
20
];
snprintf
(
buf
,
sizeof
buf
,
"%u"
,
fre
->
field_index
());
snprintf
(
buf
,
sizeof
buf
,
"%u"
,
fre
->
field_index
());
size_t
buflen
=
strlen
(
buf
);
size_t
buflen
=
strlen
(
buf
);
...
@@ -12671,7 +12681,7 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
...
@@ -12671,7 +12681,7 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
// A predefined name won't be packed. If it starts with a
// A predefined name won't be packed. If it starts with a
// lower case letter we need to check for that case, because
// lower case letter we need to check for that case, because
// the field name will be packed.
// the field name will be packed.
FIXME.
if
(
!
Gogo
::
is_hidden_name
(
name
)
if
(
!
Gogo
::
is_hidden_name
(
name
)
&&
name
[
0
]
>=
'a'
&&
name
[
0
]
>=
'a'
&&
name
[
0
]
<=
'z'
)
&&
name
[
0
]
<=
'z'
)
...
@@ -13505,7 +13515,10 @@ Struct_field_offset_expression::do_dump_expression(
...
@@ -13505,7 +13515,10 @@ Struct_field_offset_expression::do_dump_expression(
Ast_dump_context
*
ast_dump_context
)
const
Ast_dump_context
*
ast_dump_context
)
const
{
{
ast_dump_context
->
ostream
()
<<
"unsafe.Offsetof("
;
ast_dump_context
->
ostream
()
<<
"unsafe.Offsetof("
;
ast_dump_context
->
ostream
()
<<
this
->
field_
->
field_name
();
ast_dump_context
->
dump_type
(
this
->
type_
);
ast_dump_context
->
ostream
()
<<
'.'
;
ast_dump_context
->
ostream
()
<<
Gogo
::
message_name
(
this
->
field_
->
field_name
());
ast_dump_context
->
ostream
()
<<
")"
;
ast_dump_context
->
ostream
()
<<
")"
;
}
}
...
...
gcc/go/gofrontend/types.cc
View file @
ffe08917
This diff is collapsed.
Click to expand it.
gcc/go/gofrontend/types.h
View file @
ffe08917
...
@@ -1732,6 +1732,10 @@ class Struct_field
...
@@ -1732,6 +1732,10 @@ class Struct_field
const
std
::
string
&
const
std
::
string
&
field_name
()
const
;
field_name
()
const
;
// Return whether this struct field is named NAME.
bool
is_field_name
(
const
std
::
string
&
name
)
const
;
// The field type.
// The field type.
Type
*
Type
*
type
()
const
type
()
const
...
...
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