1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2021 Red Hat, Inc.
5 //
6 // Author: Dodji Seketeli
7 
8 /// @file
9 ///
10 /// This file contains the declarations of the entry points to
11 /// de-serialize an instance of @ref abigail::translation_unit from an
12 /// ABI Instrumentation file in libabigail native XML format.
13 
14 #ifndef __ABG_READER_H__
15 #define __ABG_READER_H__
16 
17 #include <istream>
18 #include "abg-corpus.h"
19 #include "abg-suppression.h"
20 
21 namespace abigail
22 {
23 
24 namespace xml_reader
25 {
26 
27 using namespace abigail::ir;
28 
29 translation_unit_sptr
30 read_translation_unit_from_file(const std::string&	file_path,
31 				environment*		env);
32 
33 translation_unit_sptr
34 read_translation_unit_from_buffer(const std::string&	file_path,
35 				  environment*		env);
36 
37 translation_unit_sptr
38 read_translation_unit_from_istream(std::istream*	in,
39 				   environment*	env);
40 
41 class read_context;
42 
43 /// A convenience typedef for a shared pointer to read_context.
44 typedef shared_ptr<read_context> read_context_sptr;
45 
46 read_context_sptr
47 create_native_xml_read_context(const string& path, environment *env);
48 
49 read_context_sptr
50 create_native_xml_read_context(std::istream* in, environment* env);
51 
52 const string&
53 read_context_get_path(const read_context&);
54 
55 corpus_sptr
56 read_corpus_from_native_xml(std::istream* in,
57 			    environment*  env);
58 
59 corpus_sptr
60 read_corpus_from_native_xml_file(const string& path,
61 				 environment*  env);
62 
63 corpus_sptr
64 read_corpus_from_input(read_context& ctxt);
65 
66 corpus_group_sptr
67 read_corpus_group_from_input(read_context& ctxt);
68 
69 corpus_group_sptr
70 read_corpus_group_from_native_xml(std::istream* in,
71 				  environment*  env);
72 
73 corpus_group_sptr
74 read_corpus_group_from_native_xml_file(const string& path,
75 				       environment*  env);
76 
77 void
78 add_read_context_suppressions(read_context& ctxt,
79 			      const suppr::suppressions_type& supprs);
80 
81 void
82 consider_types_not_reachable_from_public_interfaces(read_context& ctxt,
83 						    bool flag);
84 }//end xml_reader
85 }//end namespace abigail
86 
87 #endif // __ABG_READER_H__
88