• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class read_context;
30 
31 translation_unit_sptr
32 read_translation_unit_from_file(const std::string&	file_path,
33 				environment*		env);
34 
35 translation_unit_sptr
36 read_translation_unit_from_buffer(const std::string&	file_path,
37 				  environment*		env);
38 
39 translation_unit_sptr
40 read_translation_unit_from_istream(std::istream*	in,
41 				   environment*	env);
42 
43 translation_unit_sptr
44 read_translation_unit(read_context&);
45 
46 /// A convenience typedef for a shared pointer to read_context.
47 typedef shared_ptr<read_context> read_context_sptr;
48 
49 read_context_sptr
50 create_native_xml_read_context(const string& path, environment *env);
51 
52 read_context_sptr
53 create_native_xml_read_context(std::istream* in, environment* env);
54 
55 const string&
56 read_context_get_path(const read_context&);
57 
58 corpus_sptr
59 read_corpus_from_native_xml(std::istream* in,
60 			    environment*  env);
61 
62 corpus_sptr
63 read_corpus_from_native_xml_file(const string& path,
64 				 environment*  env);
65 
66 corpus_sptr
67 read_corpus_from_input(read_context& ctxt);
68 
69 corpus_group_sptr
70 read_corpus_group_from_input(read_context& ctxt);
71 
72 corpus_group_sptr
73 read_corpus_group_from_native_xml(std::istream* in,
74 				  environment*  env);
75 
76 corpus_group_sptr
77 read_corpus_group_from_native_xml_file(const string& path,
78 				       environment*  env);
79 
80 void
81 add_read_context_suppressions(read_context& ctxt,
82 			      const suppr::suppressions_type& supprs);
83 
84 void
85 consider_types_not_reachable_from_public_interfaces(read_context& ctxt,
86 						    bool flag);
87 
88 #ifdef WITH_SHOW_TYPE_USE_IN_ABILINT
89 vector<type_base_sptr>*
90 get_types_from_type_id(read_context&, const string&);
91 
92 unordered_map<type_or_decl_base*, vector<type_or_decl_base*>>*
93 get_artifact_used_by_relation_map(read_context&);
94 #endif
95 }//end xml_reader
96 
97 #ifdef WITH_DEBUG_SELF_COMPARISON
98 bool
99 load_canonical_type_ids(xml_reader::read_context& ctxt,
100 			const string& file_path);
101 #endif
102 }//end namespace abigail
103 
104 #endif // __ABG_READER_H__
105