Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
// -*- Mode: C++ -*-
|
|
|
|
//
|
2020-02-21 15:42:35 +00:00
|
|
|
// Copyright (C) 2013-2020 Red Hat, Inc.
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
//
|
|
|
|
// This file is part of the GNU Application Binary Interface Generic
|
|
|
|
// Analysis and Instrumentation Library (libabigail). This library is
|
|
|
|
// free software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU Lesser General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option) any
|
|
|
|
// later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Lesser Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; see the file COPYING-LGPLV3. If
|
|
|
|
// not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
// Author: Dodji Seketeli
|
|
|
|
|
|
|
|
/// @file
|
|
|
|
///
|
|
|
|
/// This file contains the declarations of the entry points to
|
2014-01-17 14:42:47 +00:00
|
|
|
/// de-serialize an instance of @ref abigail::translation_unit to an
|
|
|
|
/// ABI Instrumentation file in libabigail native XML format.
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
|
|
|
|
#ifndef __ABG_WRITER_H__
|
|
|
|
#define __ABG_WRITER_H__
|
|
|
|
|
2019-05-21 04:39:15 +00:00
|
|
|
#include "abg-fwd.h"
|
|
|
|
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
namespace abigail
|
|
|
|
{
|
|
|
|
namespace xml_writer
|
|
|
|
{
|
2014-10-11 09:27:59 +00:00
|
|
|
|
|
|
|
using namespace abigail::ir;
|
|
|
|
|
2020-06-15 21:07:41 +00:00
|
|
|
/// The style of type id the XML writer will output.
|
|
|
|
enum type_id_style_kind
|
|
|
|
{
|
|
|
|
SEQUENCE_TYPE_ID_STYLE,
|
|
|
|
HASH_TYPE_ID_STYLE
|
|
|
|
};
|
|
|
|
|
2017-01-17 18:41:51 +00:00
|
|
|
class write_context;
|
|
|
|
|
|
|
|
/// A convenience typedef for a shared pointer to write_context.
|
|
|
|
typedef shared_ptr<write_context> write_context_sptr;
|
|
|
|
|
Allow setting options to instances of xml_writer::write_context
Up to know, it wasn't possible to set options to instances of
xml_writer::write_context. So it wasn't possible to, say, make abidw
stop emitting source locations in the abixml.
This patch does the work necessary to set two options: annotate and
show locations. Note that the patch doesn't yet enable abidw to stop
emitting source locations. That will be done in a subsequent patch.
* include/abg-writer.h (create_write_context, set_show_locs)
(set_annotate): Declare new functions.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context.
* src/abg-writer.cc (write_context::m_show_locs): New data member.
(write_context::write_context): Initialize it.
(write_context::{get_show_locs, set_show_locs}): Add new member
functions.
(write_location): Take a write_context, rather than an output
stream. From the context, we detect if the user did set the "show
loc" option and act accordingly. Write the second overload in
terms of the first one.
(create_write_context, set_show_locs, set_annotate): Define new
functions.
(write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_array_type_def, write_enum_type_decl, write_typedef_decl)
(write_var_decl, write_function_decl)
(write_class_decl_opening_tag, write_union_decl_opening_tag)
(write_type_tparameter, write_non_type_tparameter)
(write_function_tdecl, write_class_tdecl): Adjust the invocation
of write_location.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context. Adjust.
* tools/abidw.c: (load_corpus_and_write_abixml): Create a
write_context object, set the 'annotate' option to it and use that
object to actually write out the corpus.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-11-02 08:52:58 +00:00
|
|
|
write_context_sptr
|
|
|
|
create_write_context(const environment *env,
|
|
|
|
ostream& output_stream);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_show_locs(write_context& ctxt, bool flag);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_annotate(write_context& ctxt, bool flag);
|
|
|
|
|
Make write_architecture and write_corpus_path flags in the write_context
Having write_context carry corresponding flags for output sensitive
command line options, is useful to ensure these options are not lost in
chains for write_* calls. In particular, these options can have various
meanings depending on the context (corpus, corpus_group, etc.)
Hence add them to the write_context along with getters and setters and
make the writers aware of their existence. We do not need to modify the
corpus or corpus group's path or architecture any longer as they get
ignored for a different reason now.
Finally, drop the flag handling in abidw as it is already done via
set_opts, which learned about these new flags.
* include/abg-writer.h (set_write_architecture)
(set_write_corpus_path): Declare new getter functions.
(write_corpus): Take a new "member_of_group" argument.
(set_common_options): Use set_write_{architecture, corpus_path}
here.
* src/abg-writer.cc (write_context::m_write_{architecture,
corpus_path}}): Add new data members.
(write_context::write_context): Initialize the new data members.
(write_context::{s,g}et_write_{architecture, corpus}): Define new
accessors.
(set_write_{architecture, corpus}): Define new free-form getter
functions.
(write_corpus): Add flag to make aware if written as part of a
group.
* tools/abidw.cc (load_corpus_and_write_abixml)
(load_kernel_corpus_group_and_write_abixml): Drop obsolete option
handling as xml_writer::set_common_options now takes care of it.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
ldiff --git a/include/abg-writer.h b/include/abg-writer.h
index 200b5f7..729b455 100644
--- a/include/abg-writer.h
+++ b/include/abg-writer.h
@@ -53,6 +53,11 @@ set_show_locs(write_context& ctxt, bool flag);
void
set_annotate(write_context& ctxt, bool flag);
+void
+set_write_architecture(write_context& ctxt, bool flag);
+
+void
+set_write_corpus_path(write_context& ctxt, bool flag);
/// A convenience generic function to set common options (usually used
/// by Libabigail tools) from a generic options carrying-object, into
@@ -69,6 +74,8 @@ set_common_options(write_context& ctxt, const OPTS& opts)
{
set_annotate(ctxt, opts.annotate);
set_show_locs(ctxt, opts.show_locs);
+ set_write_architecture(ctxt, opts.write_architecture);
+ set_write_corpus_path(ctxt, opts.write_corpus_path);
}
void
@@ -105,7 +112,10 @@ write_corpus_to_archive(const corpus_sptr corp,
const bool annotate = false);
bool
-write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent);
+write_corpus(write_context& ctxt,
+ const corpus_sptr& corpus,
+ unsigned indent,
+ bool member_of_group = false);
bool ABG_DEPRECATED
write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt);
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-05-21 04:39:20 +00:00
|
|
|
void
|
|
|
|
set_write_architecture(write_context& ctxt, bool flag);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_write_corpus_path(write_context& ctxt, bool flag);
|
2019-05-21 04:39:19 +00:00
|
|
|
|
2019-05-21 04:39:21 +00:00
|
|
|
void
|
|
|
|
set_write_comp_dir(write_context& ctxt, bool flag);
|
|
|
|
|
2020-04-24 13:56:41 +00:00
|
|
|
void
|
|
|
|
set_write_elf_needed(write_context& ctxt, bool flag);
|
|
|
|
|
2020-04-26 23:28:52 +00:00
|
|
|
void
|
|
|
|
set_write_default_sizes(write_context& ctxt, bool flag);
|
|
|
|
|
2019-05-21 04:39:22 +00:00
|
|
|
void
|
|
|
|
set_short_locs(write_context& ctxt, bool flag);
|
|
|
|
|
2020-04-21 12:28:19 +00:00
|
|
|
void
|
|
|
|
set_write_parameter_names(write_context& ctxt, bool flag);
|
|
|
|
|
2020-06-15 21:07:41 +00:00
|
|
|
void
|
|
|
|
set_type_id_style(write_context& ctxt, type_id_style_kind style);
|
|
|
|
|
2019-05-21 04:39:19 +00:00
|
|
|
/// A convenience generic function to set common options (usually used
|
|
|
|
/// by Libabigail tools) from a generic options carrying-object, into
|
|
|
|
/// a given @ref write_context.
|
|
|
|
///
|
|
|
|
/// @param ctxt the @ref the write_context to consider.
|
|
|
|
///
|
|
|
|
/// @param opts the option-carrying object to set the options from.
|
|
|
|
/// It must contain data members named: annotate, and show_locs, at
|
|
|
|
/// very least.
|
|
|
|
template <typename OPTS>
|
|
|
|
void
|
|
|
|
set_common_options(write_context& ctxt, const OPTS& opts)
|
|
|
|
{
|
|
|
|
set_annotate(ctxt, opts.annotate);
|
|
|
|
set_show_locs(ctxt, opts.show_locs);
|
Make write_architecture and write_corpus_path flags in the write_context
Having write_context carry corresponding flags for output sensitive
command line options, is useful to ensure these options are not lost in
chains for write_* calls. In particular, these options can have various
meanings depending on the context (corpus, corpus_group, etc.)
Hence add them to the write_context along with getters and setters and
make the writers aware of their existence. We do not need to modify the
corpus or corpus group's path or architecture any longer as they get
ignored for a different reason now.
Finally, drop the flag handling in abidw as it is already done via
set_opts, which learned about these new flags.
* include/abg-writer.h (set_write_architecture)
(set_write_corpus_path): Declare new getter functions.
(write_corpus): Take a new "member_of_group" argument.
(set_common_options): Use set_write_{architecture, corpus_path}
here.
* src/abg-writer.cc (write_context::m_write_{architecture,
corpus_path}}): Add new data members.
(write_context::write_context): Initialize the new data members.
(write_context::{s,g}et_write_{architecture, corpus}): Define new
accessors.
(set_write_{architecture, corpus}): Define new free-form getter
functions.
(write_corpus): Add flag to make aware if written as part of a
group.
* tools/abidw.cc (load_corpus_and_write_abixml)
(load_kernel_corpus_group_and_write_abixml): Drop obsolete option
handling as xml_writer::set_common_options now takes care of it.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
ldiff --git a/include/abg-writer.h b/include/abg-writer.h
index 200b5f7..729b455 100644
--- a/include/abg-writer.h
+++ b/include/abg-writer.h
@@ -53,6 +53,11 @@ set_show_locs(write_context& ctxt, bool flag);
void
set_annotate(write_context& ctxt, bool flag);
+void
+set_write_architecture(write_context& ctxt, bool flag);
+
+void
+set_write_corpus_path(write_context& ctxt, bool flag);
/// A convenience generic function to set common options (usually used
/// by Libabigail tools) from a generic options carrying-object, into
@@ -69,6 +74,8 @@ set_common_options(write_context& ctxt, const OPTS& opts)
{
set_annotate(ctxt, opts.annotate);
set_show_locs(ctxt, opts.show_locs);
+ set_write_architecture(ctxt, opts.write_architecture);
+ set_write_corpus_path(ctxt, opts.write_corpus_path);
}
void
@@ -105,7 +112,10 @@ write_corpus_to_archive(const corpus_sptr corp,
const bool annotate = false);
bool
-write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent);
+write_corpus(write_context& ctxt,
+ const corpus_sptr& corpus,
+ unsigned indent,
+ bool member_of_group = false);
bool ABG_DEPRECATED
write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt);
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-05-21 04:39:20 +00:00
|
|
|
set_write_architecture(ctxt, opts.write_architecture);
|
|
|
|
set_write_corpus_path(ctxt, opts.write_corpus_path);
|
2019-05-21 04:39:21 +00:00
|
|
|
set_write_comp_dir(ctxt, opts.write_comp_dir);
|
2020-04-24 13:56:41 +00:00
|
|
|
set_write_elf_needed(ctxt, opts.write_elf_needed);
|
2020-04-21 12:28:19 +00:00
|
|
|
set_write_parameter_names(ctxt, opts.write_parameter_names);
|
2019-05-21 04:39:22 +00:00
|
|
|
set_short_locs(ctxt, opts.short_locs);
|
2020-04-26 23:28:52 +00:00
|
|
|
set_write_default_sizes(ctxt, opts.default_sizes);
|
2020-06-15 21:07:41 +00:00
|
|
|
set_type_id_style(ctxt, opts.type_id_style);
|
2019-05-21 04:39:19 +00:00
|
|
|
}
|
|
|
|
|
2019-05-21 04:39:18 +00:00
|
|
|
void
|
|
|
|
set_ostream(write_context& ctxt, ostream& os);
|
|
|
|
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
bool
|
2019-05-21 04:39:15 +00:00
|
|
|
write_translation_unit(write_context& ctxt,
|
|
|
|
const translation_unit& tu,
|
|
|
|
const unsigned indent);
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
write_corpus_to_archive(const corpus& corp,
|
2017-01-17 18:41:51 +00:00
|
|
|
const string& path,
|
|
|
|
const bool annotate = false);
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
|
|
|
|
bool
|
2017-01-17 18:41:51 +00:00
|
|
|
write_corpus_to_archive(const corpus& corp,
|
|
|
|
const bool annotate = false);
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
|
|
|
|
bool
|
2017-01-17 18:41:51 +00:00
|
|
|
write_corpus_to_archive(const corpus_sptr corp,
|
|
|
|
const bool annotate = false);
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
|
2017-04-06 10:00:51 +00:00
|
|
|
bool
|
Make write_architecture and write_corpus_path flags in the write_context
Having write_context carry corresponding flags for output sensitive
command line options, is useful to ensure these options are not lost in
chains for write_* calls. In particular, these options can have various
meanings depending on the context (corpus, corpus_group, etc.)
Hence add them to the write_context along with getters and setters and
make the writers aware of their existence. We do not need to modify the
corpus or corpus group's path or architecture any longer as they get
ignored for a different reason now.
Finally, drop the flag handling in abidw as it is already done via
set_opts, which learned about these new flags.
* include/abg-writer.h (set_write_architecture)
(set_write_corpus_path): Declare new getter functions.
(write_corpus): Take a new "member_of_group" argument.
(set_common_options): Use set_write_{architecture, corpus_path}
here.
* src/abg-writer.cc (write_context::m_write_{architecture,
corpus_path}}): Add new data members.
(write_context::write_context): Initialize the new data members.
(write_context::{s,g}et_write_{architecture, corpus}): Define new
accessors.
(set_write_{architecture, corpus}): Define new free-form getter
functions.
(write_corpus): Add flag to make aware if written as part of a
group.
* tools/abidw.cc (load_corpus_and_write_abixml)
(load_kernel_corpus_group_and_write_abixml): Drop obsolete option
handling as xml_writer::set_common_options now takes care of it.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
ldiff --git a/include/abg-writer.h b/include/abg-writer.h
index 200b5f7..729b455 100644
--- a/include/abg-writer.h
+++ b/include/abg-writer.h
@@ -53,6 +53,11 @@ set_show_locs(write_context& ctxt, bool flag);
void
set_annotate(write_context& ctxt, bool flag);
+void
+set_write_architecture(write_context& ctxt, bool flag);
+
+void
+set_write_corpus_path(write_context& ctxt, bool flag);
/// A convenience generic function to set common options (usually used
/// by Libabigail tools) from a generic options carrying-object, into
@@ -69,6 +74,8 @@ set_common_options(write_context& ctxt, const OPTS& opts)
{
set_annotate(ctxt, opts.annotate);
set_show_locs(ctxt, opts.show_locs);
+ set_write_architecture(ctxt, opts.write_architecture);
+ set_write_corpus_path(ctxt, opts.write_corpus_path);
}
void
@@ -105,7 +112,10 @@ write_corpus_to_archive(const corpus_sptr corp,
const bool annotate = false);
bool
-write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent);
+write_corpus(write_context& ctxt,
+ const corpus_sptr& corpus,
+ unsigned indent,
+ bool member_of_group = false);
bool ABG_DEPRECATED
write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt);
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-05-21 04:39:20 +00:00
|
|
|
write_corpus(write_context& ctxt,
|
|
|
|
const corpus_sptr& corpus,
|
|
|
|
unsigned indent,
|
|
|
|
bool member_of_group = false);
|
2017-04-06 10:00:51 +00:00
|
|
|
|
|
|
|
bool
|
2019-05-21 04:39:17 +00:00
|
|
|
write_corpus_group(write_context& ctx,
|
|
|
|
const corpus_group_sptr& group,
|
|
|
|
unsigned indent);
|
2017-04-06 10:00:51 +00:00
|
|
|
|
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
|
|
|
}// end namespace xml_writer
|
|
|
|
}// end namespace abigail
|
|
|
|
|
|
|
|
#endif // __ABG_WRITER_H__
|