• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2020 Red Hat, Inc.
5 
6 /// @file
7 
8 #ifndef __ABG_IRFWD_H__
9 #define __ABG_IRFWD_H__
10 
11 #include <stdint.h>
12 #include <cstddef>
13 #include <cstdlib>
14 #include <list>
15 #include <memory>
16 #include <ostream>
17 #include <string>
18 #include <typeinfo>
19 #include <unordered_map>
20 #include <utility> // for std::rel_ops, at least.
21 #include <vector>
22 #include "abg-interned-str.h"
23 #include "abg-hash.h"
24 
25 /// Toplevel namespace for libabigail.
26 namespace abigail
27 {
28 /**
29    @mainpage libabigail
30 
31    This is the API documentation of the Application Binary
32    Interface Generic Analysis and Instrumentation Library, aka,
33    <em>libabigail</em>.
34 
35    Check out <a href="http://sourceware.org/libabigail"> the project
36    homepage</a>!
37 
38    The current libabigail source code can be browsed at
39    http://sourceware.org/git/gitweb.cgi?p=libabigail.git
40 
41    It can be checked out with:
42        <em>git clone git://sourceware.org/git/libabigail.git</em>
43 
44    The mailing list to send messages and patches to is
45    libabigail@sourceware.org.
46 
47    You can hang out with libabigail developers and users on irc at
48    irc://irc.oftc.net\#libabigail.
49 */
50 
51 // Inject some types.
52 using std::shared_ptr;
53 using std::weak_ptr;
54 using std::unordered_map;
55 using std::string;
56 using std::vector;
57 
58 // Pull in relational operators.
59 using namespace std::rel_ops;
60 
61 namespace ir
62 {
63 
64 // Forward declarations for corpus.
65 
66 class corpus;
67 typedef shared_ptr<corpus> corpus_sptr;
68 
69 class corpus_group;
70 typedef shared_ptr<corpus_group> corpus_group_sptr;
71 
72 // Forward declarations for ir.
73 
74 class  ir_node_visitor;
75 
76 struct ir_traversable_base;
77 
78 /// Convenience typedef for a shared pointer to @ref
79 /// ir_traversable_base.
80 typedef shared_ptr<ir_traversable_base> ir_traversable_base_sptr;
81 
82 class environment;
83 /// Convenience typedef for a shared pointer to an @ref environment
84 typedef shared_ptr<environment> environment_sptr;
85 
86 class location;
87 class location_manager;
88 
89 class type_or_decl_base;
90 /// A convenience typedef for a shared_ptr to @ref type_or_decl_base.
91 typedef shared_ptr<type_or_decl_base> type_or_decl_base_sptr;
92 
93 class type_base;
94 
95 // Convenience typedef for a shared pointer on a @ref type_base
96 typedef shared_ptr<type_base> type_base_sptr;
97 
98 /// Convenience typedef for a weak pointer on a @ref type_base
99 typedef weak_ptr<type_base> type_base_wptr;
100 
101 /// Convenience typedef for a weak pointer to a @ref corpus.
102 typedef weak_ptr<corpus> corpus_wptr;
103 
104 class translation_unit;
105 /// Convenience typedef for a shared pointer on a @ref
106 /// translation_unit type.
107 typedef shared_ptr<translation_unit> translation_unit_sptr;
108 /// Convenience typedef for a map that associates a string to a
109 /// translation unit.
110 typedef unordered_map<string, translation_unit_sptr> string_tu_map_type;
111 
112 /// A convenience typedef for a vector of type_base_wptr.
113 typedef vector<type_base_wptr> type_base_wptrs_type;
114 
115 /// A convenience typedef for a map which key is an interned_string
116 /// and which value is a vector of type_base_wptr.
117 typedef unordered_map<interned_string,
118 		      type_base_wptrs_type,
119 		      hash_interned_string> istring_type_base_wptrs_map_type;
120 
121 class decl_base;
122 
123 // Convenience typedef for a smart pointer on @ref decl_base.
124 typedef shared_ptr<decl_base> decl_base_sptr;
125 
126 class type_decl;
127 /// Convenience typedef for a shared pointer on a @ref type_decl.
128 typedef shared_ptr<type_decl> type_decl_sptr;
129 
130 
131 class typedef_decl;
132 
133 /// Convenience typedef for a shared pointer on a @ref typedef_decl.
134 typedef shared_ptr<typedef_decl> typedef_decl_sptr;
135 
136 /// Convenience typedef for a weak pointer on a @ref typedef_decl.
137 typedef weak_ptr<typedef_decl> typedef_decl_wptr;
138 
139 class enum_type_decl;
140 
141 /// Convenience typedef for shared pointer to a @ref enum_type_decl.
142 typedef shared_ptr<enum_type_decl> enum_type_decl_sptr;
143 
144 /// Convenience typedef for a vector of @ref enum_type_decl_sptr
145 typedef vector<enum_type_decl_sptr> enums_type;
146 
147 /// Convenience typedef for a weak pointer to a @ref decl_base.
148 typedef weak_ptr<decl_base> decl_base_wptr;
149 
150 class class_or_union;
151 
152 typedef shared_ptr<class_or_union> class_or_union_sptr;
153 typedef weak_ptr<class_or_union> class_or_union_wptr;
154 
155 class scope_type_decl;
156 
157 class class_decl;
158 
159 /// Convenience typedef for a shared pointer on a @ref class_decl
160 typedef shared_ptr<class_decl> class_decl_sptr;
161 
162 /// Convenience typedef for a vector of @ref class_decl_sptr
163 typedef vector<class_decl_sptr> classes_type;
164 
165 /// Convenience typedef for a weak pointer on a @ref class_decl.
166 typedef weak_ptr<class_decl> class_decl_wptr;
167 
168 class union_decl;
169 
170 typedef shared_ptr<union_decl> union_decl_sptr;
171 
172 class function_type;
173 /// Convenience typedef for a shared pointer on a @ref function_type
174 typedef shared_ptr<function_type> function_type_sptr;
175 
176 /// Convenience typedef fo a vector of @ref function_type_sptr
177 typedef vector<function_type_sptr> function_types_type;
178 
179 /// Convenience typedef for a weak pointer on a @ref function_type
180 typedef weak_ptr<function_type> function_type_wptr;
181 
182 class method_type;
183 
184 /// Convenience typedef for shared pointer to @ref method_type.
185 typedef shared_ptr<method_type> method_type_sptr;
186 
187 class pointer_type_def;
188 
189 /// Convenience typedef for a shared pointer on a @ref pointer_type_def
190 typedef shared_ptr<pointer_type_def> pointer_type_def_sptr;
191 
192 class qualified_type_def;
193 
194 typedef shared_ptr<qualified_type_def> qualified_type_def_sptr;
195 
196 class reference_type_def;
197 
198 /// Convenience typedef for a shared pointer on a @ref reference_type_def
199 typedef shared_ptr<reference_type_def> reference_type_def_sptr;
200 
201 class array_type_def;
202 
203 /// Convenience typedef for a shared pointer on a @ref array_type_def
204 typedef shared_ptr<array_type_def> array_type_def_sptr;
205 
206 class subrange_type;
207 
208 class dm_context_rel;
209 
210 /// A convenience typedef for a shared pointer to dm_context_rel.
211 typedef shared_ptr<dm_context_rel> dm_context_rel_sptr;
212 
213 class var_decl;
214 
215 /// Convenience typedef for a shared pointer on a @ref var_decl
216 typedef shared_ptr<var_decl> var_decl_sptr;
217 
218 /// Convenience typedef for a weak pointer on a @ref var_decl
219 typedef weak_ptr<var_decl> var_decl_wptr;
220 
221 typedef unordered_map<interned_string,
222 		      var_decl*,
223 		      hash_interned_string> istring_var_decl_ptr_map_type;
224 
225 class scope_decl;
226 
227 /// Convenience typedef for a shared pointer on a @ref scope_decl.
228 typedef shared_ptr<scope_decl> scope_decl_sptr;
229 
230 class function_decl;
231 
232 /// Convenience typedef for a shared pointer on a @ref function_decl
233 typedef shared_ptr<function_decl> function_decl_sptr;
234 
235 typedef unordered_map<interned_string,
236 		      function_decl*,
237 		      hash_interned_string> istring_function_decl_ptr_map_type;
238 
239 class method_decl;
240 
241 typedef shared_ptr<method_decl> method_decl_sptr;
242 
243 class mem_fn_context_rel;
244 
245 /// A convenience typedef for a shared pointer to @ref
246 /// mem_fn_context_rel.
247 typedef shared_ptr<mem_fn_context_rel> mem_fn_context_rel_sptr;
248 
249 class namespace_decl;
250 
251 /// Convenience typedef for a shared pointer on namespace_decl.
252 typedef shared_ptr<namespace_decl> namespace_decl_sptr;
253 
254 class class_tdecl;
255 
256 /// Convenience typedef for a shared pointer on a @ref class_tdecl
257 typedef shared_ptr<class_tdecl> class_tdecl_sptr;
258 
259 class function_tdecl;
260 
261 /// Convenience typedef for a shared pointer on a @ref function_tdecl
262 typedef shared_ptr<function_tdecl> function_tdecl_sptr;
263 
264 class global_scope;
265 
266 /// Convenience typedef for shared pointer on @ref global_scope.
267 typedef shared_ptr<global_scope> global_scope_sptr;
268 
269 class node_visitor;
270 
271 class template_decl;
272 
273 /// Convenience typedef for a shared pointer to @ref template_decl
274 typedef shared_ptr<template_decl> template_decl_sptr;
275 
276 /// Convenience typedef for a weak pointer to template_decl
277 typedef weak_ptr<template_decl> template_decl_wptr;
278 
279 class template_parameter;
280 
281 /// Convenience typedef for shared pointer to template parameter
282 typedef shared_ptr<template_parameter> template_parameter_sptr;
283 
284 class non_type_tparameter;
285 
286 /// Convenience typedef for shared pointer to @ref
287 /// non_type_template_parameter
288 typedef shared_ptr<non_type_tparameter> non_type_tparameter_sptr;
289 
290 class type_tparameter;
291 
292 class template_tparameter;
293 
294 /// Convenience typedef for a shared_ptr to @ref template_tparameter.
295 typedef shared_ptr<template_tparameter> template_tparameter_sptr;
296 
297 /// Convenience typedef for a shared pointer to @ref type_tparameter.
298 typedef shared_ptr<type_tparameter> type_tparameter_sptr;
299 
300 class type_composition;
301 
302 class member_function_template;
303 typedef shared_ptr<member_function_template> member_function_template_sptr;
304 typedef vector<member_function_template_sptr> member_function_templates;
305 
306 class member_class_template;
307 typedef shared_ptr<member_class_template> member_class_template_sptr;
308 typedef vector<member_class_template_sptr> member_class_templates;
309 
310 /// Convenience typedef for shared pointer to type_composition
311 typedef shared_ptr<type_composition> type_composition_sptr;
312 
313 decl_base_sptr
314 add_decl_to_scope(decl_base_sptr, scope_decl*);
315 
316 decl_base_sptr
317 add_decl_to_scope(decl_base_sptr, const scope_decl_sptr&);
318 
319 const global_scope*
320 get_global_scope(const decl_base&);
321 
322 const global_scope*
323 get_global_scope(const decl_base*);
324 
325 const global_scope*
326 get_global_scope(const decl_base_sptr);
327 
328 translation_unit*
329 get_translation_unit(const decl_base&);
330 
331 translation_unit*
332 get_translation_unit(const decl_base*);
333 
334 translation_unit*
335 get_translation_unit(const decl_base_sptr);
336 
337 bool
338 is_global_scope(const scope_decl&);
339 
340 const global_scope*
341 is_global_scope(const scope_decl*);
342 
343 bool
344 is_global_scope(const scope_decl_sptr);
345 
346 bool
347 is_at_global_scope(const decl_base&);
348 
349 bool
350 is_at_global_scope(const decl_base_sptr);
351 
352 class_or_union*
353 is_at_class_scope(const decl_base_sptr);
354 
355 class_or_union*
356 is_at_class_scope(const decl_base*);
357 
358 class_or_union*
359 is_at_class_scope(const decl_base&);
360 
361 bool
362 is_at_template_scope(const decl_base_sptr);
363 
364 bool
365 is_template_parameter(const decl_base_sptr);
366 
367 function_decl*
368 is_function_decl(const type_or_decl_base*);
369 
370 function_decl_sptr
371 is_function_decl(const type_or_decl_base_sptr&);
372 
373 bool
374 is_function_decl(const type_or_decl_base&);
375 
376 decl_base*
377 is_decl(const type_or_decl_base*);
378 
379 decl_base_sptr
380 is_decl(const type_or_decl_base_sptr&);
381 
382 decl_base*
383 is_decl_slow(const type_or_decl_base*);
384 
385 decl_base_sptr
386 is_decl_slow(const type_or_decl_base_sptr&);
387 
388 bool
389 is_type(const type_or_decl_base&);
390 
391 type_base*
392 is_type(const type_or_decl_base*);
393 
394 type_base_sptr
395 is_type(const type_or_decl_base_sptr& tod);
396 
397 bool
398 is_anonymous_type(const type_base*);
399 
400 bool
401 is_anonymous_type(const type_base_sptr&);
402 
403 const type_decl*
404 is_type_decl(const type_or_decl_base*);
405 
406 type_decl_sptr
407 is_type_decl(const type_or_decl_base_sptr&);
408 
409 typedef_decl_sptr
410 is_typedef(const type_or_decl_base_sptr);
411 
412 const typedef_decl*
413 is_typedef(const type_base*);
414 
415 typedef_decl*
416 is_typedef(type_base*);
417 
418 enum_type_decl_sptr
419 is_compatible_with_enum_type(const type_base_sptr&);
420 
421 enum_type_decl_sptr
422 is_compatible_with_enum_type(const decl_base_sptr&);
423 
424 enum_type_decl_sptr
425 is_enum_type(const type_or_decl_base_sptr&);
426 
427 const enum_type_decl*
428 is_enum_type(const type_or_decl_base*);
429 
430 bool
431 is_class_type(const type_or_decl_base&);
432 
433 class_decl*
434 is_class_type(const type_or_decl_base*);
435 
436 class_decl_sptr
437 is_class_type(const type_or_decl_base_sptr&);
438 
439 bool
440 is_declaration_only_class_or_union_type(const type_base *t);
441 
442 bool
443 is_declaration_only_class_or_union_type(const type_base_sptr&);
444 
445 class_or_union*
446 is_class_or_union_type(const type_or_decl_base*);
447 
448 class_or_union_sptr
449 is_class_or_union_type(const type_or_decl_base_sptr&);
450 
451 bool
452 is_union_type(const type_or_decl_base&);
453 
454 union_decl*
455 is_union_type(const type_or_decl_base*);
456 
457 union_decl_sptr
458 is_union_type(const type_or_decl_base_sptr&);
459 
460 class_decl_sptr
461 is_compatible_with_class_type(const type_base_sptr&);
462 
463 class_decl_sptr
464 is_compatible_with_class_type(const decl_base_sptr&);
465 
466 pointer_type_def*
467 is_pointer_type(type_or_decl_base*);
468 
469 const pointer_type_def*
470 is_pointer_type(const type_or_decl_base*);
471 
472 pointer_type_def_sptr
473 is_pointer_type(const type_or_decl_base_sptr&);
474 
475 reference_type_def*
476 is_reference_type(type_or_decl_base*);
477 
478 const reference_type_def*
479 is_reference_type(const type_or_decl_base*);
480 
481 reference_type_def_sptr
482 is_reference_type(const type_or_decl_base_sptr&);
483 
484 const type_base*
485 is_void_pointer_type(const type_base*);
486 
487 qualified_type_def*
488 is_qualified_type(const type_or_decl_base*);
489 
490 qualified_type_def_sptr
491 is_qualified_type(const type_or_decl_base_sptr&);
492 
493 function_type_sptr
494 is_function_type(const type_or_decl_base_sptr&);
495 
496 function_type*
497 is_function_type(type_or_decl_base*);
498 
499 const function_type*
500 is_function_type(const type_or_decl_base*);
501 
502 method_type_sptr
503 is_method_type(const type_or_decl_base_sptr&);
504 
505 const method_type*
506 is_method_type(const type_or_decl_base*);
507 
508 method_type*
509 is_method_type(type_or_decl_base*);
510 
511 class_or_union_sptr
512 look_through_decl_only_class(class_or_union_sptr);
513 
514 class_or_union*
515 look_through_decl_only_class(class_or_union*);
516 
517 enum_type_decl_sptr
518 look_through_decl_only_enum(enum_type_decl_sptr);
519 
520 decl_base*
521 look_through_decl_only(decl_base*);
522 
523 decl_base_sptr
524 look_through_decl_only(decl_base_sptr);
525 
526 var_decl*
527 is_var_decl(const type_or_decl_base*);
528 
529 var_decl_sptr
530 is_var_decl(const type_or_decl_base_sptr&);
531 
532 namespace_decl_sptr
533 is_namespace(const decl_base_sptr&);
534 
535 namespace_decl*
536 is_namespace(const decl_base*);
537 
538 bool
539 is_template_parm_composition_type(const decl_base_sptr);
540 
541 bool
542 is_template_decl(const decl_base_sptr);
543 
544 bool
545 is_function_template_pattern(const decl_base_sptr);
546 
547 
548 decl_base_sptr
549 insert_decl_into_scope(decl_base_sptr,
550 		       vector<decl_base_sptr >::iterator,
551 		       scope_decl*);
552 
553 decl_base_sptr
554 insert_decl_into_scope(decl_base_sptr,
555 		       vector<decl_base_sptr >::iterator,
556 		       scope_decl_sptr);
557 
558 bool
559 has_scope(const decl_base&);
560 
561 bool
562 has_scope(const decl_base_sptr);
563 
564 bool
565 is_member_decl(const decl_base_sptr);
566 
567 bool
568 is_member_decl(const decl_base*);
569 
570 bool
571 is_member_decl(const decl_base&);
572 
573 scope_decl*
574 is_scope_decl(decl_base*);
575 
576 scope_decl_sptr
577 is_scope_decl(const decl_base_sptr&);
578 
579 bool
580 is_member_type(const type_base_sptr&);
581 
582 bool
583 is_user_defined_type(const type_base*);
584 
585 bool
586 is_user_defined_type(const type_base_sptr&);
587 
588 void
589 remove_decl_from_scope(decl_base_sptr);
590 
591 bool
592 get_member_is_static(const decl_base&);
593 
594 bool
595 get_member_is_static(const decl_base*);
596 
597 bool
598 get_member_is_static(const decl_base_sptr&);
599 
600 void
601 set_member_is_static(decl_base&, bool);
602 
603 void
604 set_member_is_static(const decl_base_sptr&, bool);
605 
606 bool
607 is_data_member(const var_decl&);
608 
609 var_decl*
610 is_data_member(const type_or_decl_base*);
611 
612 bool
613 is_data_member(const var_decl*);
614 
615 var_decl_sptr
616 is_data_member(const type_or_decl_base_sptr&);
617 
618 bool
619 is_data_member(const var_decl_sptr);
620 
621 var_decl_sptr
622 is_data_member(const decl_base_sptr&);
623 
624 var_decl*
625 is_data_member(const decl_base *);
626 
627 var_decl*
628 is_data_member(const decl_base *);
629 
630 const var_decl_sptr
631 get_next_data_member(const class_or_union_sptr&, const var_decl_sptr&);
632 
633 var_decl_sptr
634 get_last_data_member(const class_or_union_sptr&);
635 
636 bool
637 is_anonymous_data_member(const decl_base&);
638 
639 const var_decl*
640 is_anonymous_data_member(const type_or_decl_base*);
641 
642 const var_decl*
643 is_anonymous_data_member(const decl_base*);
644 
645 var_decl_sptr
646 is_anonymous_data_member(const type_or_decl_base_sptr&);
647 
648 var_decl_sptr
649 is_anonymous_data_member(const decl_base_sptr&);
650 
651 var_decl_sptr
652 is_anonymous_data_member(const var_decl_sptr&);
653 
654 const var_decl*
655 is_anonymous_data_member(const var_decl*);
656 
657 bool
658 is_anonymous_data_member(const var_decl&);
659 
660 const var_decl_sptr
661 get_first_non_anonymous_data_member(const var_decl_sptr);
662 
663 var_decl_sptr
664 find_data_member_from_anonymous_data_member(const var_decl_sptr&,
665 					    const string&);
666 
667 class_or_union*
668 anonymous_data_member_to_class_or_union(const var_decl*);
669 
670 class_or_union_sptr
671 anonymous_data_member_to_class_or_union(const var_decl_sptr&);
672 
673 bool
674 scope_anonymous_or_typedef_named(const decl_base&);
675 
676 bool
677 is_anonymous_or_typedef_named(const decl_base&);
678 
679 const class_or_union_sptr
680 data_member_has_anonymous_type(const var_decl& d);
681 
682 const class_or_union_sptr
683 data_member_has_anonymous_type(const var_decl* d);
684 
685 const class_or_union_sptr
686 data_member_has_anonymous_type(const var_decl_sptr& d);
687 
688 array_type_def*
689 is_array_type(const type_or_decl_base* decl);
690 
691 array_type_def_sptr
692 is_array_type(const type_or_decl_base_sptr& decl);
693 
694 array_type_def_sptr
695 is_array_of_qualified_element(const type_base_sptr&);
696 
697 qualified_type_def_sptr
698 is_array_of_qualified_element(const array_type_def_sptr&);
699 
700 array_type_def_sptr
701 is_typedef_of_array(const type_base_sptr&);
702 
703 void
704 set_data_member_offset(var_decl_sptr, uint64_t);
705 
706 uint64_t
707 get_data_member_offset(const var_decl&);
708 
709 uint64_t
710 get_data_member_offset(const var_decl_sptr);
711 
712 uint64_t
713 get_data_member_offset(const decl_base_sptr);
714 
715 uint64_t
716 get_absolute_data_member_offset(const var_decl&);
717 
718 bool
719 get_next_data_member_offset(const class_or_union_sptr&,
720 			    const var_decl_sptr&,
721 			    uint64_t&);
722 
723 uint64_t
724 get_var_size_in_bits(const var_decl_sptr&);
725 
726 void
727 set_data_member_is_laid_out(var_decl_sptr, bool);
728 
729 bool
730 get_data_member_is_laid_out(const var_decl&);
731 
732 bool
733 get_data_member_is_laid_out(const var_decl_sptr);
734 
735 bool
736 is_member_function(const function_decl&);
737 
738 bool
739 is_member_function(const function_decl*);
740 
741 bool
742 is_member_function(const function_decl_sptr&);
743 
744 bool
745 get_member_function_is_ctor(const function_decl&);
746 
747 bool
748 get_member_function_is_ctor(const function_decl_sptr&);
749 
750 void
751 set_member_function_is_ctor(const function_decl&, bool);
752 
753 void
754 set_member_function_is_ctor(const function_decl_sptr&, bool);
755 
756 bool
757 get_member_function_is_dtor(const function_decl&);
758 
759 bool
760 get_member_function_is_dtor(const function_decl_sptr&);
761 
762 void
763 set_member_function_is_dtor(function_decl&, bool);
764 
765 void
766 set_member_function_is_dtor(const function_decl_sptr&, bool);
767 
768 bool
769 get_member_function_is_const(const function_decl&);
770 
771 bool
772 get_member_function_is_const(const function_decl_sptr&);
773 
774 void
775 set_member_function_is_const(function_decl&, bool);
776 
777 void
778 set_member_function_is_const(const function_decl_sptr&, bool);
779 
780 bool
781 member_function_has_vtable_offset(const function_decl&);
782 
783 ssize_t
784 get_member_function_vtable_offset(const function_decl&);
785 
786 ssize_t
787 get_member_function_vtable_offset(const function_decl_sptr&);
788 
789 void
790 set_member_function_vtable_offset(const function_decl& f,
791 				  ssize_t s);
792 
793 void
794 set_member_function_vtable_offset(const function_decl_sptr &f,
795 				  ssize_t s);
796 
797 bool
798 get_member_function_is_virtual(const function_decl&);
799 
800 bool
801 get_member_function_is_virtual(const function_decl_sptr&);
802 
803 bool
804 get_member_function_is_virtual(const function_decl*);
805 
806 void
807 set_member_function_is_virtual(function_decl&, bool);
808 
809 void
810 set_member_function_is_virtual(const function_decl_sptr&, bool);
811 
812 type_base_sptr
813 strip_typedef(const type_base_sptr);
814 
815 decl_base_sptr
816 strip_useless_const_qualification(const qualified_type_def_sptr t);
817 
818 type_base_sptr
819 peel_typedef_type(const type_base_sptr&);
820 
821 const type_base*
822 peel_typedef_type(const type_base*);
823 
824 type_base_sptr
825 peel_pointer_type(const type_base_sptr&);
826 
827 const type_base*
828 peel_pointer_type(const type_base*);
829 
830 type_base_sptr
831 peel_reference_type(const type_base_sptr&);
832 
833 const type_base*
834 peel_reference_type(const type_base*);
835 
836 const type_base_sptr
837 peel_array_type(const type_base_sptr&);
838 
839 const type_base*
840 peel_array_type(const type_base*);
841 
842 const type_base*
843 peel_qualified_type(const type_base*);
844 
845 const type_base_sptr
846 peel_qualified_type(const type_base_sptr&);
847 
848 type_base*
849 peel_qualified_or_typedef_type(const type_base* type);
850 
851 type_base_sptr
852 peel_qualified_or_typedef_type(const type_base_sptr &type);
853 
854 type_base_sptr
855 peel_typedef_pointer_or_reference_type(const type_base_sptr);
856 
857 type_base*
858 peel_typedef_pointer_or_reference_type(const type_base* type);
859 
860 type_base*
861 peel_pointer_or_reference_type(const type_base *type,
862 			       bool peel_qualified_type = true);
863 
864 array_type_def_sptr
865 clone_array(const array_type_def_sptr& array);
866 
867 typedef_decl_sptr
868 clone_typedef(const typedef_decl_sptr& t);
869 
870 qualified_type_def_sptr
871 clone_qualified_type(const qualified_type_def_sptr& t);
872 
873 type_base_sptr
874 clone_array_tree(const type_base_sptr t);
875 
876 string
877 get_name(const type_or_decl_base*, bool qualified = true);
878 
879 string
880 get_name(const type_or_decl_base_sptr&,
881 	 bool qualified = true);
882 
883 location
884 get_location(const type_base_sptr& type);
885 
886 location
887 get_location(const decl_base_sptr& decl);
888 
889 string
890 build_qualified_name(const scope_decl* scope, const string& name);
891 
892 string
893 build_qualified_name(const scope_decl* scope,
894 		     const type_base_sptr& type);
895 
896 scope_decl*
897 get_type_scope(type_base*);
898 
899 scope_decl*
900 get_type_scope(const type_base_sptr&);
901 
902 interned_string
903 get_type_name(const type_base_sptr&,
904 	      bool qualified = true,
905 	      bool internal = false);
906 
907 interned_string
908 get_type_name(const type_base*,
909 	      bool qualified = true,
910 	      bool internal = false);
911 
912 interned_string
913 get_type_name(const type_base&,
914 	      bool qualified = true,
915 	      bool internal = false);
916 
917 interned_string
918 get_name_of_pointer_to_type(const type_base& pointed_to_type,
919 			    bool qualified = true,
920 			    bool internal = false);
921 
922 interned_string
923 get_name_of_reference_to_type(const type_base& pointed_to_type,
924 			      bool lvalue_reference = false,
925 			      bool qualified = true,
926 			      bool internal = false);
927 
928 interned_string
929 get_function_type_name(const function_type_sptr&,
930 		       bool internal = false);
931 
932 interned_string
933 get_function_type_name(const function_type*, bool internal = false);
934 
935 interned_string
936 get_function_type_name(const function_type&, bool internal = false);
937 
938 interned_string
939 get_method_type_name(const method_type_sptr&, bool internal = false);
940 
941 interned_string
942 get_method_type_name(const method_type*, bool internal = false);
943 
944 interned_string
945 get_method_type_name(const method_type&, bool internal = false);
946 
947 string
948 get_pretty_representation(const decl_base*, bool internal = false);
949 
950 string
951 get_pretty_representation(const type_base*, bool internal = false);
952 
953 string
954 get_pretty_representation(const type_or_decl_base*, bool internal = false);
955 
956 string
957 get_pretty_representation(const type_or_decl_base_sptr&,
958 			  bool internal = false);
959 
960 string
961 get_pretty_representation(const decl_base_sptr&, bool internal = false);
962 
963 string
964 get_pretty_representation(const type_base_sptr&, bool internal = false);
965 
966 string
967 get_pretty_representation(const function_type&, bool internal = false);
968 
969 string
970 get_pretty_representation(const function_type*, bool internal = false);
971 
972 string
973 get_pretty_representation(const function_type_sptr&,
974 			  bool internal = false);
975 
976 string
977 get_pretty_representation(const method_type&, bool internal = false);
978 
979 string
980 get_pretty_representation(const method_type*, bool internal = false);
981 
982 string
983 get_pretty_representation(const method_type_sptr&,
984 			  bool internal = false);
985 
986 string
987 get_class_or_union_flat_representation(const class_or_union& cou,
988 				       const string& indent,
989 				       bool one_line,
990 				       bool internal,
991 				       bool qualified_name = true);
992 
993 string
994 get_class_or_union_flat_representation(const class_or_union* cou,
995 				       const string& indent,
996 				       bool one_line,
997 				       bool internal,
998 				       bool qualified_name = true);
999 
1000 string
1001 get_class_or_union_flat_representation(const class_or_union_sptr& cou,
1002 				       const string& indent,
1003 				       bool one_line,
1004 				       bool internal,
1005 				       bool qualified_name = true);
1006 
1007 string
1008 get_debug_representation(const type_or_decl_base*);
1009 
1010 var_decl_sptr
1011 get_data_member(class_or_union *, const char*);
1012 
1013 var_decl_sptr
1014 get_data_member(type_base *clazz, const char* member_name);
1015 
1016 const location&
1017 get_natural_or_artificial_location(const decl_base*);
1018 
1019 const location&
1020 get_artificial_or_natural_location(const decl_base*);
1021 
1022 type_or_decl_base*
1023 debug(const type_or_decl_base* artifact);
1024 
1025 type_base*
1026 debug(const type_base* artifact);
1027 
1028 decl_base*
1029 debug(const decl_base* artifact);
1030 
1031 bool
1032 debug_equals(const type_or_decl_base *l, const type_or_decl_base *r);
1033 
1034 bool
1035 odr_is_relevant(const type_or_decl_base&);
1036 
1037 const decl_base*
1038 get_type_declaration(const type_base*);
1039 
1040 decl_base*
1041 get_type_declaration(type_base*);
1042 
1043 decl_base_sptr
1044 get_type_declaration(const type_base_sptr);
1045 
1046 bool
1047 types_are_compatible(const type_base_sptr,
1048 		     const type_base_sptr);
1049 
1050 bool
1051 types_are_compatible(const decl_base_sptr,
1052 		     const decl_base_sptr);
1053 
1054 const scope_decl*
1055 get_top_most_scope_under(const decl_base*,
1056 			 const scope_decl*);
1057 
1058 const scope_decl*
1059 get_top_most_scope_under(const decl_base_sptr,
1060 			 const scope_decl*);
1061 
1062 const scope_decl*
1063 get_top_most_scope_under(const decl_base_sptr,
1064 			 const scope_decl_sptr);
1065 
1066 void
1067 fqn_to_components(const std::string&,
1068 		  std::list<string>&);
1069 
1070 string
1071 components_to_type_name(const std::list<string>&);
1072 
1073 type_decl_sptr
1074 lookup_basic_type(const type_decl&, const translation_unit&);
1075 
1076 type_decl_sptr
1077 lookup_basic_type(const interned_string&, const translation_unit&);
1078 
1079 type_decl_sptr
1080 lookup_basic_type(const string&, const translation_unit&);
1081 
1082 type_decl_sptr
1083 lookup_basic_type(const type_decl&, const corpus&);
1084 
1085 type_decl_sptr
1086 lookup_basic_type(const string&, const corpus&);
1087 
1088 type_decl_sptr
1089 lookup_basic_type(const interned_string&, const corpus&);
1090 
1091 type_decl_sptr
1092 lookup_basic_type_per_location(const interned_string&, const corpus&);
1093 
1094 type_decl_sptr
1095 lookup_basic_type_per_location(const string&, const corpus&);
1096 
1097 class_decl_sptr
1098 lookup_class_type(const class_decl&, const translation_unit&);
1099 
1100 class_decl_sptr
1101 lookup_class_type(const interned_string&, const translation_unit&);
1102 
1103 class_decl_sptr
1104 lookup_class_type(const string&, const translation_unit&);
1105 
1106 class_decl_sptr
1107 lookup_class_type(const class_decl&, const corpus&);
1108 
1109 class_decl_sptr
1110 lookup_class_type(const interned_string&, const corpus&);
1111 
1112 const type_base_wptrs_type*
1113 lookup_class_types(const interned_string&, const corpus&);
1114 
1115 const type_base_wptrs_type*
1116 lookup_class_types(const string&, const corpus&);
1117 
1118 class_decl_sptr
1119 lookup_class_type_per_location(const interned_string&, const corpus&);
1120 
1121 class_decl_sptr
1122 lookup_class_type_per_location(const string&, const corpus&);
1123 
1124 class_decl_sptr
1125 lookup_class_type(const string&, const corpus&);
1126 
1127 class_decl_sptr
1128 lookup_class_type_through_scopes(const std::list<string>&,
1129 				 const translation_unit&);
1130 
1131 union_decl_sptr
1132 lookup_union_type(const interned_string&, const translation_unit&);
1133 
1134 union_decl_sptr
1135 lookup_union_type(const interned_string&, const corpus&);
1136 
1137 union_decl_sptr
1138 lookup_union_type_per_location(const interned_string&, const corpus&);
1139 
1140 union_decl_sptr
1141 lookup_union_type_per_location(const string&, const corpus&);
1142 
1143 union_decl_sptr
1144 lookup_union_type(const string&, const corpus&);
1145 
1146 enum_type_decl_sptr
1147 lookup_enum_type(const enum_type_decl&, const translation_unit&);
1148 
1149 enum_type_decl_sptr
1150 lookup_enum_type(const string&, const translation_unit&);
1151 
1152 enum_type_decl_sptr
1153 lookup_enum_type(const enum_type_decl&, const corpus&);
1154 
1155 enum_type_decl_sptr
1156 lookup_enum_type(const string&, const corpus&);
1157 
1158 enum_type_decl_sptr
1159 lookup_enum_type(const interned_string&, const corpus&);
1160 
1161 const type_base_wptrs_type*
1162 lookup_enum_types(const interned_string&, const corpus&);
1163 
1164 const type_base_wptrs_type*
1165 lookup_enum_types(const string&, const corpus&);
1166 
1167 enum_type_decl_sptr
1168 lookup_enum_type_per_location(const interned_string&, const corpus&);
1169 
1170 enum_type_decl_sptr
1171 lookup_enum_type_per_location(const string&, const corpus&);
1172 
1173 typedef_decl_sptr
1174 lookup_typedef_type(const typedef_decl&, const translation_unit&);
1175 
1176 typedef_decl_sptr
1177 lookup_typedef_type(const typedef_decl&, const corpus&);
1178 
1179 typedef_decl_sptr
1180 lookup_typedef_type(const interned_string& type_name,
1181 		    const translation_unit& tu);
1182 
1183 typedef_decl_sptr
1184 lookup_typedef_type(const string& type_name, const translation_unit& tu);
1185 
1186 typedef_decl_sptr
1187 lookup_typedef_type(const interned_string&, const corpus&);
1188 
1189 typedef_decl_sptr
1190 lookup_typedef_type_per_location(const interned_string&, const corpus &);
1191 
1192 typedef_decl_sptr
1193 lookup_typedef_type_per_location(const string&, const corpus &);
1194 
1195 typedef_decl_sptr
1196 lookup_typedef_type(const string&, const corpus&);
1197 
1198 type_base_sptr
1199 lookup_class_or_typedef_type(const string&, const translation_unit&);
1200 
1201 type_base_sptr
1202 lookup_class_typedef_or_enum_type(const string&, const translation_unit&);
1203 
1204 type_base_sptr
1205 lookup_class_or_typedef_type(const string&, const corpus&);
1206 
1207 type_base_sptr
1208 lookup_class_typedef_or_enum_type(const string&, const corpus&);
1209 
1210 qualified_type_def_sptr
1211 lookup_qualified_type(const qualified_type_def&, const translation_unit&);
1212 
1213 qualified_type_def_sptr
1214 lookup_qualified_type(const string&, const translation_unit&);
1215 
1216 qualified_type_def_sptr
1217 lookup_qualified_type(const qualified_type_def&, const corpus&);
1218 
1219 qualified_type_def_sptr
1220 lookup_qualified_type(const interned_string&, const corpus&);
1221 
1222 pointer_type_def_sptr
1223 lookup_pointer_type(const pointer_type_def&, const translation_unit&);
1224 
1225 pointer_type_def_sptr
1226 lookup_pointer_type(const string&, const translation_unit&);
1227 
1228 pointer_type_def_sptr
1229 lookup_pointer_type(const type_base_sptr& pointed_to_type,
1230 		    const translation_unit& tu);
1231 
1232 pointer_type_def_sptr
1233 lookup_pointer_type(const pointer_type_def&, const corpus&);
1234 
1235 pointer_type_def_sptr
1236 lookup_pointer_type(const interned_string&, const corpus&);
1237 
1238 const reference_type_def_sptr
1239 lookup_reference_type(const reference_type_def&, const translation_unit&);
1240 
1241 const reference_type_def_sptr
1242 lookup_reference_type(const string&, const translation_unit&);
1243 
1244 const reference_type_def_sptr
1245 lookup_reference_type(const type_base_sptr& pointed_to_type,
1246 		      bool lvalue_reference,
1247 		      const translation_unit& tu);
1248 
1249 reference_type_def_sptr
1250 lookup_reference_type(const reference_type_def&, const corpus&);
1251 
1252 reference_type_def_sptr
1253 lookup_reference_type(const interned_string&, const corpus&);
1254 
1255 array_type_def_sptr
1256 lookup_array_type(const array_type_def&, const translation_unit&);
1257 
1258 array_type_def_sptr
1259 lookup_array_type(const string&, const translation_unit&);
1260 
1261 array_type_def_sptr
1262 lookup_array_type(const array_type_def&, const corpus&);
1263 
1264 array_type_def_sptr
1265 lookup_array_type(const interned_string&, const corpus&);
1266 
1267 function_type_sptr
1268 lookup_function_type(const string&,
1269 		     const translation_unit&);
1270 
1271 function_type_sptr
1272 lookup_function_type(const interned_string&,
1273 		     const translation_unit&);
1274 
1275 function_type_sptr
1276 lookup_function_type(const function_type&,
1277 		     const translation_unit&);
1278 
1279 function_type_sptr
1280 lookup_function_type(const function_type_sptr&,
1281 		     const translation_unit&);
1282 
1283 function_type_sptr
1284 lookup_function_type(const function_type&, const corpus&);
1285 
1286 function_type_sptr
1287 lookup_function_type(const function_type_sptr&, const corpus&);
1288 
1289 function_type_sptr
1290 lookup_function_type(const function_type&, const corpus&);
1291 
1292 function_type_sptr
1293 lookup_function_type(const interned_string&, const corpus&);
1294 
1295 type_base_sptr
1296 lookup_type(const string&, const translation_unit&);
1297 
1298 const type_base_sptr
1299 lookup_type(const type_base_sptr, const translation_unit&);
1300 
1301 type_base_sptr
1302 lookup_type(const interned_string&, const corpus&);
1303 
1304 type_base_sptr
1305 lookup_type_per_location(const interned_string&, const corpus&);
1306 
1307 type_base_sptr
1308 lookup_type(const type_base&, const corpus&);
1309 
1310 type_base_sptr
1311 lookup_type(const type_base_sptr&, const corpus&);
1312 
1313 type_base_sptr
1314 lookup_type_through_scopes(const std::list<string>&,
1315 			   const translation_unit&);
1316 
1317 type_base_sptr
1318 lookup_type_through_translation_units(const string&, const corpus&);
1319 
1320 type_base_sptr
1321 lookup_type_from_translation_unit(const string& type_name,
1322 				  const string& tu_path,
1323 				  const corpus& corp);
1324 
1325 function_type_sptr
1326 lookup_or_synthesize_fn_type(const function_type_sptr&,
1327 			     const corpus&);
1328 
1329 type_base_sptr
1330 synthesize_type_from_translation_unit(const type_base_sptr&,
1331 				      translation_unit&);
1332 
1333 function_type_sptr
1334 synthesize_function_type_from_translation_unit(const function_type&,
1335 					       translation_unit&);
1336 
1337 const type_base_sptr
1338 lookup_type_in_scope(const string&,
1339 		     const scope_decl_sptr&);
1340 
1341 const type_base_sptr
1342 lookup_type_in_scope(const std::list<string>&,
1343 		     const scope_decl_sptr&);
1344 
1345 const decl_base_sptr
1346 lookup_var_decl_in_scope(const string&,
1347 			 const scope_decl_sptr&);
1348 
1349 const decl_base_sptr
1350 lookup_var_decl_in_scope(const std::list<string>&,
1351 			 const scope_decl_sptr&);
1352 
1353 string
1354 demangle_cplus_mangled_name(const string&);
1355 
1356 type_base_sptr
1357 type_or_void(const type_base_sptr, const environment*);
1358 
1359 type_base_sptr
1360 canonicalize(type_base_sptr);
1361 
1362 type_base*
1363 type_has_non_canonicalized_subtype(type_base_sptr t);
1364 
1365 bool
1366 type_has_sub_type_changes(type_base_sptr t_v1,
1367 			  type_base_sptr t_v2);
1368 
1369 void
1370 keep_type_alive(type_base_sptr t);
1371 
1372 size_t
1373 hash_type(const type_base *t);
1374 
1375 size_t
1376 hash_type_or_decl(const type_or_decl_base *);
1377 
1378 size_t
1379 hash_type_or_decl(const type_or_decl_base_sptr &);
1380 
1381 bool
1382 is_non_canonicalized_type(const type_base *);
1383 
1384 bool
1385 is_non_canonicalized_type(const type_base_sptr&);
1386 
1387 /// For a given type, return its exemplar type.
1388 ///
1389 /// For a given type, its exemplar type is either its canonical type
1390 /// or the canonical type of the definition type of a given
1391 /// declaration-only type.  If the neither of those two types exist,
1392 /// then the exemplar type is the given type itself.
1393 ///
1394 /// @param type the input to consider.
1395 ///
1396 /// @return the exemplar type.
1397 type_base*
1398 get_exemplar_type(const type_base* type);
1399 
1400 bool
1401 function_decl_is_less_than(const function_decl&f, const function_decl &s);
1402 
1403 bool
1404 types_have_similar_structure(const type_base_sptr& first,
1405 			     const type_base_sptr& second,
1406 			     bool indirect_type = false);
1407 
1408 bool
1409 types_have_similar_structure(const type_base* first,
1410 			     const type_base* second,
1411 			     bool indirect_type = false);
1412 
1413 } // end namespace ir
1414 
1415 using namespace abigail::ir;
1416 
1417 namespace suppr
1418 {
1419 class suppression_base;
1420 
1421 /// Convenience typedef for a shared pointer to a @ref suppression.
1422 typedef shared_ptr<suppression_base> suppression_sptr;
1423 
1424 /// Convenience typedef for a vector of @ref suppression_sptr
1425 typedef vector<suppression_sptr> suppressions_type;
1426 
1427 } // end namespace suppr
1428 
1429 namespace symtab_reader
1430 {
1431 
1432 class symtab;
1433 /// Convenience typedef for a shared pointer to a @ref symtab
1434 typedef std::shared_ptr<symtab> symtab_sptr;
1435 
1436 } // end namespace symtab_reader
1437 
1438 void
1439 dump(const decl_base_sptr, std::ostream&);
1440 
1441 void
1442 dump(const decl_base_sptr);
1443 
1444 void
1445 dump(const type_base_sptr, std::ostream&);
1446 
1447 void
1448 dump(const type_base_sptr);
1449 
1450 void
1451 dump(const var_decl_sptr, std::ostream&);
1452 
1453 void
1454 dump(const var_decl_sptr);
1455 
1456 void
1457 dump(const translation_unit&, std::ostream&);
1458 
1459 void
1460 dump(const translation_unit&);
1461 
1462 void
1463 dump(const translation_unit_sptr, std::ostream&);
1464 
1465 void
1466 dump(const translation_unit_sptr);
1467 
1468 void
1469 dump_decl_location(const decl_base&);
1470 
1471 void
1472 dump_decl_location(const decl_base*);
1473 
1474 void
1475 dump_decl_location(const decl_base_sptr&);
1476 
1477 #ifndef ABG_ASSERT
1478 /// This is a wrapper around the 'assert' glibc call.  It allows for
1479 /// its argument to have side effects, so that it keeps working when
1480 /// the code of libabigail is compiled with the NDEBUG macro defined.
1481 #define ABG_ASSERT(cond) do {({bool __abg_cond__ = bool(cond); assert(__abg_cond__); !!__abg_cond__;});} while (false)
1482 #endif
1483 
1484 } // end namespace abigail
1485 #endif // __ABG_IRFWD_H__
1486