diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-15 14:22:37 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-15 14:22:37 +0000 |
commit | 07de37ab2d16376cb96b93ad7a7b26fa71905055 (patch) | |
tree | 29792e758bcfc639546baec2d11f930c80e0612b /gcc/data-streamer-in.c | |
parent | 017f22df20c4581f644b66af1639fdd7317e3578 (diff) | |
download | gcc-07de37ab2d16376cb96b93ad7a7b26fa71905055.tar.gz |
2012-10-15 Richard Biener <rguenther@suse.de>
* data-streamer.h (bp_pack_string_with_length): New function.
(bp_pack_string): Likewise.
(bp_unpack_indexed_string): Likewise.
(bp_unpack_string): Likewise.
* data-streamer-out.c (bp_pack_string_with_length): Likewise.
(bp_pack_string): Likewise.
* data-streamer-in.c (bp_unpack_indexed_string): Likewise.
(bp_unpack_string): Likewise.
* tree-streamer-out.c (pack_ts_translation_unit_decl_value_fields):
Pack TRANSLATION_UNIT_LANGUAGE here, not ...
(write_ts_translation_unit_decl_tree_pointers): ... here. Remove.
(streamer_pack_tree_bitfields): Adjust.
(streamer_write_tree_body): Likewise.
* tree-streamer-in.c (unpack_ts_translation_unit_decl_value_fields):
Unpack TRANSLATION_UNIT_LANGUAGE here, not ...
(lto_input_ts_translation_unit_decl_tree_pointers): ... here. Remove.
(unpack_value_fields): Adjust.
(streamer_read_tree_body): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/data-streamer-in.c')
-rw-r--r-- | gcc/data-streamer-in.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c index 72fce0598a7..bcd6c08a691 100644 --- a/gcc/data-streamer-in.c +++ b/gcc/data-streamer-in.c @@ -86,6 +86,35 @@ streamer_read_string (struct data_in *data_in, struct lto_input_block *ib) } +/* Read a string from the string table in DATA_IN using the bitpack BP. + Write the length to RLEN. */ + +const char * +bp_unpack_indexed_string (struct data_in *data_in, + struct bitpack_d *bp, unsigned int *rlen) +{ + return string_for_index (data_in, bp_unpack_var_len_unsigned (bp), rlen); +} + + +/* Read a NULL terminated string from the string table in DATA_IN. */ + +const char * +bp_unpack_string (struct data_in *data_in, struct bitpack_d *bp) +{ + unsigned int len; + const char *ptr; + + ptr = bp_unpack_indexed_string (data_in, bp, &len); + if (!ptr) + return NULL; + if (ptr[len - 1] != '\0') + internal_error ("bytecode stream: found non-null terminated string"); + + return ptr; +} + + /* Read an unsigned HOST_WIDE_INT number from IB. */ unsigned HOST_WIDE_INT |