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
1f94e0c6
Commit
1f94e0c6
authored
May 06, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use backend interface for string types.
From-SVN: r173502
parent
2e8d9212
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
gcc/go/gofrontend/types.cc
+21
-8
No files found.
gcc/go/gofrontend/types.cc
View file @
1f94e0c6
...
@@ -2172,14 +2172,27 @@ Type::lookup_complex_type(const char* name)
...
@@ -2172,14 +2172,27 @@ Type::lookup_complex_type(const char* name)
// struct with two fields: a pointer to the characters and a length.
// struct with two fields: a pointer to the characters and a length.
tree
tree
String_type
::
do_get_tree
(
Gogo
*
)
String_type
::
do_get_tree
(
Gogo
*
gogo
)
{
{
static
tree
struct_type
;
static
Btype
*
backend_string_type
;
return
Gogo
::
builtin_struct
(
&
struct_type
,
"__go_string"
,
NULL_TREE
,
2
,
if
(
backend_string_type
==
NULL
)
"__data"
,
{
build_pointer_type
(
unsigned_char_type_node
),
std
::
vector
<
Backend
::
Btyped_identifier
>
fields
(
2
);
"__length"
,
integer_type_node
);
Type
*
b
=
gogo
->
lookup_global
(
"byte"
)
->
type_value
();
Type
*
pb
=
Type
::
make_pointer_type
(
b
);
fields
[
0
].
name
=
"__data"
;
fields
[
0
].
btype
=
tree_to_type
(
pb
->
get_tree
(
gogo
));
fields
[
0
].
location
=
UNKNOWN_LOCATION
;
Type
*
int_type
=
Type
::
lookup_integer_type
(
"int"
);
fields
[
1
].
name
=
"__length"
;
fields
[
1
].
btype
=
tree_to_type
(
int_type
->
get_tree
(
gogo
));
fields
[
1
].
location
=
UNKNOWN_LOCATION
;
backend_string_type
=
gogo
->
backend
()
->
struct_type
(
fields
);
}
return
type_to_tree
(
backend_string_type
);
}
}
// Return a tree for the length of STRING.
// Return a tree for the length of STRING.
...
...
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