libabigail
Loading...
Searching...
No Matches
abg-ir.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// -*- Mode: C++ -*-
3//
4// Copyright (C) 2013-2026 Red Hat, Inc.
5//
6// Author: Dodji Seketeli
7
8/// @file
9///
10/// Types of the main internal representation of libabigail.
11///
12/// This internal representation abstracts the artifacts that make up
13/// an application binary interface.
14
15#ifndef __ABG_IR_H__
16#define __ABG_IR_H__
17
18#include <assert.h>
19#include <stdint.h>
20#include <cstdlib>
21#include <functional>
22#include <set>
23#include <unordered_map>
24#include <typeinfo>
25#include <mutex>
26
27#include "abg-config.h"
28#include "abg-fwd.h"
29#include "abg-traverse.h"
30#include "abg-cxx-compat.h"
31
32/// @file
33///
34/// This file contains the declarations of the Internal Representation
35/// of libabigail.
36
37/// @defgroup Memory Memory management
38/// @{
39///
40/// How objects' lifetime is handled in libabigail.
41///
42/// For memory management and garbage collection of libabigail's IR
43/// artifacts, we use std::shared_ptr and std::weak_ptr.
44///
45/// When manipulating these IR artifacts, there are a few rules to keep in
46/// mind.
47///
48/// <b>The declaration for a type is owned by only one scope </b>
49///
50/// This means that for each instance of abigail::type_base (a type) there
51/// is an instance of abigail::scope_decl that owns a @ref
52/// abigail::decl_base_sptr (a shared pointer to an abigail::decl_base)
53/// that points to the declaration of that type. The
54/// abigail::type_base_sptr is added to the scope using the function
55/// abigail::add_decl_to_scope().
56///
57/// There is a kind of type that is usually not syntactically owned by
58/// a scope: it's function type. In libabigail, function types are
59/// represented by abigail::function_type and abigail::method_type.
60/// These types must be owned by the translation unit they originate
61/// from. Adding them to the translation unit must be done by a call
62/// to the method function
63/// abigail::translation::bind_function_type_life_time().
64///
65/// <b> A declaration that has a type does NOT own the type </b>
66///
67/// This means that, for instance, in an abigail::var_decl (a variable
68/// declaration), the type of the declaration is not owned by the
69/// declaration. In other (concrete) words, the variable declaration
70/// doesn't have a shared pointer to the type. Rather, it has a *weak*
71/// pointer to its type. That means that it has a data member of type
72/// abigail::type_base_wptr that contains the type of the declaration.
73///
74/// But then abigail::var_decl::get_type() returns a shared pointer that
75/// is constructed from the internal weak pointer to the type. That way,
76/// users of the type of the var can own a temporary reference on it and
77/// be assured that the type's life time is long enough for their need.
78///
79/// Likewise, data members, function and template parameters similarly
80/// have weak pointers on their type.
81///
82/// If, for a reason, you really need to keep a type alive for the
83/// entire lifetime of the type system, then you can bind the life
84/// time of that type to the life time of the @ref environment that is
85/// supposed to outlive the type system. You do that by passing the
86/// type to the function environment::keep_type_alive().
87///
88/// @}
89
90namespace abigail
91{
92
93/// The namespace of the internal representation of ABI artifacts like
94/// types and decls.
95namespace ir
96{
97
98// Inject some std types in here.
99using std::unordered_map;
100using std::set;
101
102/// A convenience typedef for an unordered set of pointer values
103typedef unordered_set<uintptr_t> pointer_set;
104
105/// The abstraction for an 8 bytes hash value.
106///
107/// As this is an optional uint64_t value, it allows the
108/// representation of empty hash values.
110
111/// The abstraction for a native offset.
112///
113/// This is to represent things like the DIE (in DWARF) offset of some
114/// types. It's useful to sort the types before type hashing. As
115/// this is an optional uint64_t value, it allows the representation
116/// of empty offsets.
118
119hash_t
121
122/// Functor to hash a canonical type by using its pointer value.
124{
125 size_t operator()(const type_base_sptr& l) const;
126 size_t operator()(const type_base *l) const;
127}; //end struct canonical_type_hash
128
129/// Helper typedef for an unordered set of type_base_sptr which uses
130/// pointer value to tell its members appart, because the members are
131/// canonical types.
132typedef unordered_set<type_base_sptr,
134
135
136/// Helper typedef for an unordered set of type_base* which uses
137/// pointer value to tell its members appart, because the members are
138/// canonical types.
139typedef unordered_set<type_base*,
141
142/// Helper typedef for a vector of pointer to type_base.
143typedef vector<type_base*> type_base_ptrs_type;
144
145/// Helper typedef for a vector of shared pointer to a type_base.
146typedef vector<type_base_sptr> type_base_sptrs_type;
147
148void
150 vector<type_base_sptr>& result);
151
152/// A hashing functor for @ref type_base_sptr that doesn't do any deep
153/// type comparison but rather just compares pointer values.
155{
156 /// The hashing operator of a type_base_sptr.
157 ///
158 /// @param t the type_base_sptr to consider.
159 ///
160 /// @return the pointer value of @p t.
161 uint64_t
162 operator()(const type_base_sptr& t) const
163 {return reinterpret_cast<uint64_t>(t.get());}
164
165 uint64_t
166 operator()(const type_base_wptr& t) const
167 {return operator()(t.lock());}
168};// end struct shallow_type_hasher
169
170/// An equality functor for @ref type_base_sptr that only compares
171/// their pointer values and does not do any deep type comparison.
173{
174 /// The equality operator.
175 ///
176 /// @param l the left hand-side operand of the equality.
177 ///
178 /// @param r the right-hand-side operand of the equality.
179 ///
180 /// @return true iff the pointer value of @p l equals the one of @p
181 /// r.
182 bool
183 operator()(const type_base_sptr& l, const type_base_sptr& r) const
184 {return l.get() == r.get();}
185
186 bool
187 operator()(const type_base_wptr& l, const type_base_wptr& r) const
188 {return operator()(l.lock(), r.lock());}
189};// end struct shallow_type_eq
190
191/// Convenience typedef for a set of @ref type_base_sptr
192typedef unordered_set<type_base_sptr,
193 shallow_type_hasher,
195
196/// Convenience typedef for a set of @ref type_base_wptr
197typedef unordered_set<type_base_wptr,
200
201/// This is an abstraction of the set of resources necessary to manage
202/// several aspects of the internal representations of the Abigail
203/// library.
204///
205/// An environment can be seen as the boundaries in which all related
206/// Abigail artifacts live. So before doing anything using this
207/// library, the first thing to create is, well, you know it now, an
208/// environment.
209///
210/// Note that the lifetime of environment objects must be longer than
211/// the lifetime of any other type in the Abigail system. So a given
212/// instance of @ref environment must stay around as long as you are
213/// using libabigail. It's only when you are done using the library
214/// that you can de-allocate the environment instance.
216{
217public:
218 struct priv;
219 std::unique_ptr<priv> priv_;
220
221 /// A convenience typedef for a map of canonical types. The key is
222 /// the pretty representation string of a particular type and the
223 /// value is the vector of canonical types that have the same pretty
224 /// representation string.
225 typedef std::unordered_map<string, std::vector<type_base_sptr> >
227
228 environment();
229
230 virtual ~environment();
231
234
237
238 const type_base_sptr&
239 get_void_type() const;
240
241 const type_base_sptr&
242 get_void_pointer_type() const;
243
244 const type_base_sptr&
246
247 static string&
249
250 bool
252
253 void
255
256 bool
257 is_void_type(const type_base_sptr&) const;
258
259 bool
260 is_void_type(const type_base*) const;
261
262 bool
263 is_void_pointer_type(const type_base_sptr&) const;
264
265 bool
266 is_void_pointer_type(const type_base*) const;
267
268 bool
270
271 bool
272 is_variadic_parameter_type(const type_base_sptr&) const;
273
275 intern(const string&) const;
276
277 const config&
278 get_config() const;
279
280 bool
282
283 void
285
286 bool
288
289 bool
290 user_set_load_all_types() const;
291
292 void
293 load_all_types(bool f);
294
295 bool
296 load_all_types() const;
297
298 static size_t
300
301 static void
303
304 static size_t
305 process_thread_pool_size_string(const string&);
306
307#ifdef WITH_DEBUG_SELF_COMPARISON
308 void
309 set_self_comparison_debug_input(const corpus_sptr& corpus);
310
311 void
312 get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
313 corpus_sptr& second_corpus);
314
315 void
316 self_comparison_debug_is_on(bool);
317
318 bool
319 self_comparison_debug_is_on() const;
320#endif
321
322#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
323 void
324 debug_type_canonicalization_is_on(bool flag);
325
326 bool
327 debug_type_canonicalization_is_on() const;
328
329 void
330 debug_die_canonicalization_is_on(bool flag);
331
332 bool
333 debug_die_canonicalization_is_on() const;
334#endif
335
336 const vector<type_base_sptr>* get_canonical_types(const char* name) const;
337
338 const vector<type_base_sptr>* get_canonical_types(const string& name) const;
339
340 type_base* get_canonical_type(const char* name, unsigned index);
341
342 const vector<type_base_sptr>&
344
345#ifdef WITH_DEBUG_SELF_COMPARISON
346 const unordered_map<string, uintptr_t>&
347 get_type_id_canonical_type_map() const;
348
349 unordered_map<string, uintptr_t>&
350 get_type_id_canonical_type_map();
351
352 const unordered_map<uintptr_t, string>&
353 get_pointer_type_id_map() const;
354
355 unordered_map<uintptr_t, string>&
356 get_pointer_type_id_map();
357
358 string
359 get_type_id_from_pointer(uintptr_t ptr) const;
360
361 string
362 get_type_id_from_type(const type_base *ptr) const;
363
364 uintptr_t
365 get_canonical_type_from_type_id(const char*) const;
366#endif
367
368 friend class class_or_union;
369 friend class class_decl;
370 friend class function_type;
371
372 friend void keep_type_alive(type_base_sptr);
373}; // end class environment
374
375/// @brief The source location of a token.
376///
377/// This represents the location of a token coming from a given
378/// translation unit. This location is actually an abstraction of
379/// cursor in the table of all the locations of all the tokens of the
380/// translation unit. That table is managed by the @ref location_manager
381/// type. To get the file path, line and column numbers associated to
382/// a given instance of @ref location, you need to use the
383/// location_manager::expand_location method.
385{
386 struct priv;
387 std::unique_ptr<priv> priv_;
388
389 location(unsigned v, location_manager* m);
390
392 get_location_manager() const;
393
394public:
395
396 ~location();
397
398 bool
399 get_is_artificial() const;
400
401 size_t
402 get_artificial_value() const;
403
404 void
405 set_artificial(size_t v);
406
407 location(const location& l);
408
409 location&
410 operator=(const location& l);
411
412 location();
413
414 unsigned
415 get_value() const;
416
417 operator bool() const;
418
419 bool
420 operator==(const location &other) const;
421
422 bool
423 operator<(const location &other) const;
424
425 void
426 expand(std::string& path, unsigned& line, unsigned& column) const;
427
428 string
429 expand(void) const;
430
431 friend class location_manager;
432}; // end class location
433
434
435/// @brief The entry point to manage locations.
436///
437/// This type keeps a table of all the locations for tokens of a
438/// given translation unit.
440{
441 struct priv;
442 std::unique_ptr<priv> priv_;
443
444public:
445
447
449
451 create_new_location(const std::string& fle, size_t lne, size_t col);
452
453 void
454 expand_location(const location& location, std::string& path,
455 unsigned& line, unsigned& column) const;
456};
457
458/// The base of an entity of the intermediate representation that is
459/// to be traversed.
461{
462 /// Traverse a given IR node and its children, calling an visitor on
463 /// each node.
464 ///
465 /// @param v the visitor to call on each traversed node.
466 ///
467 /// @return true if the all the IR node tree was traversed.
468 virtual bool
470}; // end class ir_traversable_base
471
472/// The comparison functor for using instances of @ref
473/// type_or_decl_base as values in a hash map or set.
475{
476
477 /// The function-call operator to compare the string representations
478 /// of two ABI artifacts.
479 ///
480 /// @param l the left hand side ABI artifact operand of the
481 /// comparison.
482 ///
483 /// @param r the right hand side ABI artifact operand of the
484 /// comparison.
485 ///
486 /// @return true iff the string representation of @p l equals the one
487 /// of @p r.
488 bool
490 {
491 string repr1 = get_pretty_representation(l);
492 string repr2 = get_pretty_representation(r);
493
494 return repr1 == repr2;
495 }
496
497 /// The function-call operator to compare the string representations
498 /// of two ABI artifacts.
499 ///
500 /// @param l the left hand side ABI artifact operand of the
501 /// comparison.
502 ///
503 /// @param r the right hand side ABI artifact operand of the
504 /// comparison.
505 ///
506 /// @return true iff the string representation of @p l equals the one
507 /// of @p r.
508 bool
510 const type_or_decl_base_sptr &r) const
511 {return operator()(l.get(), r.get());}
512}; // end type_or_decl_equal
513
514/// The hashing functor for using instances of @ref type_or_decl_base
515/// as values in a hash map or set.
517{
518
519 /// Function-call Operator to hash the string representation of an
520 /// ABI artifact.
521 ///
522 /// @param artifact the ABI artifact to hash.
523 ///
524 /// @return the hash value of the string representation of @p
525 /// artifact.
526 size_t
527 operator()(const type_or_decl_base *artifact) const
528 {
529 string repr = get_pretty_representation(artifact);
530 std::hash<string> do_hash;
531 return do_hash(repr);
532 }
533
534 /// Function-call Operator to hash the string representation of an
535 /// ABI artifact.
536 ///
537 /// @param artifact the ABI artifact to hash.
538 ///
539 /// @return the hash value of the string representation of @p
540 /// artifact.
541 size_t
542 operator()(const type_or_decl_base_sptr& artifact) const
543 {return operator()(artifact.get());}
544}; // end struct type_or_decl_hash
545
546
547/// A convenience typedef for a hash set of type_or_decl_base_sptr
548typedef unordered_set<type_or_decl_base_sptr,
551
552/// A convenience typedef for a hash set of const type_or_decl_base*
553typedef unordered_set<const type_or_decl_base*,
556
557/// A convenience typedef for a map which key is a string and which
558/// value is a @ref type_base_wptr.
559typedef unordered_map<string, type_base_wptr> string_type_base_wptr_map_type;
560
561/// A convenience typedef for a map which key is a string and which
562/// value is a @ref type_base_sptr.
563typedef unordered_map<string, type_base_sptr> string_type_base_sptr_map_type;
564
565/// A convenience typedef for a map which key is an @ref
566/// interned_string and which value is a @ref type_base_wptr.
567typedef unordered_map<interned_string, type_base_wptr, hash_interned_string>
569
570/// A convenience typedef for a map which key is an @ref
571/// interned_string and which value is a @ref type_base_wptr.
572typedef unordered_map<interned_string,
576
577typedef unordered_map<interned_string,
578 const function_decl*,
579 hash_interned_string> istring_function_decl_ptr_map_type;
580
581typedef unordered_map<interned_string,
583 hash_interned_string> istring_var_decl_ptr_map_type;
584
585/// This is a type that aggregates maps of all the kinds of types that
586/// are supported by libabigail.
587///
588/// For instance, the type_maps contains a map of string to basic
589/// type, a map of string to class type, a map of string to union
590/// types, etc. The key of a map entry is the pretty representation
591/// of the type, and the value of the map entry is the type.
593{
594 struct priv;
595 std::unique_ptr<priv> priv_;
596
597public:
598
599 type_maps();
600
601 ~type_maps();
602
603 bool
604 empty() const;
605
607 basic_types() const;
608
610 basic_types();
611
613 class_types() const;
614
616 class_types();
617
619 union_types();
620
622 union_types() const;
623
625 enum_types();
626
628 enum_types() const;
629
632
634 typedef_types() const;
635
638
640 qualified_types() const;
641
644
646 pointer_types() const;
647
650
652 ptr_to_mbr_types() const;
653
656
658 reference_types() const;
659
661 array_types();
662
664 array_types() const;
665
667 subrange_types() const;
668
671
674
676 function_types() const;
677
678 const vector<type_base_wptr>&
679 get_types_sorted() const;
680
682 get_type_map(const std::type_info&);
683
685 get_type_map(const std::type_info&) const;
686}; // end class type_maps;
687
688/// This is the abstraction of the set of relevant artefacts (types,
689/// variable declarations, functions, templates, etc) bundled together
690/// into a translation unit.
692{
693 struct priv;
694
695 // Forbidden
696 translation_unit() = delete;
697
698public:
699 std::unique_ptr<priv> priv_;
700
701 /// Convenience typedef for a shared pointer on a @ref global_scope.
702 typedef shared_ptr<scope_decl> global_scope_sptr;
703
704 /// The language of the translation unit.
706 {
707 LANG_UNKNOWN = 0,
708 LANG_Cobol74,
709 LANG_Cobol85,
710 LANG_C89,
711 LANG_C99,
712 LANG_C11,
713 LANG_C17,
714 LANG_C23,
715 LANG_C,
716 LANG_C_plus_plus_03,
717 LANG_C_plus_plus_11,
718 LANG_C_plus_plus_14,
719 LANG_C_plus_plus_17,
720 LANG_C_plus_plus_20,
721 LANG_C_plus_plus_23,
722 LANG_C_plus_plus,
723 LANG_ObjC,
724 LANG_ObjC_plus_plus,
725 LANG_OCaml,
726 LANG_D,
727 LANG_Go,
728 LANG_Rust,
729 LANG_Zig,
730 LANG_Metal,
731 LANG_Fortran77,
732 LANG_Fortran90,
733 LANG_Fortran95,
734 LANG_Fortran18,
735 LANG_Fortran23,
736 LANG_Ada83,
737 LANG_Ada95,
738 LANG_Ada2005,
739 LANG_Ada2012,
740 LANG_Pascal83,
741 LANG_Modula2,
742 LANG_Java,
743 LANG_Kotlin,
744 LANG_C_sharp,
745 LANG_Python,
746 LANG_Ruby,
747 LANG_PLI,
748 LANG_UPC,
749 LANG_Mips_Assembler,
750 LANG_Assembly,
751 LANG_Crystal,
752 LANG_HIP,
753 LANG_Mojo,
754 LANG_GLSL,
755 LANG_GLSL_ES,
756 LANG_HLSL,
757 LANG_OpenCL_CPP,
758 LANG_CPP_for_OpenCL,
759 LANG_SYCL,
760 LANG_Odin,
761 LANG_P4,
762 LANG_Move,
763 LANG_Hylo
764 };
765
766public:
768 const std::string& path,
769 char address_size = 0);
770
771 virtual ~translation_unit();
772
773 const environment&
774 get_environment() const;
775
777 get_language() const;
778
779 void
781
782 const std::string&
783 get_path() const;
784
785 void
786 set_path(const string&);
787
788 const std::string&
790
791 void
792 set_compilation_dir_path(const std::string&);
793
794 const std::string&
795 get_absolute_path() const;
796
797 void
799
800 const corpus*
801 get_corpus() const;
802
803 corpus*
804 get_corpus();
805
806 const scope_decl_sptr
807 get_global_scope() const;
808
811
812 const type_maps&
813 get_types() const;
814
815 type_maps&
816 get_types();
817
818 const type_sptr_set_type&
819 get_live_fn_types() const;
820
822 get_loc_mgr();
823
824 const location_manager&
825 get_loc_mgr() const;
826
827 bool
828 is_empty() const;
829
830 char
831 get_address_size() const;
832
833 void
834 set_address_size(char);
835
836 bool
837 is_constructed() const;
838
839 void
840 set_is_constructed(bool);
841
842 bool
843 operator==(const translation_unit&) const;
844
845 bool
846 operator!=(const translation_unit&) const;
847
848 void
850
851 virtual bool
853
854 friend function_type_sptr
855 lookup_function_type_in_translation_unit(const function_type& t,
856 const translation_unit& tu);
857
858 friend function_type_sptr
860 translation_unit& tu);
861
862 friend type_base_sptr
863 synthesize_type_from_translation_unit(const type_base_sptr& type,
864 translation_unit& tu);
865};//end class translation_unit
866
867/// A comparison functor to compare translation units based on their
868/// absolute paths.
870{
871 /// Compare two translations units based on their absolute paths.
872 ///
873 /// @param lhs the first translation unit to consider for the
874 /// comparison.
875 ///
876 /// @param rhs the second translatin unit to consider for the
877 /// comparison.
878 bool
880 const translation_unit_sptr& rhs) const
881 {return lhs->get_absolute_path() < rhs->get_absolute_path();}
882}; // end struct shared_translation_unit_comp
883
884/// Convenience typedef for an ordered set of @ref
885/// translation_unit_sptr.
886typedef std::set<translation_unit_sptr,
888
889string
891
894
895bool
897
898bool
900
901bool
903
904bool
906
907bool
909
910bool
912
913/// Access specifier for class members.
915{
916 no_access,
917 public_access,
918 protected_access,
919 private_access,
920};
921
922class elf_symbol;
923/// A convenience typedef for a shared pointer to elf_symbol.
924typedef shared_ptr<elf_symbol> elf_symbol_sptr;
925
926/// A convenience typedef for a weak pointer to elf_symbol.
927typedef weak_ptr<elf_symbol> elf_symbol_wptr;
928
929/// Convenience typedef for a map which key is a string and which
930/// value if the elf symbol of the same name.
931typedef std::unordered_map<string, elf_symbol_sptr>
933
934/// Convenience typedef for a shared pointer to an
935/// string_elf_symbol_sptr_map_type.
936typedef shared_ptr<string_elf_symbol_sptr_map_type>
938
939/// Convenience typedef for a vector of elf_symbol
940typedef std::vector<elf_symbol_sptr> elf_symbols;
941
942/// Convenience typedef for a map which key is a string and which
943/// value is a vector of elf_symbol.
944typedef std::unordered_map<string, elf_symbols>
946
947/// Convenience typedef for a shared pointer to
948/// string_elf_symbols_map_type.
949typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
950
951/// Abstraction of an elf symbol.
952///
953/// This is useful when a given corpus has been read from an ELF file.
954/// In that case, a given decl might be associated to its underlying
955/// ELF symbol, if that decl is publicly exported in the ELF file. In
956/// that case, comparing decls might involve comparing their
957/// underlying symbols as well.
959{
960public:
961 /// The type of a symbol.
962 enum type
963 {
964 NOTYPE_TYPE = 0,
965 OBJECT_TYPE,
966 FUNC_TYPE,
967 SECTION_TYPE,
968 FILE_TYPE,
969 COMMON_TYPE,
970 TLS_TYPE,
971 GNU_IFUNC_TYPE
972 };
973
974 /// The binding of a symbol.
976 {
977 LOCAL_BINDING = 0,
978 GLOBAL_BINDING,
979 WEAK_BINDING,
980 GNU_UNIQUE_BINDING
981 };
982
983 /// The visibility of the symbol.
985 {
986 DEFAULT_VISIBILITY,
987 PROTECTED_VISIBILITY,
988 HIDDEN_VISIBILITY,
989 INTERNAL_VISIBILITY,
990 };
991
992 /// Inject the elf_symbol::version here.
993 class version;
994
995private:
996 struct priv;
997 std::unique_ptr<priv> priv_;
998
999 elf_symbol();
1000
1001 elf_symbol(const environment& e,
1002 size_t i,
1003 size_t s,
1004 const string& n,
1005 type t,
1006 binding b,
1007 bool d,
1008 bool c,
1009 const version& ve,
1010 visibility vi,
1011 bool is_in_ksymtab = false,
1012 const abg_compat::optional<uint32_t>& crc = {},
1013 const abg_compat::optional<std::string>& ns = {},
1014 bool is_suppressed = false);
1015
1016 elf_symbol(const elf_symbol&);
1017
1018 elf_symbol&
1019 operator=(const elf_symbol& s);
1020
1021public:
1022
1023 static elf_symbol_sptr
1024 create(const environment& e,
1025 size_t i,
1026 size_t s,
1027 const string& n,
1028 type t,
1029 binding b,
1030 bool d,
1031 bool c,
1032 const version& ve,
1033 visibility vi,
1034 bool is_in_ksymtab = false,
1035 const abg_compat::optional<uint32_t>& crc = {},
1036 const abg_compat::optional<std::string>& ns = {},
1037 bool is_suppressed = false);
1038
1039 const environment&
1040 get_environment() const;
1041
1042 size_t
1043 get_index() const;
1044
1045 void
1046 set_index(size_t);
1047
1048 const string&
1049 get_name() const;
1050
1051 void
1052 set_name(const string& n);
1053
1054 type
1055 get_type() const;
1056
1057 void
1058 set_type(type t);
1059
1060 size_t
1061 get_size() const;
1062
1063 void
1064 set_size(size_t);
1065
1066 binding
1067 get_binding() const;
1068
1069 void
1071
1072 version&
1073 get_version() const;
1074
1075 void
1076 set_version(const version& v);
1077
1078 void
1080
1082 get_visibility() const;
1083
1084 bool
1085 is_defined() const;
1086
1087 void
1088 is_defined(bool d);
1089
1090 bool
1091 is_public() const;
1092
1093 bool
1094 is_function() const;
1095
1096 bool
1097 is_variable() const;
1098
1099 bool
1100 is_in_ksymtab() const;
1101
1102 void
1104
1106 get_crc() const;
1107
1108 void
1110
1112 get_namespace() const;
1113
1114 void
1116
1117 bool
1118 is_suppressed() const;
1119
1120 void
1122
1123 const elf_symbol_sptr
1124 get_main_symbol() const;
1125
1128
1129 bool
1130 is_main_symbol() const;
1131
1133 update_main_symbol(const std::string&);
1134
1136 get_next_alias() const;
1137
1138 bool
1139 has_aliases() const;
1140
1141 int
1142 get_number_of_aliases() const;
1143
1144 void
1145 add_alias(const elf_symbol_sptr&);
1146
1147 bool
1148 is_common_symbol() const;
1149
1150 bool
1152
1155
1156 void
1158
1159 const string&
1160 get_id_string() const;
1161
1163 get_alias_from_name(const string& name) const;
1164
1166 get_alias_which_equals(const elf_symbol& other) const;
1167
1169 get_alias_with_default_symbol_version() const;
1170
1171 string
1173 bool include_symbol_itself = true) const;
1174
1175 string
1176 get_aliases_id_string(bool include_symbol_itself = true) const;
1177
1178 static bool
1179 get_name_and_version_from_id(const string& id,
1180 string& name,
1181 string& ver);
1182
1183 bool
1184 operator==(const elf_symbol&) const;
1185
1186 bool
1187 does_alias(const elf_symbol&) const;
1188}; // end class elf_symbol.
1189
1190std::ostream&
1191operator<<(std::ostream& o, elf_symbol::type t);
1192
1193std::ostream&
1194operator<<(std::ostream& o, elf_symbol::binding t);
1195
1196std::ostream&
1197operator<<(std::ostream& o, elf_symbol::visibility t);
1198
1199bool
1201
1202bool
1204
1205bool
1207
1208bool
1210
1211bool
1213
1214bool
1215operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1216
1217bool
1218operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1219
1220bool
1221elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1222
1223void
1224compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1225 const string_elf_symbols_map_type& symtab,
1226 vector<elf_symbol_sptr>& alias_set);
1227
1228/// The abstraction of the version of an ELF symbol.
1230{
1231 struct priv;
1232 std::unique_ptr<priv> priv_;
1233
1234public:
1235 version();
1236
1237 version(const string& v,
1238 bool is_default);
1239
1240 version(const version& v);
1241
1242 ~version();
1243
1244 operator const string&() const;
1245
1246 const string&
1247 str() const;
1248
1249 void
1250 str(const string& s);
1251
1252 bool
1253 is_default() const;
1254
1255 void
1256 is_default(bool f);
1257
1258 bool
1259 is_empty() const;
1260
1261 bool
1262 operator==(const version& o) const;
1263
1264 bool
1265 operator!=(const version& o) const;
1266
1267 version&
1268 operator=(const version& o);
1269};// end class elf_symbol::version
1270
1271class context_rel;
1272/// A convenience typedef for shared pointers to @ref context_rel
1273typedef shared_ptr<context_rel> context_rel_sptr;
1274
1275/// The abstraction of the relationship between an entity and its
1276/// containing scope (its context). That relationship can carry
1277/// properties like access rights (if the parent is a class_decl),
1278/// etc.
1279///
1280/// But importantly, this relationship carries a pointer to the
1281/// actualy parent.
1283{
1284protected:
1285 struct priv;
1286 std::unique_ptr<priv> priv_;
1287
1288 scope_decl* scope_;
1289 enum access_specifier access_;
1290 bool is_static_;
1291
1292public:
1293 context_rel();
1294
1296
1299 bool f);
1300
1302 get_scope() const;
1303
1305 get_access_specifier() const;
1306
1307 void
1308 set_access_specifier(access_specifier a);
1309
1310 bool
1311 get_is_static() const;
1312
1313 void
1314 set_is_static(bool s);
1315
1316 void
1317 set_scope(scope_decl_sptr s);
1318
1319 bool
1320 operator==(const context_rel& o)const;
1321
1322 bool
1323 operator!=(const context_rel& o) const;
1324
1325 virtual ~context_rel();
1326};// end class context_rel
1327
1328/// A bitfield that gives callers of abigail::ir::equals() some
1329/// insight about how different two internal representation artifacts
1330/// are.
1332{
1333 NO_CHANGE_KIND = 0,
1334
1335 /// This means that a given IR artifact has a local type change.
1337
1338 /// This means that a given IR artifact has a local non-type change.
1339 /// That is a change that is carried by the artifact itself, not by
1340 /// its type.
1342
1343 /// Testing (anding) against this mask means that a given IR artifact has
1344 /// local differences, with respect to the other artifact it was compared
1345 /// against. A local change is a change that is carried by the artifact
1346 /// itself (or its type), rather than by one off its sub-types.
1348
1349 /// This means that a given IR artifact has changes in some of its
1350 /// sub-types, with respect to the other artifact it was compared
1351 /// against.
1353};// end enum change_kind
1354
1357
1360
1363
1366
1367bool
1369 const decl_base& r,
1370 change_kind* k);
1371
1372bool
1373equals(const decl_base& l, const decl_base& r, change_kind*,
1374 bool qualified_name = true, bool linkage_name = true);
1375
1376/// The base class of both types and declarations.
1378{
1381
1382public:
1383
1384 /// This is a bitmap type which instance is meant to contain the
1385 /// runtime type of a given ABI artifact. Bits of the identifiers
1386 /// of the type of a given artifact as well as the types it inherits
1387 /// from are to be set to 1.
1389 {
1390 ABSTRACT_TYPE_OR_DECL,
1391 ABSTRACT_DECL_BASE = 1,
1392 ABSTRACT_SCOPE_DECL = 1 << 1,
1393 GLOBAL_SCOPE_DECL = 1 << 2,
1394 NAMESPACE_DECL = 1 << 3,
1395 VAR_DECL = 1 << 4,
1396 FUNCTION_DECL = 1 << 5,
1397 FUNCTION_PARAMETER_DECL = 1 << 6,
1398 METHOD_DECL = 1 << 7,
1399 TEMPLATE_DECL = 1 << 8,
1400 ABSTRACT_TYPE_BASE = 1 << 9,
1401 ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1402 BASIC_TYPE = 1 << 11,
1403 SUBRANGE_TYPE = 1 << 12,
1404 QUALIFIED_TYPE = 1 << 13,
1405 POINTER_TYPE = 1 << 14,
1406 REFERENCE_TYPE = 1 << 15,
1407 POINTER_TO_MEMBER_TYPE = 1 << 16,
1408 ARRAY_TYPE = 1 << 17,
1409 ENUM_TYPE = 1 << 18,
1410 TYPEDEF_TYPE = 1 << 19,
1411 CLASS_TYPE = 1 << 20,
1412 UNION_TYPE = 1 << 21,
1413 FUNCTION_TYPE = 1 << 22,
1414 METHOD_TYPE = 1 << 23,
1415 }; // end enum type_or_decl_kind
1416
1418 kind() const;
1419
1420protected:
1421 void
1422 kind(enum type_or_decl_kind);
1423
1424 const void*
1425 runtime_type_instance() const;
1426
1427 void*
1429
1430 void
1431 runtime_type_instance(void*);
1432
1433 const void*
1435
1436 void*
1438
1439 virtual hash_t
1440 hash_value() const;
1441
1442 void
1443 set_hash_value(hash_t) const;
1444
1446 operator=(const type_or_decl_base&);
1447
1448public:
1449 struct priv;
1450 mutable std::unique_ptr<priv> priv_;
1451
1453 enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1454
1455 virtual ~type_or_decl_base();
1456
1457 bool
1458 get_is_artificial() const;
1459
1460 void
1461 set_is_artificial(bool);
1462
1463 const environment&
1464 get_environment() const;
1465
1466 void
1468
1469 location&
1471
1472 bool
1474
1475 offset_t
1476 get_native_offset() const;
1477
1478 void
1480
1481 const corpus*
1482 get_corpus() const;
1483
1484 void
1485 set_corpus(corpus*) const;
1486
1487 corpus*
1488 get_corpus();
1489
1490 void
1492
1493 const translation_unit*
1494 get_translation_unit() const;
1495
1498
1499 const type_or_decl_base*
1500 get_original_artefact() const;
1501
1502 void
1504
1505 const interned_string&
1506 get_cached_pretty_representation(bool internal = false) const;
1507
1508 std::recursive_mutex&
1509 get_mutex() const;
1510
1511 virtual bool
1513
1514 virtual string
1515 get_pretty_representation(bool internal = false,
1516 bool qualified_name = true) const = 0;
1517
1521
1525
1529
1533
1534 friend class_decl*
1536
1537 friend type_base*
1538 is_type(const type_or_decl_base*);
1539
1540 friend decl_base*
1541 is_decl(const type_or_decl_base* d);
1542
1543 friend hash_t
1545
1546 friend hash_t
1548
1549 friend hash_t
1551
1552 template<typename T>
1553 friend hash_t
1554 set_or_get_cached_hash_value(const T& type_or_decl);
1555}; // end class type_or_decl_base
1556
1560
1564
1568
1572
1573bool
1575
1576bool
1578
1579bool
1581
1582/// The base type of all declarations.
1583class decl_base : public virtual type_or_decl_base
1584{
1585 // Forbidden
1586 decl_base();
1587
1588 struct priv;
1589
1590protected:
1591
1592 const interned_string&
1593 peek_qualified_name() const;
1594
1595 void
1597
1598 const interned_string&
1600
1601 void
1603
1604public:
1605 // This is public because some internals of the library need to
1606 // update it. But it's opaque to client code anyway, so no big
1607 // deal. Also, it's not handled by a shared_ptr because accessing
1608 // the data members of the priv struct for this decl_base shows up
1609 // on performance profiles when dealing with big binaries with a lot
1610 // of types; dereferencing the shared_ptr involves locking of some
1611 // sort and that is slower than just dereferencing a pointer likere
1612 // here. There are other types for which the priv pointer is
1613 // managed using shared_ptr just fine, because those didn't show up
1614 // during our performance profiling.
1615 std::unique_ptr<priv> priv_;
1616
1617 /// Facility to hash instances of decl_base.
1618 struct hash;
1619
1620 /// ELF visibility
1622 {
1623 VISIBILITY_NONE,
1624 VISIBILITY_DEFAULT,
1625 VISIBILITY_PROTECTED,
1626 VISIBILITY_HIDDEN,
1627 VISIBILITY_INTERNAL
1628 };
1629
1630 /// ELF binding
1632 {
1633 BINDING_NONE,
1634 BINDING_LOCAL,
1635 BINDING_GLOBAL,
1636 BINDING_WEAK
1637 };
1638
1639 virtual void
1641
1642protected:
1643 void
1644 set_context_rel(context_rel *c);
1645 decl_base(const decl_base&);
1646
1647public:
1648 decl_base(const environment& e,
1649 const string& name,
1650 const location& locus,
1651 const string& mangled_name = "",
1652 visibility vis = VISIBILITY_DEFAULT);
1653
1654 decl_base(const environment& e,
1655 const interned_string& name,
1656 const location& locus,
1657 const interned_string& mangled_name = interned_string(),
1658 visibility vis = VISIBILITY_DEFAULT);
1659
1660 decl_base(const environment&, const location&);
1661
1662 const context_rel*
1663 get_context_rel() const;
1664
1667
1668 virtual bool
1669 operator==(const decl_base&) const;
1670
1671 virtual bool
1672 operator!=(const decl_base&) const;
1673
1674 virtual bool
1676
1677 virtual ~decl_base();
1678
1679 virtual string
1680 get_pretty_representation(bool internal = false,
1681 bool qualified_name = true) const;
1682
1683 void
1684 set_qualified_name(const interned_string&) const;
1685
1686 virtual void
1687 get_qualified_name(interned_string& qualified_name,
1688 bool internal = false) const;
1689
1690 virtual const interned_string&
1691 get_qualified_name(bool internal = false) const;
1692
1693 virtual const interned_string&
1694 get_scoped_name() const;
1695
1696 bool
1698
1699 void
1701
1702 const location&
1703 get_location() const;
1704
1705 void
1706 set_location(const location& l);
1707
1708 virtual const interned_string&
1709 get_name() const;
1710
1711 const interned_string&
1713
1714 virtual void
1715 set_name(const string& n);
1716
1717 bool
1718 get_is_anonymous() const;
1719
1720 void
1721 set_is_anonymous(bool);
1722
1723 bool
1725
1726 bool
1728
1729 std::list<typedef_decl_sptr>&
1730 get_naming_typedefs() const;
1731
1732 void
1734
1735 bool
1737
1738 const interned_string&
1739 get_linkage_name() const;
1740
1741 virtual void
1742 set_linkage_name(const string& m);
1743
1745 get_scope() const;
1746
1748 get_visibility() const;
1749
1750 void
1752
1753 const decl_base_sptr
1755
1756 void
1757 set_earlier_declaration(const decl_base_sptr&);
1758
1759 const decl_base_sptr
1761
1762 void
1763 set_definition_of_declaration(const decl_base_sptr&);
1764
1765 const decl_base*
1767
1768 bool
1770
1771 void
1773
1774 friend bool
1775 equals(const decl_base& l, const decl_base& r, change_kind*,
1776 bool qualified_name , bool linkage_name);
1777
1778 friend bool
1779 equals(const var_decl&, const var_decl&, change_kind*);
1780
1781 friend bool
1783
1784 friend bool
1786 const decl_base& r,
1787 change_kind* k);
1788
1789 friend decl_base_sptr
1790 add_decl_to_scope(decl_base_sptr decl, scope_decl_sptr scpe);
1791
1792 friend void
1793 remove_decl_from_scope(decl_base_sptr);
1794
1795 friend decl_base_sptr
1796 insert_decl_into_scope(decl_base_sptr,
1797 vector<shared_ptr<decl_base> >::iterator,
1799
1800 friend enum access_specifier
1802
1803 friend enum access_specifier
1804 get_member_access_specifier(const decl_base_sptr& d);
1805
1806 friend void
1809
1810 friend bool
1812
1813 friend bool
1814 get_member_is_static(const decl_base_sptr& d);
1815
1816 friend void
1817 set_member_is_static(const decl_base_sptr& d, bool s);
1818
1819 friend void
1820 set_member_is_static(decl_base& d, bool s);
1821
1822 friend bool
1824
1825 friend class class_or_union;
1826 friend class class_decl;
1827 friend class scope_decl;
1828};// end class decl_base
1829
1830bool
1831operator==(const decl_base_sptr&, const decl_base_sptr&);
1832
1833bool
1834operator!=(const decl_base_sptr&, const decl_base_sptr&);
1835
1836bool
1837operator==(const type_base_sptr&, const type_base_sptr&);
1838
1839bool
1840operator!=(const type_base_sptr&, const type_base_sptr&);
1841
1842std::ostream&
1843operator<<(std::ostream&, decl_base::visibility);
1844
1845std::ostream&
1846operator<<(std::ostream&, decl_base::binding);
1847
1848bool
1849equals(const scope_decl&, const scope_decl&, change_kind*);
1850
1851/// A declaration that introduces a scope.
1852class scope_decl : public virtual decl_base
1853{
1854 struct priv;
1855
1856public:
1857 std::unique_ptr<priv> priv_;
1858
1859 /// Convenience typedef for a vector of @ref decl_base_sptr.
1860 typedef std::vector<decl_base_sptr > declarations;
1861 /// Convenience typedef for a vector of @ref function_type_sptr.
1862 typedef std::vector<function_type_sptr > function_types;
1863 /// Convenience typedef for a vector of @ref scope_decl_sptr.
1864 typedef std::vector<scope_decl_sptr> scopes;
1865
1866 scope_decl() = delete;
1867
1868protected:
1869
1870public:
1871
1872 scope_decl(const environment& env,
1873 const string& name, const location& locus,
1874 visibility vis = VISIBILITY_DEFAULT);
1875
1876 scope_decl(const environment& env, location& l);
1877
1878 virtual bool
1879 operator==(const decl_base&) const;
1880
1882 get_canonical_types() const;
1883
1886
1889
1890 const declarations&
1891 get_member_decls() const;
1892
1895
1897 get_member_decls_copy() const;
1898
1899 const declarations&
1901
1902 virtual size_t
1904
1905 virtual size_t
1907
1908 virtual size_t
1910
1911 scopes&
1913
1914 const scopes&
1915 get_member_scopes() const;
1916
1917 bool
1918 is_empty() const;
1919
1920 bool
1921 find_iterator_for_member(const decl_base*, declarations::iterator&);
1922
1923 bool
1924 find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1925
1926 bool
1927 remove_member_type(type_base_sptr t);
1928
1930 get_member_types() const;
1931
1934
1937
1938 type_base_sptr
1939 find_member_type(const string& name) const;
1940
1941 virtual bool
1943
1944 virtual ~scope_decl();
1945
1946 friend decl_base_sptr
1947 add_decl_to_scope(decl_base_sptr decl, scope_decl_sptr scope);
1948
1949 friend decl_base_sptr
1950 insert_decl_into_scope(decl_base_sptr decl,
1951 scope_decl::declarations::iterator before,
1952 scope_decl_sptr scope);
1953
1954 friend void
1955 remove_decl_from_scope(decl_base_sptr decl);
1956
1957 friend decl_base_sptr
1958 insert_member_decl(scope_decl_sptr scope,
1959 decl_base_sptr member,
1960 declarations::iterator before);
1961
1962 friend void
1963 insert_member_type(type_base_sptr t,
1964 declarations::iterator before);
1965
1966 friend bool
1967 remove_member_decl(scope_decl_sptr scope, decl_base_sptr member);
1968
1969 friend decl_base_sptr
1970 add_member_decl(scope_decl_sptr scope, decl_base_sptr member);
1971
1972 friend void
1973 add_member_type(scope_decl_sptr scope, type_base_sptr t);
1974
1975 friend type_base_sptr
1976 add_member_type(scope_decl_sptr scope, type_base_sptr t, access_specifier a);
1977};//end class scope_decl
1978
1979bool
1981
1982bool
1984
1985/// This abstracts the global scope of a given translation unit.
1986///
1987/// Only one instance of this class must be present in a given
1988/// translation_unit. That instance is implicitely created the first
1989/// time translatin_unit::get_global_scope is invoked.
1991{
1992 struct priv;
1993 std::unique_ptr<priv> priv_;
1994
1995public:
1996
1998
1999 global_scope(const environment& env);
2000
2002 get_translation_unit() const;
2003
2004 virtual ~global_scope();
2005
2006 friend class corpus;
2007};
2008
2009bool
2010equals(const type_base&, const type_base&, change_kind*);
2011
2012/// An abstraction helper for type declarations
2013class type_base : public virtual type_or_decl_base
2014{
2015 struct priv;
2016
2017public:
2018 // This priv pointer is not handled by a shared_ptr because
2019 // accessing the data members of the priv struct for this type_base
2020 // shows up on performance profiles when dealing with big binaries
2021 // with a lot of types; dereferencing the shared_ptr involves
2022 // locking of some sort and that is slower than just dereferencing a
2023 // pointer likere here. There are other types for which the priv
2024 // pointer is managed using shared_ptr just fine, because those
2025 // didn't show up during our performance profiling.
2026 priv* priv_;
2027
2028private:
2029 // Forbid this.
2030 type_base();
2031
2032protected:
2033
2034public:
2035
2036 struct hash;
2037
2038 type_base(const environment& e, size_t s, size_t a);
2039
2040 virtual hash_t
2041 hash_value() const;
2042
2043 type_base_sptr
2044 get_canonical_type() const;
2045
2046 type_base*
2048
2049 virtual bool
2050 operator==(const type_base&) const;
2051
2052 virtual bool
2053 operator!=(const type_base&) const;
2054
2055 virtual bool
2057
2058 virtual ~type_base();
2059
2060 virtual void
2061 set_size_in_bits(size_t);
2062
2063 virtual size_t
2064 get_size_in_bits() const;
2065
2066 virtual void
2067 set_alignment_in_bits(size_t);
2068
2069 virtual size_t
2070 get_alignment_in_bits() const;
2071
2072 virtual void
2074};//end class type_base
2075
2076
2077/// A predicate for deep equality of instances of
2078/// type_base*
2080{
2081 bool
2082 operator()(const type_base* l, const type_base* r) const
2083 {
2084 if (!!l != !!r)
2085 return false;
2086
2087 if (l == r)
2088 return true;
2089
2090 if (l)
2091 return *l == *r;
2092
2093 return true;
2094 }
2095};
2096
2097/// A predicate for deep equality of instances of
2098/// shared_ptr<type_base>
2100{
2101 bool
2102 operator()(const type_base_sptr l, const type_base_sptr r) const
2103 {
2104 if (!!l != !!r)
2105 return false;
2106
2107 if (l.get() == r.get())
2108 return true;
2109
2110 if (l)
2111 return *l == *r;
2112
2113 return true;
2114 }
2115};
2116
2117bool
2118equals(const type_decl&, const type_decl&, change_kind*);
2119
2120/// A basic type declaration that introduces no scope.
2121class type_decl : public virtual decl_base, public virtual type_base
2122{
2123 // Forbidden.
2124 type_decl();
2125
2126public:
2127
2128 /// Facility to hash instance of type_decl
2129 struct hash;
2130
2131 type_decl(const environment& env,
2132 const string& name,
2133 size_t size_in_bits,
2134 size_t alignment_in_bits,
2135 const location& locus,
2136 const string& mangled_name = "",
2137 visibility vis = VISIBILITY_DEFAULT);
2138
2139 virtual hash_t
2140 hash_value() const;
2141
2142 virtual bool
2143 operator==(const type_base&) const;
2144
2145 virtual bool
2146 operator==(const decl_base&) const;
2147
2148 virtual bool
2149 operator==(const type_decl&) const;
2150
2151 virtual bool
2152 operator!=(const type_base&)const;
2153
2154 virtual bool
2155 operator!=(const decl_base&)const;
2156
2157 virtual bool
2158 operator!=(const type_decl&)const;
2159
2160 virtual void
2161 get_qualified_name(interned_string& qualified_name,
2162 bool internal = false) const;
2163
2164 virtual const interned_string&
2165 get_qualified_name(bool internal = false) const;
2166
2167 virtual string
2168 get_pretty_representation(bool internal = false,
2169 bool qualified_name = true) const;
2170
2171 virtual bool
2173
2174 virtual ~type_decl();
2175};// end class type_decl.
2176
2177bool
2179
2180bool
2182
2183bool
2185
2186/// A type that introduces a scope.
2187class scope_type_decl : public scope_decl, public virtual type_base
2188{
2190
2191public:
2192
2193 scope_type_decl(const environment& env, const string& name,
2194 size_t size_in_bits, size_t alignment_in_bits,
2195 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2196
2197 virtual bool
2198 operator==(const decl_base&) const;
2199
2200 virtual bool
2201 operator==(const type_base&) const;
2202
2203 virtual bool
2205
2206 virtual ~scope_type_decl();
2207};
2208
2209/// The abstraction of a namespace declaration
2211{
2212public:
2213
2214 namespace_decl(const environment& env, const string& name,
2215 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2216
2217 virtual string
2218 get_pretty_representation(bool internal = false,
2219 bool qualified_name = true) const;
2220
2221 virtual bool
2222 operator==(const decl_base&) const;
2223
2224 virtual bool
2226
2227 virtual ~namespace_decl();
2228
2230};// end class namespace_decl
2231
2232/// A convenience typedef for vectors of @ref namespace_decl_sptr
2233typedef vector<namespace_decl_sptr> namespaces_type;
2234
2235bool
2237
2238/// The abstraction of a qualified type.
2239class qualified_type_def : public virtual type_base, public virtual decl_base
2240{
2241 class priv;
2242 std::unique_ptr<priv> priv_;
2243
2244 // Forbidden.
2246
2247protected:
2248 string build_name(bool, bool internal = false) const;
2249 virtual void on_canonical_type_set();
2250
2251public:
2252
2253 /// A Hasher for instances of qualified_type_def
2254 struct hash;
2255
2256 /// Bit field values representing the cv qualifiers of the
2257 /// underlying type.
2258 enum CV
2259 {
2260 CV_NONE = 0,
2261 CV_CONST = 1,
2262 CV_VOLATILE = 1 << 1,
2263 CV_RESTRICT = 1 << 2
2264 };
2265
2266 qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2267
2268 qualified_type_def(const environment& env, CV quals, const location& locus);
2269
2270 virtual hash_t
2271 hash_value() const;
2272
2273 virtual size_t
2274 get_size_in_bits() const;
2275
2276 virtual bool
2277 operator==(const decl_base&) const;
2278
2279 virtual bool
2280 operator==(const type_base&) const;
2281
2282 virtual bool
2283 operator==(const qualified_type_def&) const;
2284
2285 CV
2286 get_cv_quals() const;
2287
2288 void
2289 set_cv_quals(CV cv_quals);
2290
2291 string
2293
2294 type_base_sptr
2295 get_underlying_type() const;
2296
2297 void
2298 set_underlying_type(const type_base_sptr&);
2299
2300 virtual void
2301 get_qualified_name(interned_string& qualified_name,
2302 bool internal = false) const;
2303
2304 virtual const interned_string&
2305 get_qualified_name(bool internal = false) const;
2306
2307 virtual bool
2309
2310 virtual ~qualified_type_def();
2311}; // end class qualified_type_def.
2312
2313bool
2314operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2315
2316bool
2317operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2318
2321
2324
2327
2330
2333
2334std::ostream&
2335operator<<(std::ostream&, qualified_type_def::CV);
2336
2337string
2339
2341get_name_of_qualified_type(const type_base_sptr& underlying_type,
2343 bool qualified = true, bool internal = false);
2344
2345qualified_type_def_sptr
2346lookup_qualified_type(const type_base_sptr&,
2348 const translation_unit&);
2349bool
2351
2352/// The abstraction of a pointer type.
2353class pointer_type_def : public virtual type_base, public virtual decl_base
2354{
2355 struct priv;
2356 std::unique_ptr<priv> priv_;
2357
2358 // Forbidden.
2360
2361protected:
2362 virtual void on_canonical_type_set();
2363
2364public:
2365
2366 /// A hasher for instances of pointer_type_def
2367 struct hash;
2368
2369 pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2370 size_t alignment_in_bits, const location& locus);
2371
2372 pointer_type_def(const environment& env, size_t size_in_bits,
2373 size_t alignment_in_bits, const location& locus);
2374
2375 virtual hash_t
2376 hash_value() const;
2377
2378 void
2379 set_pointed_to_type(const type_base_sptr&);
2380
2381 virtual bool
2382 operator==(const decl_base&) const;
2383
2384 virtual bool
2385 operator==(const type_base&) const;
2386
2387 bool
2388 operator==(const pointer_type_def&) const;
2389
2390 const type_base_sptr
2391 get_pointed_to_type() const;
2392
2393 type_base*
2395
2396 virtual void
2397 get_qualified_name(interned_string&, bool internal = false) const;
2398
2399 virtual const interned_string&
2400 get_qualified_name(bool internal = false) const;
2401
2402 virtual bool
2404
2405 virtual ~pointer_type_def();
2406}; // end class pointer_type_def
2407
2408bool
2410
2411bool
2413
2414bool
2416
2417
2418/// Abstracts a reference type.
2419class reference_type_def : public virtual type_base, public virtual decl_base
2420{
2421 struct priv;
2422 std::unique_ptr<priv> priv_;
2423
2424 // Forbidden.
2426
2427protected:
2428 virtual void on_canonical_type_set();
2429
2430public:
2431
2432 /// Hasher for intances of reference_type_def.
2433 struct hash;
2434
2435 reference_type_def(const type_base_sptr pointed_to_type,
2436 bool lvalue, size_t size_in_bits,
2437 size_t alignment_in_bits, const location& locus);
2438
2439 reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2440 size_t alignment_in_bits, const location& locus);
2441
2442 virtual hash_t
2443 hash_value() const;
2444
2445 void
2446 set_pointed_to_type(type_base_sptr& pointed_to_type);
2447
2448 virtual bool
2449 operator==(const decl_base&) const;
2450
2451 virtual bool
2452 operator==(const type_base&) const;
2453
2454 bool
2455 operator==(const reference_type_def&) const;
2456
2457 type_base_sptr
2458 get_pointed_to_type() const;
2459
2460 bool
2461 is_lvalue() const;
2462
2463 virtual void
2464 get_qualified_name(interned_string& qualified_name,
2465 bool internal = false) const;
2466
2467 virtual const interned_string&
2468 get_qualified_name(bool internal = false) const;
2469
2470 virtual string
2471 get_pretty_representation(bool internal = false,
2472 bool qualified_name = true) const;
2473
2474 virtual bool
2476
2477 virtual ~reference_type_def();
2478}; // end class reference_type_def
2479
2480bool
2482
2483bool
2485
2486/// The abstraction of a pointer-to-member type.
2487class ptr_to_mbr_type : public virtual type_base,
2488 public virtual decl_base
2489{
2490 struct priv;
2491 std::unique_ptr<priv> priv_;
2492
2493 // Forbidden
2494 ptr_to_mbr_type() = delete;
2495
2496 public:
2497
2498 /// Hasher for instances of @ref ptr_to_mbr_type;
2499 struct hash;
2500
2501 ptr_to_mbr_type(const environment& env,
2502 const type_base_sptr& member_type,
2503 const type_base_sptr& containing_type,
2504 size_t size_in_bits,
2505 size_t alignment_in_bits,
2506 const location& locus);
2507
2508 virtual const interned_string&
2509 get_name() const;
2510
2511 virtual hash_t
2512 hash_value() const;
2513
2514 const type_base_sptr&
2515 get_member_type() const;
2516
2517 const type_base_sptr&
2518 get_containing_type() const;
2519
2520 bool
2521 operator==(const ptr_to_mbr_type&) const;
2522
2523 virtual bool
2524 operator==(const type_base&) const;
2525
2526 virtual bool
2527 operator==(const decl_base&) const;
2528
2529 virtual void
2530 get_qualified_name(interned_string& qualified_name,
2531 bool internal = false) const;
2532
2533 virtual const interned_string&
2534 get_qualified_name(bool internal = false) const;
2535
2536 virtual bool
2538
2539 virtual ~ptr_to_mbr_type();
2540}; // end class ptr_to_mbr_type
2541
2542bool
2543equals(const ptr_to_mbr_type&,
2544 const ptr_to_mbr_type&,
2545 change_kind*);
2546
2547bool
2549
2550/// The abstraction of an array type.
2551class array_type_def : public virtual type_base, public virtual decl_base
2552{
2553 struct priv;
2554 std::unique_ptr<priv> priv_;
2555
2556 // Forbidden.
2558
2559 void update_size();
2560
2561public:
2562
2563 /// Hasher for intances of array_type_def.
2564 struct hash;
2565
2566 class subrange_type;
2567
2568 /// Convenience typedef for a shared pointer on a @ref
2569 /// function_decl::subrange
2570 typedef shared_ptr<subrange_type> subrange_sptr;
2571
2572 /// Convenience typedef for a vector of @ref subrange_sptr
2573 typedef std::vector<subrange_sptr> subranges_type;
2574
2575 /// Abstraction for an array range type, like in Ada, or just for an
2576 /// array dimension like in C or C++.
2577 class subrange_type : public virtual type_base, public virtual decl_base
2578 {
2579 struct priv;
2580 std::unique_ptr<priv> priv_;
2581
2582 // Forbidden.
2583 subrange_type();
2584 public:
2585
2586 virtual ~subrange_type();
2587 /// This class is to hold the value of the bound of a subrange.
2588 /// The value can be either signed or unsigned, at least when it
2589 /// comes from DWARF. The class keeps the sign information, but
2590 /// allows users to access the value as signed or unsigned as they
2591 /// see fit.
2593 {
2594 public:
2595 enum signedness
2596 {
2597 UNSIGNED_SIGNEDNESS,
2598 SIGNED_SIGNEDNESS
2599 };
2600
2601 private:
2602 signedness s_;
2603
2604 public:
2605 union
2606 {
2607 uint64_t unsigned_;
2608 int64_t signed_;
2609 } v_;
2610 bound_value();
2611 bound_value(uint64_t);
2612 bound_value(int64_t);
2613 enum signedness get_signedness() const;
2614 void set_signedness(enum signedness s);
2615 int64_t get_signed_value() const;
2616 uint64_t get_unsigned_value();
2617 void set_unsigned(uint64_t v);
2618 void set_signed(int64_t v);
2619 bool operator==(const bound_value&) const;
2620 }; //end class bound_value
2621
2622 /// Hasher for an instance of array::subrange
2623 struct hash;
2624
2625 subrange_type(const environment& env,
2626 const string& name,
2627 bound_value lower_bound,
2628 bound_value upper_bound,
2629 const type_base_sptr& underlying_type,
2630 const location& loc,
2631 translation_unit::language l = translation_unit::LANG_C11);
2632
2633 subrange_type(const environment& env,
2634 const string& name,
2635 bound_value lower_bound,
2636 bound_value upper_bound,
2637 const location& loc,
2638 translation_unit::language l = translation_unit::LANG_C11);
2639
2640 subrange_type(const environment& env,
2641 const string& name,
2642 bound_value upper_bound,
2643 const location& loc,
2644 translation_unit::language l = translation_unit::LANG_C11);
2645
2646 virtual hash_t
2647 hash_value() const;
2648
2649 type_base_sptr
2650 get_underlying_type() const;
2651
2652 void
2653 set_underlying_type(const type_base_sptr &);
2654
2655 int64_t
2656 get_upper_bound() const;
2657
2658 int64_t
2659 get_lower_bound() const;
2660
2661 void
2662 set_upper_bound(int64_t ub);
2663
2664 void
2665 set_lower_bound(int64_t lb);
2666
2667 uint64_t
2668 get_length() const;
2669
2670 bool
2671 is_non_finite() const;
2672
2673 void
2674 is_non_finite(bool);
2675
2677 get_language() const;
2678
2679 virtual bool
2680 operator==(const decl_base&) const;
2681
2682 virtual bool
2683 operator==(const type_base&) const;
2684
2685 bool
2686 operator==(const subrange_type& o) const;
2687
2688 bool
2689 operator!=(const decl_base& o) const;
2690
2691 bool
2692 operator!=(const type_base& o) const;
2693
2694 bool
2695 operator!=(const subrange_type& o) const;
2696
2697 string
2698 as_string() const;
2699
2700 static string
2701 vector_as_string(const vector<subrange_sptr>&);
2702
2703 virtual string
2704 get_pretty_representation(bool internal = false,
2705 bool qualified_name = true) const;
2706
2707 virtual bool
2709 }; // end class subrange_type
2710
2711 array_type_def(const type_base_sptr type,
2712 const std::vector<subrange_sptr>& subs,
2713 const location& locus);
2714
2715 array_type_def(const environment& env,
2716 const std::vector<subrange_sptr>& subs,
2717 const location& locus);
2718
2719 virtual hash_t
2720 hash_value() const;
2721
2723 get_language() const;
2724
2725 virtual bool
2726 operator==(const decl_base&) const;
2727
2728 virtual bool
2729 operator==(const type_base&) const;
2730
2731 virtual void
2732 get_qualified_name(interned_string& qualified_name,
2733 bool internal = false) const;
2734
2735 virtual const interned_string&
2736 get_qualified_name(bool internal = false) const;
2737
2738 const type_base_sptr
2739 get_element_type() const;
2740
2741 void
2742 set_element_type(const type_base_sptr& element_type);
2743
2744 virtual void
2745 append_subranges(const std::vector<subrange_sptr>& subs);
2746
2747 virtual int
2748 get_dimension_count() const;
2749
2750 virtual bool
2751 is_non_finite() const;
2752
2753 virtual string
2754 get_pretty_representation(bool internal = false,
2755 bool qualified_name = true) const;
2756
2757 virtual string
2758 get_subrange_representation() const;
2759
2760 virtual bool
2762
2763 const location&
2764 get_location() const;
2765
2766 const std::vector<subrange_sptr>&
2767 get_subranges() const;
2768
2769 virtual ~array_type_def();
2770
2771}; // end class array_type_def
2772
2775
2778
2779bool
2782 change_kind*);
2783
2784bool
2785equals(const enum_type_decl& l,
2786 const enum_type_decl& r,
2787 change_kind* k, bool name = true);
2788
2789bool
2791 const enum_type_decl& r,
2792 change_kind* k);
2793
2794/// Abstracts a declaration for an enum type.
2795class enum_type_decl : public virtual type_base, public virtual decl_base
2796{
2797 class priv;
2798 std::unique_ptr<priv> priv_;
2799
2800 // Forbidden
2802
2803public:
2804
2805 /// A hasher for an enum_type_decl.
2806 struct hash;
2807
2808 /// Enumerator Datum.
2809 class enumerator;
2810
2811 /// Convenience typedef for a list of @ref enumerator.
2812 typedef std::vector<enumerator> enumerators;
2813
2814 /// Constructor of an enum type declaration.
2815 ///
2816 /// @param name the name of the enum
2817 ///
2818 /// @param locus the locus at which the enum appears in the source
2819 /// code.
2820 ///
2821 /// @param underlying_type the underlying type of the enum
2822 ///
2823 /// @param enms a list of enumerators for this enum.
2824 ///
2825 /// @param mangled_name the mangled name of the enum type.
2826 ///
2827 /// @param vis the visibility of instances of this type.
2828 enum_type_decl(const string& name,
2829 const location& locus,
2830 type_base_sptr underlying_type,
2831 enumerators& enms,
2832 const string& mangled_name = "",
2833 visibility vis = VISIBILITY_DEFAULT);
2834
2835 virtual hash_t
2836 hash_value() const;
2837
2838 type_base_sptr
2839 get_underlying_type() const;
2840
2841 const enumerators&
2842 get_enumerators() const;
2843
2844 const enumerators&
2845 get_sorted_enumerators() const;
2846
2849
2850 bool
2851 find_enumerator_by_value(int64_t value,
2853
2854 bool
2855 find_enumerator_by_name(const string& name,
2857
2858 virtual string
2859 get_pretty_representation(bool internal = false,
2860 bool qualified_name = true) const;
2861
2862 virtual bool
2863 operator==(const decl_base&) const;
2864
2865 virtual bool
2866 operator==(const type_base&) const;
2867
2868 virtual bool
2870
2871 virtual ~enum_type_decl();
2872}; // end class enum_type_decl
2873
2874bool
2876
2877bool
2879
2880/// The abstraction of an enumerator
2882{
2883 class priv;
2884 std::unique_ptr<priv> priv_;
2885
2886public:
2887
2888 enumerator();
2889
2890 ~enumerator();
2891
2892 enumerator(const string& name, int64_t value);
2893
2894 enumerator(const enumerator&);
2895
2896 enumerator&
2897 operator=(const enumerator&);
2898
2899 bool
2900 operator==(const enumerator& other) const;
2901
2902 bool
2903 operator!=(const enumerator& other) const;
2904
2905 const string&
2906 get_name() const;
2907
2908 const string&
2909 get_qualified_name(bool internal = false) const;
2910
2911 void
2912 set_name(const string& n);
2913
2914 int64_t
2915 get_value() const;
2916
2917 void
2918 set_value(int64_t v);
2919
2921 get_enum_type() const;
2922
2923 void
2925}; // end class enum_type_def::enumerator
2926
2927bool
2929 const enum_type_decl &enom);
2930
2931bool
2933
2934/// The abstraction of a typedef declaration.
2935class typedef_decl : public virtual type_base, public virtual decl_base
2936{
2937 struct priv;
2938 std::unique_ptr<priv> priv_;
2939
2940 // Forbidden
2941 typedef_decl();
2942
2943public:
2944
2945 /// Hasher for the typedef_decl type.
2946 struct hash;
2947
2948 typedef_decl(const string& name,
2949 const type_base_sptr underlying_type,
2950 const location& locus,
2951 const string& mangled_name = "",
2952 visibility vis = VISIBILITY_DEFAULT);
2953
2954 typedef_decl(const string& name,
2955 const environment& env,
2956 const location& locus,
2957 const string& mangled_name = "",
2958 visibility vis = VISIBILITY_DEFAULT);
2959
2960 virtual hash_t
2961 hash_value() const;
2962
2963 virtual size_t
2964 get_size_in_bits() const;
2965
2966 virtual size_t
2967 get_alignment_in_bits() const;
2968
2969 virtual bool
2970 operator==(const decl_base&) const;
2971
2972 virtual bool
2973 operator==(const type_base&) const;
2974
2975 virtual string
2976 get_pretty_representation(bool internal = false,
2977 bool qualified_name = true) const;
2978
2979 type_base_sptr
2980 get_underlying_type() const;
2981
2982 void
2983 set_underlying_type(const type_base_sptr&);
2984
2985 virtual void
2986 get_qualified_name(interned_string& qualified_name,
2987 bool internal = false) const;
2988
2989 virtual const interned_string&
2990 get_qualified_name(bool internal = false) const;
2991
2992 virtual bool
2994
2995 virtual ~typedef_decl();
2996};// end class typedef_decl
2997
2998/// The abstraction for a data member context relationship. This
2999/// relates a data member to its parent class.
3000///
3001/// The relationship carries properties like the offset of the data
3002/// member, if applicable.
3004{
3005protected:
3006 struct priv;
3007 std::unique_ptr<priv> priv_;
3008
3009public:
3011
3013 bool is_laid_out,
3014 size_t offset_in_bits,
3016 bool is_static);
3017
3019
3020 bool
3021 get_is_laid_out() const;
3022
3023 void
3024 set_is_laid_out(bool f);
3025
3026 size_t
3027 get_offset_in_bits() const;
3028
3029 void
3030 set_offset_in_bits(size_t o);
3031
3032 const var_decl_sptr
3034
3035 void
3037
3038 bool
3039 operator==(const dm_context_rel& o) const;
3040
3041 bool
3042 operator!=(const dm_context_rel& o) const;
3043
3044 virtual ~dm_context_rel();
3045};// end class class_decl::dm_context_rel
3046
3047bool
3048equals(const var_decl&, const var_decl&, change_kind*);
3049
3050bool
3052
3053bool
3055
3056bool
3058 const array_type_def_sptr& r);
3059
3060bool
3062
3063bool
3065 const pointer_type_def_sptr&);
3066
3067/// Abstracts a variable declaration.
3068class var_decl : public virtual decl_base
3069{
3070 struct priv;
3071 std::unique_ptr<priv> priv_;
3072
3073 // Forbidden
3074 var_decl();
3075
3076 virtual void
3077 set_scope(scope_decl_sptr);
3078
3079public:
3080
3081 /// Equality functor to compare pointers to variable_decl.
3082 struct ptr_equal;
3083
3084 var_decl(const string& name,
3085 type_base_sptr type,
3086 const location& locus,
3087 const string& mangled_name,
3088 visibility vis = VISIBILITY_DEFAULT,
3089 binding bind = BINDING_NONE);
3090
3091 virtual bool
3092 operator==(const decl_base&) const;
3093
3094 const type_base_sptr
3095 get_type() const;
3096
3097 void
3098 set_type(type_base_sptr&);
3099
3100 const type_base*
3101 get_naked_type() const;
3102
3103 binding
3104 get_binding() const;
3105
3106 void
3108
3109 void
3110 set_symbol(const elf_symbol_sptr& sym);
3111
3112 const elf_symbol_sptr
3113 get_symbol() const;
3114
3116 clone() const;
3117
3119 get_id() const;
3120
3121 virtual const interned_string&
3122 get_qualified_name(bool internal = false) const;
3123
3124 virtual string
3125 get_pretty_representation(bool internal = false,
3126 bool qualified_name = true) const;
3127
3128 string
3129 get_anon_dm_reliable_name(bool qualified = true) const;
3130
3131 virtual bool
3133
3134 virtual ~var_decl();
3135
3136 friend void
3138
3139 friend uint64_t
3141
3142 friend uint64_t
3144
3145 friend uint64_t
3147
3148 friend uint64_t
3150
3151 friend void
3153
3154 friend bool
3156
3157 friend bool
3159}; // end class var_decl
3160
3161bool
3162equals(const function_decl& l, const function_decl& r, change_kind* k,
3163 bool linkage_name = true, bool elf_symbol = true);
3164
3165/// Abstraction for a function declaration.
3166class function_decl : public virtual scope_decl
3167{
3168
3169public:
3170
3171 struct priv;
3172 // This priv pointer is not handled by a shared_ptr because
3173 // accessing the data members of the priv struct for this
3174 // function_decl shows up on performance profiles when dealing with
3175 // big binaries with a lot of types; dereferencing the shared_ptr
3176 // involves locking of some sort and that is slower than just
3177 // dereferencing a pointer likere here. There are other types for
3178 // which the priv pointer is managed using shared_ptr just fine,
3179 // because those didn't show up during our performance profiling.
3180 priv* priv_;
3181
3182 /// Equality functor to compare pointers to function_decl
3183 struct ptr_equal;
3184
3185 /// Abstraction for the parameter of a function.
3186 class parameter;
3187
3188 /// Convenience typedef for a shared pointer on a @ref
3189 /// function_decl::parameter
3190 typedef shared_ptr<parameter> parameter_sptr;
3191
3192 /// Convenience typedef for a vector of @ref parameter_sptr
3193 typedef std::vector<parameter_sptr> parameters;
3194
3195 function_decl(const string& name,
3197 bool declared_inline,
3198 const location& locus,
3199 const string& mangled_name,
3200 visibility vis,
3201 binding bind);
3202
3203 function_decl(const string& name,
3204 type_base_sptr fn_type,
3205 bool declared_inline,
3206 const location& locus,
3207 const string& mangled_name = "",
3208 visibility vis = VISIBILITY_DEFAULT,
3209 binding bind = BINDING_GLOBAL);
3210
3211 virtual string
3212 get_pretty_representation(bool internal = false,
3213 bool qualified_name = true) const;
3214
3215 string
3216 get_pretty_representation_of_declarator (bool internal = false) const;
3217
3218 const std::vector<parameter_sptr >&
3219 get_parameters() const;
3220
3221 void
3223
3224 void
3225 append_parameters(std::vector<parameter_sptr >& parms);
3226
3227 parameters::const_iterator
3229
3230 parameters::const_iterator
3232
3233 const function_type_sptr
3234 get_type() const;
3235
3236 const function_type*
3237 get_naked_type() const;
3238
3239 const type_base_sptr
3240 get_return_type() const;
3241
3242 void
3243 set_type(const function_type_sptr& fn_type);
3244
3245 void
3246 set_symbol(const elf_symbol_sptr& sym);
3247
3248 const elf_symbol_sptr
3249 get_symbol() const;
3250
3251 bool
3252 is_declared_inline() const;
3253
3254 void
3255 is_declared_inline(bool);
3256
3257 binding
3258 get_binding() const;
3259
3261 clone() const;
3262
3263 virtual bool
3264 operator==(const decl_base& o) const;
3265
3266 /// Return true iff the function takes a variable number of
3267 /// parameters.
3268 ///
3269 /// @return true if the function taks a variable number
3270 /// of parameters.
3271 bool
3272 is_variadic() const;
3273
3275 get_id(const elf_symbol_sptr& s) const;
3276
3278 get_id() const;
3279
3280 virtual bool
3282
3283 virtual ~function_decl();
3284}; // end class function_decl
3285
3286bool
3288
3289bool
3291
3292bool
3294
3295bool
3298 change_kind*);
3299
3300/// A comparison functor to compare pointer to instances of @ref
3301/// type_or_decl_base.
3303{
3304 /// Comparison operator for ABI artifacts.
3305 ///
3306 /// @param f the first ABI artifact to consider for the comparison.
3307 ///
3308 /// @param s the second ABI artifact to consider for the comparison.
3309 ///
3310 /// @return true iff @p f is lexicographically less than than @p s.
3311 bool
3313 const type_or_decl_base *s)
3314 {
3315 function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3316 if (f_fn && s_fn)
3317 return function_decl_is_less_than(*f_fn, *s_fn);
3318
3319 var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3320 if (f_var && s_var)
3321 return get_name(f_var) < get_name(s_var);
3322
3323 string l_repr = get_pretty_representation(f),
3324 r_repr = get_pretty_representation(s);
3325
3326 return l_repr < r_repr;
3327 }
3328
3329 /// Comparison operator for ABI artifacts.
3330 ///
3331 /// @param f the first ABI artifact to consider for the comparison.
3332 ///
3333 /// @param s the second ABI artifact to consider for the comparison.
3334 ///
3335 /// @return true iff @p f is lexicographically less than than @p s.
3336 bool
3338 const type_or_decl_base_sptr& s)
3339 {return operator()(f.get(), s.get());}
3340}; // end struct type_or_decl_base_comp
3341
3342/// Abstraction of a function parameter.
3344{
3345 struct priv;
3346 std::unique_ptr<priv> priv_;
3347
3348public:
3349
3350 parameter(const type_base_sptr type,
3351 unsigned index,
3352 const string& name,
3353 const location& loc,
3354 bool variadic_marker = false);
3355
3356 parameter(const type_base_sptr type,
3357 unsigned index,
3358 const string& name,
3359 const location& loc,
3360 bool variadic_marker,
3361 bool is_artificial);
3362
3363 parameter(const type_base_sptr type,
3364 const string& name,
3365 const location& loc,
3366 bool variadic_marker = false,
3367 bool is_artificial = false);
3368
3369 parameter(const type_base_sptr type,
3370 unsigned index = 0,
3371 bool variadic_marker = false);
3372
3373 virtual ~parameter();
3374
3375 const type_base_sptr
3376 get_type()const;
3377
3379 get_type_name() const;
3380
3381 const string
3383
3385 get_name_id() const;
3386
3387 unsigned
3388 get_index() const;
3389
3390 void
3391 set_index(unsigned i);
3392
3393 bool
3394 get_variadic_marker() const;
3395
3396 bool
3397 operator==(const parameter& o) const;
3398
3399 virtual bool
3400 operator==(const decl_base&) const;
3401
3402 virtual bool
3404
3405 virtual void
3406 get_qualified_name(interned_string& qualified_name,
3407 bool internal = false) const;
3408
3409 virtual string
3410 get_pretty_representation(bool internal = false,
3411 bool qualified_name = true) const;
3412}; // end class function_decl::parameter
3413
3414bool
3417
3420
3423
3424bool
3426
3427/// Abstraction of a function type.
3428class function_type : public virtual type_base
3429{
3430protected:
3431 virtual void on_canonical_type_set();
3432
3433public:
3434 /// Hasher for an instance of function_type
3435 struct hash;
3436
3437 /// Convenience typedef for a shared pointer on a @ref
3438 /// function_decl::parameter
3439 typedef shared_ptr<function_decl::parameter> parameter_sptr;
3440 /// Convenience typedef for a vector of @ref parameter_sptr
3441 typedef std::vector<parameter_sptr> parameters;
3442
3443 struct priv;
3444 std::unique_ptr<priv> priv_;
3445
3446private:
3447 function_type();
3448
3449public:
3450
3451 function_type(type_base_sptr return_type,
3452 const parameters& parms,
3453 size_t size_in_bits,
3454 size_t alignment_in_bits);
3455
3456 function_type(type_base_sptr return_type,
3457 size_t size_in_bits,
3458 size_t alignment_in_bits);
3459
3460 function_type(const environment& env,
3461 size_t size_in_bits,
3462 size_t alignment_in_bits);
3463
3464 virtual hash_t
3465 hash_value() const;
3466
3467 type_base_sptr
3468 get_return_type() const;
3469
3470 void
3471 set_return_type(type_base_sptr t);
3472
3473 bool
3474 has_empty_parameters() const;
3475
3476 unsigned
3477 get_nb_parameters() const;
3478
3479 const parameters&
3480 get_parameters() const;
3481
3482 const parameter_sptr
3484
3485 const parameter_sptr
3486 get_parm_at(size_t) const;
3487
3488 void
3489 set_parameters(const parameters &p);
3490
3491 void
3493
3494 bool
3495 is_variadic() const;
3496
3497 parameters::const_iterator
3499
3500 parameters::const_iterator
3502
3503 parameters::const_iterator
3504 get_first_parm() const;
3505
3506 const interned_string&
3507 get_cached_name(bool internal = false) const;
3508
3509 virtual bool
3510 operator==(const type_base&) const;
3511
3512 virtual string
3513 get_pretty_representation(bool internal = false,
3514 bool qualified_name = true) const;
3515
3516 virtual bool
3518
3519 virtual ~function_type();
3520
3521 friend bool
3523};//end class function_type
3524
3525/// Abstracts the type of a class member function.
3527{
3528 struct priv;
3529 std::unique_ptr<priv> priv_;
3530
3531 method_type();
3532
3533public:
3534
3535 /// Hasher for intances of method_type
3536 struct hash;
3537
3538 method_type(type_base_sptr return_type,
3539 class_or_union_sptr class_type,
3540 const std::vector<function_decl::parameter_sptr>& parms,
3541 bool is_const,
3542 size_t size_in_bits,
3543 size_t alignment_in_bits);
3544
3545 method_type(type_base_sptr return_type,
3546 type_base_sptr class_type,
3547 const std::vector<function_decl::parameter_sptr>& parms,
3548 bool is_const,
3549 size_t size_in_bits,
3550 size_t alignment_in_bits);
3551
3552 method_type(class_or_union_sptr class_type,
3553 bool is_const,
3554 size_t size_in_bits,
3555 size_t alignment_in_bits);
3556
3557 method_type(const environment& env,
3558 size_t size_in_bits,
3559 size_t alignment_in_bits);
3560
3561 virtual hash_t
3562 hash_value() const;
3563
3564 class_or_union_sptr
3565 get_class_type() const;
3566
3567 void
3568 set_class_type(const class_or_union_sptr& t);
3569
3570 void set_is_const(bool);
3571
3572 bool get_is_const() const;
3573
3574 void set_is_static(bool);
3575
3576 bool get_is_static() const;
3577
3578 bool get_is_for_static_method() const;
3579
3580 virtual bool
3582
3583 virtual ~method_type();
3584
3585 virtual string
3586 get_pretty_representation(bool internal = false,
3587 bool qualified_name = true) const;
3588
3589 friend interned_string
3590 get_method_type_name(const method_type& fn_type, bool internal);
3591};// end class method_type.
3592
3593/// The base class of templates.
3594class template_decl : public virtual decl_base
3595{
3596 class priv;
3597 std::unique_ptr<priv> priv_;
3598
3599 template_decl();
3600
3601public:
3602
3603 template_decl(const environment& env,
3604 const string& name,
3605 const location& locus,
3606 visibility vis = VISIBILITY_DEFAULT);
3607
3608 void
3610
3611 const std::list<template_parameter_sptr>&
3613
3614 virtual bool
3615 operator==(const decl_base& o) const;
3616
3617 virtual bool
3618 operator==(const template_decl& o) const;
3619
3620 virtual ~template_decl();
3621};//end class template_decl
3622
3623/// Base class for a template parameter. Client code should use the
3624/// more specialized type_template_parameter,
3625/// non_type_template_parameter and template_template_parameter below.
3627{
3628 class priv;
3629 std::unique_ptr<priv> priv_;
3630
3631 // Forbidden
3633
3634 public:
3635
3636 template_parameter(unsigned index,
3637 template_decl_sptr enclosing_tdecl);
3638
3639 virtual bool
3640 operator==(const template_parameter&) const;
3641
3642 bool
3643 operator!=(const template_parameter&) const;
3644
3645 unsigned
3646 get_index() const;
3647
3648 const template_decl_sptr
3649 get_enclosing_template_decl() const;
3650
3651 virtual ~template_parameter();
3652};//end class template_parameter
3653
3654/// Abstracts a type template parameter.
3655class type_tparameter : public template_parameter, public virtual type_decl
3656{
3657 class priv;
3658 std::unique_ptr<priv> priv_;
3659
3660 // Forbidden
3662
3663public:
3664
3665 type_tparameter(unsigned index,
3666 template_decl_sptr enclosing_tdecl,
3667 const string& name,
3668 const location& locus);
3669
3670 virtual bool
3671 operator==(const type_base&) const;
3672
3673 virtual bool
3674 operator==(const type_decl&) const;
3675
3676 virtual bool
3677 operator==(const decl_base&) const;
3678
3679 virtual bool
3680 operator==(const template_parameter&) const;
3681
3682 virtual bool
3683 operator==(const type_tparameter&) const;
3684
3685 virtual ~type_tparameter();
3686};// end class type_tparameter.
3687
3688/// Abstracts non type template parameters.
3690{
3691 class priv;
3692 std::unique_ptr<priv> priv_;
3693
3694 type_base_wptr type_;
3695
3696 // Forbidden
3698
3699public:
3700
3701 non_type_tparameter(unsigned index,
3702 template_decl_sptr enclosing_tdecl,
3703 const string& name,
3704 type_base_sptr type,
3705 const location& locus);
3706 virtual bool
3707 operator==(const decl_base&) const;
3708
3709 virtual bool
3710 operator==(const template_parameter&) const;
3711
3712 const type_base_sptr
3713 get_type() const;
3714
3715 virtual ~non_type_tparameter();
3716};// end class non_type_tparameter
3717
3718
3720
3721/// Abstracts a template template parameter.
3723{
3724 class priv;
3725 std::unique_ptr<priv> priv_;
3726
3727 // Forbidden
3729
3730public:
3731
3732 template_tparameter(unsigned index,
3733 template_decl_sptr enclosing_tdecl,
3734 const string& name,
3735 const location& locus);
3736
3737 virtual bool
3738 operator==(const type_base&) const;
3739
3740 virtual bool
3741 operator==(const decl_base&) const;
3742
3743 virtual bool
3744 operator==(const template_parameter&) const;
3745
3746 virtual bool
3747 operator==(const template_decl&) const;
3748
3749 virtual ~template_tparameter();
3750};
3751
3752/// This abstracts a composition of types based on template type
3753/// parameters. The result of the composition is a type that can be
3754/// referred to by a template non-type parameter. Instances of this
3755/// type can appear at the same level as template parameters, in the
3756/// scope of a template_decl.
3757class type_composition : public template_parameter, public virtual decl_base
3758{
3759 class priv;
3760 std::unique_ptr<priv> priv_;
3761
3763
3764public:
3765 type_composition(unsigned index,
3766 template_decl_sptr tdecl,
3767 type_base_sptr composed_type);
3768
3769 const type_base_sptr
3770 get_composed_type() const;
3771
3772 void
3773 set_composed_type(type_base_sptr t);
3774
3775 virtual ~type_composition();
3776};
3777
3778/// Abstract a function template declaration.
3780{
3781 struct priv;
3782 std::unique_ptr<priv> priv_;
3783
3784 // Forbidden
3786
3787public:
3788
3789 function_tdecl(const environment& env,
3790 const location& locus,
3791 visibility vis = VISIBILITY_DEFAULT,
3792 binding bind = BINDING_NONE);
3793
3795 const location& locus,
3796 visibility vis = VISIBILITY_DEFAULT,
3797 binding bind = BINDING_NONE);
3798
3799 virtual bool
3800 operator==(const decl_base&) const;
3801
3802 virtual bool
3803 operator==(const template_decl&) const;
3804
3805 virtual bool
3806 operator==(const function_tdecl&) const;
3807
3808 shared_ptr<function_decl>
3809 get_pattern() const;
3810
3811 binding
3812 get_binding() const;
3813
3814 virtual bool
3816
3817 virtual ~function_tdecl();
3818
3819 friend void
3821}; // end class function_tdecl.
3822
3823/// Abstract a class template.
3825{
3826 struct priv;
3827 std::unique_ptr<priv> priv_;
3828
3829 // Forbidden
3830 class_tdecl();
3831
3832public:
3833
3834 class_tdecl(const environment& env, const location& locus,
3835 visibility vis = VISIBILITY_DEFAULT);
3836
3838 const location& locus,
3839 visibility vis = VISIBILITY_DEFAULT);
3840
3841 virtual bool
3842 operator==(const decl_base&) const;
3843
3844 virtual bool
3845 operator==(const template_decl&) const;
3846
3847 virtual bool
3848 operator==(const class_tdecl&) const;
3849
3850 shared_ptr<class_decl>
3851 get_pattern() const;
3852
3853 virtual bool
3855
3856 virtual ~class_tdecl();
3857
3858 friend void
3860};// end class class_tdecl
3861
3862/// The base class for member types, data members and member
3863/// functions. Its purpose is mainly to carry the access specifier
3864/// (and possibly other properties that might be shared by all class
3865/// members) for the member.
3867{
3868protected:
3869 enum access_specifier access_;
3870 bool is_static_;
3871
3872private:
3873 // Forbidden
3874 member_base();
3875
3876public:
3877 struct hash;
3878
3879 member_base(access_specifier a, bool is_static = false)
3880 : access_(a), is_static_(is_static)
3881 {}
3882
3883 /// Getter for the access specifier of this member.
3884 ///
3885 /// @return the access specifier for this member.
3888 {return access_;}
3889
3890 /// Setter for the access specifier of this member.
3891 ///
3892 /// @param a the new access specifier.
3893 void
3896
3897 /// @return true if the member is static, false otherwise.
3898 bool
3900 {return is_static_;}
3901
3902 /// Set a flag saying if the parameter is static or not.
3903 ///
3904 /// @param f set to true if the member is static, false otherwise.
3905 void
3907 {is_static_ = f;}
3908
3909 virtual bool
3910 operator==(const member_base& o) const;
3911};// end class member_base
3912
3913/// Abstraction of the declaration of a method.
3915{
3916 method_decl();
3917
3918 virtual void
3919 set_scope(scope_decl_sptr);
3920
3921public:
3922
3923 method_decl(const string& name, method_type_sptr type,
3924 bool declared_inline, const location& locus,
3925 const string& mangled_name = "",
3926 visibility vis = VISIBILITY_DEFAULT,
3927 binding bind = BINDING_GLOBAL);
3928
3929 method_decl(const string& name,
3930 function_type_sptr type,
3931 bool declared_inline,
3932 const location& locus,
3933 const string& mangled_name = "",
3934 visibility vis = VISIBILITY_DEFAULT,
3935 binding bind = BINDING_GLOBAL);
3936
3937 method_decl(const string& name, type_base_sptr type,
3938 bool declared_inline, const location& locus,
3939 const string& mangled_name = "",
3940 visibility vis = VISIBILITY_DEFAULT,
3941 binding bind = BINDING_GLOBAL);
3942
3943 virtual void
3944 set_linkage_name(const string&);
3945
3946 /// @return the type of the current instance of the
3947 /// method_decl.
3948 const method_type_sptr
3949 get_type() const;
3950
3951 void
3952 set_type(const method_type_sptr fn_type)
3953 {function_decl::set_type(fn_type);}
3954
3955 friend bool
3957
3958 friend void
3960
3961 friend void
3963
3964 friend bool
3966
3967 friend void
3969
3970 friend void
3972
3973 friend bool
3974 get_member_function_is_static(const function_decl&);
3975
3976 friend void
3977 set_member_function_is_static(const function_decl&, bool);
3978
3979 friend bool
3981
3982 friend void
3984
3985 friend void
3987
3988 friend bool
3990
3991 friend ssize_t
3993
3994 virtual ~method_decl();
3995};// end class method_decl
3996
3997bool
3998operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3999
4000bool
4001operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
4002
4003/// The base type of @ref class_decl and @ref union_decl
4005{
4006public:
4007 struct priv;
4008 priv *priv_;
4009
4010private:
4011 // Forbidden
4013
4014protected:
4015
4016 void
4018
4019public:
4020 /// Hasher.
4021 struct hash;
4022
4023 /// Convenience typedef
4024 /// @{
4025 typedef vector<type_base_sptr> member_types;
4026 typedef vector<var_decl_sptr> data_members;
4027 typedef vector<method_decl_sptr> member_functions;
4028 typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
4029 typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
4030 typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
4031 /// @}
4032
4033 class_or_union(const environment& env, const string& name,
4034 size_t size_in_bits, size_t align_in_bits,
4035 const location& locus, visibility vis);
4036
4037 class_or_union(const environment& env, const string& name,
4038 bool is_declaration_only = true);
4039
4040 virtual hash_t
4041 hash_value() const;
4042
4043 virtual void
4044 set_size_in_bits(size_t);
4045
4046 virtual size_t
4047 get_size_in_bits() const;
4048
4049 virtual size_t
4050 get_alignment_in_bits() const;
4051
4052 virtual void
4053 set_alignment_in_bits(size_t);
4054
4055 virtual size_t
4057
4058 virtual size_t
4060
4061 virtual size_t
4063
4064 const data_members&
4065 get_data_members() const;
4066
4068 get_data_members_copy() const;
4069
4070 const var_decl_sptr
4071 find_data_member(const string&) const;
4072
4073 const var_decl_sptr
4074 find_data_member(const var_decl_sptr&) const;
4075
4076 const var_decl_sptr
4078
4079 const data_members&
4081
4082 const data_members&
4084
4085 const member_functions&
4086 get_member_functions() const;
4087
4090
4091 const method_decl*
4092 find_member_function(const string& mangled_name) const;
4093
4094 const method_decl*
4095 find_member_function(const char* mangled_name) const;
4096
4098 find_member_function(const string& mangled_name);
4099
4100 method_decl_sptr
4101 find_member_function_sptr(const string& mangled_name);
4102
4103 const method_decl*
4104 find_member_function_from_signature(const string& s) const;
4105
4107 find_member_function_from_signature(const string& s);
4108
4109 const member_function_templates&
4111
4112 const member_class_templates&
4114
4115 bool
4116 has_no_member() const;
4117
4118 virtual bool
4119 operator==(const decl_base&) const;
4120
4121 virtual bool
4122 operator==(const type_base&) const;
4123
4124 virtual bool
4125 operator==(const class_or_union&) const;
4126
4127 virtual bool
4129
4130 virtual ~class_or_union();
4131
4132 friend decl_base_sptr
4133 insert_member_decl(class_or_union_sptr cou, decl_base_sptr member);
4134
4135 friend bool
4136 remove_member_decl(class_or_union_sptr cou, decl_base_sptr member);
4137
4138 friend decl_base_sptr
4139 add_member_decl(class_or_union_sptr cou, decl_base_sptr member_decl);
4140
4141 friend void
4142 add_data_member(class_or_union_sptr cou,
4144 bool is_laid_out, bool is_static,
4145 size_t offset_in_bits);
4146
4147 friend void
4148 add_member_function(class_or_union_sptr t,
4149 method_decl_sptr f,
4151 bool is_static, bool is_ctor,
4152 bool is_dtor, bool is_const);
4153
4154 friend void
4155 add_member_function(class_or_union_sptr t,
4156 method_decl_sptr f,
4158 bool is_virtual,
4159 size_t vtable_offset,
4160 bool is_static, bool is_ctor,
4161 bool is_dtor, bool is_const);
4162
4163 friend void
4164 add_member_function_template(class_or_union_sptr,
4165 member_function_template_sptr);
4166
4167 friend void
4168 add_member_class_template(class_or_union_sptr,
4169 member_class_template_sptr m);
4170
4171 friend method_decl_sptr
4172 copy_member_function(class_or_union_sptr t,
4173 const method_decl*m);
4174
4175 friend method_decl_sptr
4176 copy_member_function(class_or_union_sptr t,
4177 const method_decl_sptr& m);
4178
4179 friend var_decl_sptr
4180 copy_member_variable(class_or_union_sptr t,
4181 const var_decl* variable);
4182
4183 friend var_decl_sptr
4184 copy_member_variable(class_or_union_sptr t, const var_decl_sptr& variable);
4185
4186 friend void
4187 fixup_virtual_member_function(method_decl_sptr method);
4188
4189 friend void
4190 set_member_is_static(decl_base& d, bool s);
4191
4192 friend bool
4194
4195 friend bool
4196 equals(const class_decl&, const class_decl&, change_kind*);
4197
4198 friend class method_decl;
4199 friend class class_decl;
4200}; // end class class_or_union
4201
4202void
4203move_member_type(decl_base_sptr member_type,
4204 scope_decl_sptr new_scope);
4205
4206bool
4207operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4208
4209bool
4210operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4211
4212/// Abstracts a class declaration.
4214{
4215 // Forbidden
4216 class_decl();
4217
4218protected:
4219
4220public:
4221 /// Hasher.
4222 struct hash;
4223
4224 /// Forward declarations.
4225 class base_spec;
4226
4227 /// Convenience typedef
4228 /// @{
4229 typedef shared_ptr<base_spec> base_spec_sptr;
4230 typedef vector<base_spec_sptr> base_specs;
4231
4232 /// @}
4233
4234protected:
4235 virtual void
4237
4238public:
4239 struct priv;
4240 // This priv it's not handled by a shared_ptr because accessing the
4241 // data members of the priv struct for this class_decl shows up on
4242 // performance profiles when dealing with big binaries with a lot of
4243 // types; dereferencing the shared_ptr involves locking of some sort
4244 // and that is slower than just dereferencing a pointer likere here.
4245 // There are other types for which the priv pointer is managed using
4246 // shared_ptr just fine, because those didn't show up during our
4247 // performance profiling.
4248 priv * priv_;
4249
4250 class_decl(const environment& env, const string& name,
4251 size_t size_in_bits, size_t align_in_bits,
4252 bool is_struct, const location& locus, visibility vis);
4253
4254 class_decl(const environment& env, const string& name,
4255 size_t size_in_bits, size_t align_in_bits,
4256 bool is_struct, const location& locus,
4257 visibility vis, bool is_anonymous);
4258
4259 class_decl(const environment& env, const string& name, bool is_struct,
4260 bool is_declaration_only = true);
4261
4262 virtual hash_t
4263 hash_value() const;
4264
4265 virtual string
4266 get_pretty_representation(bool internal = false,
4267 bool qualified_name = true) const;
4268
4269 void
4270 is_struct(bool f);
4271
4272 bool
4273 is_struct() const;
4274
4275 void
4276 add_base_specifier(shared_ptr<base_spec> b);
4277
4278 const base_specs&
4279 get_base_specifiers() const;
4280
4283
4285 find_base_class(const string& qualified_name) const;
4286
4287 const member_functions&
4288 get_virtual_mem_fns() const;
4289
4292
4293 void
4295
4296 bool
4297 has_no_base_nor_member() const;
4298
4299 bool
4301
4302 bool
4303 has_virtual_bases() const;
4304
4305 bool
4306 has_vtable() const;
4307
4308 ssize_t
4310
4311 virtual bool
4312 operator==(const decl_base&) const;
4313
4314 virtual bool
4315 operator==(const type_base&) const;
4316
4317 virtual bool
4318 operator==(const class_or_union&) const;
4319
4320 virtual bool
4321 operator==(const class_decl&) const;
4322
4323 virtual bool
4325
4326 virtual ~class_decl();
4327
4328 decl_base_sptr
4329 insert_member_decl(class_decl_sptr klass, decl_base_sptr member);
4330
4331 friend var_decl_sptr
4333
4334 friend void
4335 fixup_virtual_member_function(method_decl_sptr method);
4336
4337 friend void
4338 set_member_is_static(decl_base& d, bool s);
4339
4340 friend bool
4341 equals(const class_decl&, const class_decl&, change_kind*);
4342
4343 friend class method_decl;
4344 friend class class_or_union;
4345};// end class class_decl
4346
4347bool
4348equals(const class_decl&, const class_decl&, change_kind*);
4349
4350method_decl_sptr
4352 const method_decl_sptr& f);
4353
4354method_decl_sptr
4356 const method_decl* f);
4357void
4358fixup_virtual_member_function(method_decl_sptr method);
4359
4362
4364get_member_access_specifier(const decl_base_sptr&);
4365
4366void
4369
4370void
4371set_member_access_specifier(const decl_base_sptr&,
4373
4374std::ostream&
4375operator<<(std::ostream&, access_specifier);
4376
4377bool
4378operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4379
4380bool
4381operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4382
4383bool
4385 const class_decl::base_spec&,
4386 change_kind*);
4387
4388/// Abstraction of a base specifier in a class declaration.
4390 public virtual decl_base
4391{
4392 struct priv;
4393 std::unique_ptr<priv> priv_;
4394
4395 // Forbidden
4396 base_spec();
4397
4398public:
4399
4400 /// Hasher.
4401 struct hash;
4402
4404 long offset_in_bits = -1, bool is_virtual = false);
4405
4406 base_spec(const type_base_sptr& base, access_specifier a,
4407 long offset_in_bits = -1, bool is_virtual = false);
4408
4409 virtual hash_t
4410 hash_value() const;
4411
4412 virtual ~base_spec();
4413
4415 get_base_class() const;
4416
4417 bool
4418 get_is_virtual() const;
4419
4420 long
4421 get_offset_in_bits() const;
4422
4423 virtual bool
4424 operator==(const decl_base&) const;
4425
4426 virtual bool
4427 operator==(const member_base&) const;
4428
4429 virtual bool
4431};// end class class_decl::base_spec
4432
4433bool
4436
4437bool
4440
4443
4446
4447/// Abstracts a union type declaration.
4449{
4450 // Forbid
4451 union_decl();
4452
4453public:
4454
4455 struct hash;
4456
4457 union_decl(const environment& env, const string& name,
4458 size_t size_in_bits, const location& locus,
4459 visibility vis);
4460
4461 union_decl(const environment& env, const string& name,
4462 size_t size_in_bits, const location& locus,
4463 visibility vis, bool is_anonymous);
4464
4465 union_decl(const environment& env, const string& name,
4466 bool is_declaration_only = true);
4467
4468 virtual hash_t
4469 hash_value() const;
4470
4471 virtual string
4472 get_pretty_representation(bool internal = false,
4473 bool qualified_name = true) const;
4474
4475 virtual bool
4476 operator==(const decl_base&) const;
4477
4478 virtual bool
4479 operator==(const type_base&) const;
4480
4481 virtual bool
4482 operator==(const class_or_union&) const;
4483
4484 virtual bool
4485 operator==(const union_decl&) const;
4486
4487 virtual bool
4489
4490 virtual ~union_decl();
4491}; // union_decl
4492
4493bool
4494equals(const union_decl&, const union_decl&, change_kind*);
4495
4496method_decl_sptr
4497copy_member_function(union_decl_sptr union_type,
4498 const method_decl_sptr& f);
4499
4500method_decl_sptr
4501copy_member_function(union_decl_sptr union_type,
4502 const method_decl* f);
4503
4504bool
4505operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4506
4507bool
4508operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4509
4510/// Abstraction of a member function context relationship. This
4511/// relates a member function to its parent class.
4513{
4514protected:
4515 struct priv;
4516 std::unique_ptr<priv> priv_;
4517
4518public:
4520
4522
4524 bool is_constructor,
4525 bool is_destructor,
4526 bool is_const,
4527 bool is_virtual,
4528 size_t vtable_offset_in_bits,
4529 access_specifier access,
4530 bool is_static);
4531
4532 bool
4533 is_virtual() const;
4534
4535 void
4536 is_virtual(bool is_virtual);
4537
4538 size_t
4539 vtable_offset() const;
4540
4541 void
4542 vtable_offset(size_t s);
4543
4544 bool
4545 is_constructor() const;
4546
4547 void
4548 is_constructor(bool f);
4549
4550 bool
4551 is_destructor() const;
4552
4553 void
4554 is_destructor(bool f);
4555
4556 bool
4557 is_const() const;
4558
4559 void
4560 is_const(bool f);
4561
4562 virtual ~mem_fn_context_rel();
4563}; // end class mem_fn_context_rel
4564
4567
4570
4571method_decl_sptr
4573
4574const var_decl*
4575lookup_data_member(const type_base* type,
4576 const char* dm_name);
4577
4578const var_decl_sptr
4579lookup_data_member(const type_base_sptr& type,
4580 const var_decl_sptr& dm);
4581
4584 unsigned parm_num);
4585
4586/// Abstract a member function template.
4587class member_function_template : public member_base, public virtual decl_base
4588{
4589 bool is_constructor_;
4590 bool is_const_;
4591 shared_ptr<function_tdecl> fn_tmpl_;
4592
4593 // Forbiden
4595
4596public:
4597 /// Hasher.
4598 struct hash;
4599
4601 access_specifier access, bool is_static,
4602 bool is_constructor, bool is_const)
4603 : type_or_decl_base(f->get_environment()),
4604 decl_base(f->get_environment(), f->get_name(), location()),
4605 member_base(access, is_static), is_constructor_(is_constructor),
4606 is_const_(is_const), fn_tmpl_(f)
4607 {}
4608
4609 bool
4610 is_constructor() const
4611 {return is_constructor_;}
4612
4613 bool
4614 is_const() const
4615 {return is_const_;}
4616
4617 operator const function_tdecl& () const
4618 {return *fn_tmpl_;}
4619
4621 as_function_tdecl() const
4622 {return fn_tmpl_;}
4623
4624 virtual bool
4625 operator==(const member_base& o) const;
4626
4627 virtual bool
4629};// end class member_function_template
4630
4631bool
4632operator==(const member_function_template_sptr& l,
4633 const member_function_template_sptr& r);
4634
4635bool
4636operator!=(const member_function_template_sptr& l,
4637 const member_function_template_sptr& r);
4638
4639/// Abstracts a member class template template
4641 : public member_base,
4642 public virtual decl_base
4643{
4644 shared_ptr<class_tdecl> class_tmpl_;
4645
4646 // Forbidden
4648
4649public:
4650
4651 /// Hasher.
4652 struct hash;
4653
4655 access_specifier access, bool is_static)
4656 : type_or_decl_base(c->get_environment()),
4657 decl_base(c->get_environment(), c->get_name(), location()),
4658 member_base(access, is_static),
4659 class_tmpl_(c)
4660 {}
4661
4662 operator const class_tdecl& () const
4663 { return *class_tmpl_; }
4664
4666 as_class_tdecl() const
4667 {return class_tmpl_;}
4668
4669 virtual bool
4670 operator==(const member_base& o) const;
4671
4672 virtual bool
4673 operator==(const decl_base&) const;
4674
4675 virtual bool
4676 operator==(const member_class_template&) const;
4677
4678 virtual bool
4680};// end class member_class_template
4681
4682bool
4683operator==(const member_class_template_sptr& l,
4684 const member_class_template_sptr& r);
4685
4686bool
4687operator!=(const member_class_template_sptr& l,
4688 const member_class_template_sptr& r);
4689
4690/// A comparison functor for pointers to @ref var_decl.
4692{
4693 /// Return true if the two instances of @ref var_decl are equal.
4694 ///
4695 /// @param l the first variable to compare.
4696 ///
4697 /// @param r the second variable to compare.
4698 ///
4699 /// @return true if @p l equals @p r.
4700 bool
4701 operator()(const var_decl* l, const var_decl* r) const
4702 {
4703 if (l == r)
4704 return true;
4705 if (!!l != !!r)
4706 return false;
4707 return (*l == *r);
4708 }
4709};// end struct var_decl::ptr_equal
4710
4711/// Equality functor for instances of @ref function_decl
4713{
4714 /// Tests if two pointers to @ref function_decl are equal.
4715 ///
4716 /// @param l the first pointer to @ref function_decl to consider in
4717 /// the comparison.
4718 ///
4719 /// @param r the second pointer to @ref function_decl to consider in
4720 /// the comparison.
4721 ///
4722 /// @return true if the two functions @p l and @p r are equal, false
4723 /// otherwise.
4724 bool
4725 operator()(const function_decl* l, const function_decl* r) const
4726 {
4727 if (l == r)
4728 return true;
4729 if (!!l != !!r)
4730 return false;
4731 return (*l == *r);
4732 }
4733};// function_decl::ptr_equal
4734
4735void
4736perform_type_canonicalization(vector<type_base_sptr>& types,
4737 bool do_log = false, bool show_stats = false);
4738
4739/// The base class for the visitor type hierarchy used for traversing
4740/// a translation unit.
4741///
4742/// Client code willing to get notified for a certain kind of node
4743/// during the IR traversal might want to define a visitor class that
4744/// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4745/// or ir_node_visitor::visit_end() method of its choice, and provide
4746/// and implementation for it. If either
4747/// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4748/// return false, it means the traversal has to stop immediately after
4749/// the methods' return. If the methods return true, it means the
4750/// traversal keeps going.
4751///
4752/// That new visitor class would then be passed to e.g,
4753/// translation_unit::traverse or to the traverse method of any type
4754/// where the traversal is supposed to start from.
4756{
4757 struct priv;
4758 std::unique_ptr<priv> priv_;
4759
4760public:
4761
4763
4764 virtual ~ir_node_visitor();
4765
4773
4774 virtual bool visit_begin(decl_base*);
4775 virtual bool visit_end(decl_base*);
4776
4777 virtual bool visit_begin(scope_decl*);
4778 virtual bool visit_end(scope_decl*);
4779
4780 virtual bool visit_begin(type_base*);
4781 virtual bool visit_end(type_base*);
4782
4783 virtual bool visit_begin(scope_type_decl*);
4784 virtual bool visit_end(scope_type_decl*);
4785
4786 virtual bool visit_begin(type_decl*);
4787 virtual bool visit_end(type_decl*);
4788
4789 virtual bool visit_begin(namespace_decl*);
4790 virtual bool visit_end(namespace_decl*);
4791
4792 virtual bool visit_begin(qualified_type_def*);
4793 virtual bool visit_end(qualified_type_def*);
4794
4795 virtual bool visit_begin(pointer_type_def*);
4796 virtual bool visit_end(pointer_type_def*);
4797
4798 virtual bool visit_begin(reference_type_def*);
4799 virtual bool visit_end(reference_type_def*);
4800
4801 virtual bool visit_begin(ptr_to_mbr_type*);
4802 virtual bool visit_end(ptr_to_mbr_type*);
4803
4804 virtual bool visit_begin(array_type_def*);
4805 virtual bool visit_end(array_type_def*);
4806
4807 virtual bool visit_begin(array_type_def::subrange_type*);
4808 virtual bool visit_end(array_type_def::subrange_type*);
4809
4810 virtual bool visit_begin(enum_type_decl*);
4811 virtual bool visit_end(enum_type_decl*);
4812
4813 virtual bool visit_begin(typedef_decl*);
4814 virtual bool visit_end(typedef_decl*);
4815
4816 virtual bool visit_begin(function_type*);
4817 virtual bool visit_end(function_type*);
4818
4819 virtual bool visit_begin(method_type*);
4820 virtual bool visit_end(method_type*);
4821
4822 virtual bool visit_begin(var_decl*);
4823 virtual bool visit_end(var_decl*);
4824
4825 virtual bool visit_begin(function_decl*);
4826 virtual bool visit_end(function_decl*);
4827
4828 virtual bool visit_begin(function_decl::parameter*);
4829 virtual bool visit_end(function_decl::parameter*);
4830
4831 virtual bool visit_begin(function_tdecl*);
4832 virtual bool visit_end(function_tdecl*);
4833
4834 virtual bool visit_begin(class_tdecl*);
4835 virtual bool visit_end(class_tdecl*);
4836
4837 virtual bool visit_begin(class_or_union *);
4838 virtual bool visit_end(class_or_union *);
4839
4840 virtual bool visit_begin(class_decl*);
4841 virtual bool visit_end(class_decl*);
4842
4843 virtual bool visit_begin(union_decl*);
4844 virtual bool visit_end(union_decl*);
4845
4846 virtual bool visit_begin(class_decl::base_spec*);
4847 virtual bool visit_end(class_decl::base_spec*);
4848
4849 virtual bool visit_begin(member_function_template*);
4850 virtual bool visit_end(member_function_template*);
4851
4852 virtual bool visit_begin(member_class_template*);
4853 virtual bool visit_end(member_class_template*);
4854}; // end struct ir_node_visitor
4855
4856// Debugging facility
4857void
4858fns_to_str(vector<function_decl*>::const_iterator a_begin,
4859 vector<function_decl*>::const_iterator a_end,
4860 vector<function_decl*>::const_iterator b_begin,
4861 vector<function_decl*>::const_iterator b_end,
4862 std::ostream& o);
4863
4864}// end namespace ir
4865} // end namespace abigail
4866#endif // __ABG_IR_H__
Simplified implementation of std::optional just enough to be used as a replacement for our purposes a...
This type abstracts the configuration information of the library.
Definition abg-config.h:18
The abstraction of an interned string.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
Definition abg-ir.h:2593
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition abg-ir.cc:20010
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:19978
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:19971
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition abg-ir.cc:19985
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition abg-ir.cc:20022
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition abg-ir.cc:19993
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition abg-ir.cc:19943
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition abg-ir.cc:20000
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition abg-ir.h:2578
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition abg-ir.cc:20201
bool is_non_finite() const
Test if the length of the subrange type is infinite.
Definition abg-ir.cc:20228
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition abg-ir.cc:20194
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type of the subrange, that is, the type that defines the range.
Definition abg-ir.cc:20168
string as_string() const
Return a string representation of the sub range.
Definition abg-ir.cc:20250
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:20149
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:20450
bool operator!=(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:20389
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition abg-ir.cc:20180
type_base_sptr get_underlying_type() const
Getter of the underlying type of the subrange, that is, the type that defines the range.
Definition abg-ir.cc:20160
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:20345
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition abg-ir.cc:20187
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for an array_type_def::subrange_type.
Definition abg-ir.cc:20428
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition abg-ir.cc:20273
uint64_t get_length() const
Getter of the length of the subrange type.
Definition abg-ir.cc:20211
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition abg-ir.cc:20243
The abstraction of an array type.
Definition abg-ir.h:2552
virtual bool is_non_finite() const
Definition abg-ir.cc:20867
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the array_type_def.
Definition abg-ir.cc:20897
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:20557
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition abg-ir.cc:20828
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition abg-ir.cc:20843
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition abg-ir.h:2570
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:20960
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition abg-ir.cc:20991
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:20806
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition abg-ir.h:2573
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of array_type_def.
Definition abg-ir.cc:20610
translation_unit::language get_language() const
Get the language of the array.
Definition abg-ir.cc:20795
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition abg-ir.cc:20853
Abstraction of a base specifier in a class declaration.
Definition abg-ir.h:4391
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition abg-ir.cc:26517
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition abg-ir.cc:26524
long get_offset_in_bits() const
Getter of the offset of the base.
Definition abg-ir.cc:26531
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:26506
virtual bool traverse(ir_node_visitor &)
Traverses an instance of class_decl::base_spec, visiting all the sub-types and decls that it might co...
Definition abg-ir.cc:26547
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition abg-ir.cc:26641
Abstracts a class declaration.
Definition abg-ir.h:4214
friend void fixup_virtual_member_function(method_decl_sptr method)
When a virtual member function has seen its virtualness set by set_member_function_is_virtual(),...
Definition abg-ir.cc:27048
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition abg-ir.cc:27108
const virtual_mem_fn_map_type & get_virtual_mem_fns_map() const
Get the map that associates a virtual table offset to the virtual member functions with that virtual ...
Definition abg-ir.cc:26376
bool is_struct() const
Test if the class is a struct.
Definition abg-ir.cc:26296
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:27172
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition abg-ir.cc:26314
virtual ~class_decl()
Destructor of the class_decl type.
Definition abg-ir.cc:27711
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
Definition abg-ir.cc:26271
bool has_vtable() const
Test if the current instance has a vtable.
Definition abg-ir.cc:27136
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition abg-ir.cc:27150
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition abg-ir.cc:27117
base_specs get_base_specifiers_copy() const
Get a copy of the base specifiers for this class.
Definition abg-ir.cc:26321
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:27621
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition abg-ir.h:4229
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition abg-ir.cc:26303
friend var_decl_sptr copy_member_variable(class_decl_sptr t, const var_decl_sptr &variable)
Copy a data member of a class_or_union into a new class_or_union.
Definition abg-ir.cc:26128
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition abg-ir.cc:26357
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition abg-ir.cc:26381
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition abg-ir.cc:27340
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition abg-ir.cc:27469
class_decl_sptr find_base_class(const string &qualified_name) const
Find a base class of a given qualified name for the current class.
Definition abg-ir.cc:26340
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:28108
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition abg-ir.cc:27099
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition abg-ir.h:4230
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of class_decl.
Definition abg-ir.cc:26405
The base type of class_decl and union_decl.
Definition abg-ir.h:4005
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition abg-ir.cc:25098
const var_decl_sptr find_anonymous_data_member(const var_decl_sptr &) const
Find an anonymous data member in the class.
Definition abg-ir.cc:25281
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition abg-ir.cc:25487
data_members get_data_members_copy() const
Get a copy of the the data members of this class_or_union.
Definition abg-ir.cc:25235
friend void fixup_virtual_member_function(method_decl_sptr method)
When a virtual member function has seen its virtualness set by set_member_function_is_virtual(),...
Definition abg-ir.cc:27048
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition abg-ir.cc:25599
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition abg-ir.cc:25083
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition abg-ir.cc:25116
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition abg-ir.h:4028
friend method_decl_sptr copy_member_function(class_or_union_sptr t, const method_decl *m)
Copy a method of a class_or_union into a new class_or_union.
Definition abg-ir.cc:26014
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition abg-ir.h:4027
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition abg-ir.cc:25228
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:24866
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition abg-ir.h:4029
friend void add_member_class_template(class_or_union_sptr, member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition abg-ir.cc:25632
const method_decl * find_member_function_from_signature(const string &s) const
Find a method (member function) using its signature (pretty representation) as a key.
Definition abg-ir.cc:25573
method_decl_sptr find_member_function_sptr(const string &mangled_name)
Find a method, using its linkage name as a key.
Definition abg-ir.cc:25548
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition abg-ir.cc:25067
friend void add_data_member(class_or_union_sptr cou, var_decl_sptr v, access_specifier a, bool is_laid_out, bool is_static, size_t offset_in_bits)
Add a data member to the current instance of class_or_union.
Definition abg-ir.cc:25165
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:24882
const data_members & get_non_static_data_members() const
Get the non-static data members of this class_or_union.
Definition abg-ir.cc:25328
const method_decl * find_member_function(const string &mangled_name) const
Find a method, using its linkage name as a key.
Definition abg-ir.cc:25521
const data_members & get_static_data_members() const
Get the static data memebers of this class_or_union.
Definition abg-ir.cc:25339
friend decl_base_sptr insert_member_decl(class_or_union_sptr cou, decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition abg-ir.cc:25666
vector< var_decl_sptr > data_members
Convenience typedef.
Definition abg-ir.h:4026
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition abg-ir.cc:24962
friend decl_base_sptr add_member_decl(class_or_union_sptr cou, decl_base_sptr member_decl)
Add a member declaration to the current instance of class_or_union. The member declaration can be eit...
Definition abg-ir.cc:24971
friend var_decl_sptr copy_member_variable(class_or_union_sptr t, const var_decl *variable)
Copy a data member of a class_or_union into a new class_or_union.
Definition abg-ir.cc:26074
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:25701
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:28108
friend void add_member_function(class_or_union_sptr t, method_decl_sptr f, access_specifier a, bool is_static, bool is_ctor, bool is_dtor, bool is_const)
Add a member function.
Definition abg-ir.cc:25436
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition abg-ir.cc:25035
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition abg-ir.cc:25606
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition abg-ir.cc:25051
vector< type_base_sptr > member_types
Convenience typedef.
Definition abg-ir.h:4025
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition abg-ir.cc:25134
void maybe_fixup_members_of_anon_data_member(var_decl_sptr anon_dm)
Fixup the members of the type of an anonymous data member.
Definition abg-ir.cc:25008
const var_decl_sptr find_data_member(const string &) const
Find a data member of a given name in the current class_or_union.
Definition abg-ir.cc:25255
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition abg-ir.cc:25771
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition abg-ir.h:4030
friend bool remove_member_decl(class_or_union_sptr cou, decl_base_sptr member)
Remove a given decl from the current class_or_union scope.
Definition abg-ir.cc:24983
friend void add_member_function_template(class_or_union_sptr, member_function_template_sptr)
Append a member function template to the class_or_union.
Definition abg-ir.cc:25613
member_functions get_member_functions_copy() const
Get a copy of the member functions of this class_or_union.
Definition abg-ir.cc:25503
Abstract a class template.
Definition abg-ir.h:3825
friend void set_pattern(class_tdecl_sptr, class_decl_sptr p)
Setter of the pattern of the template.
Definition abg-ir.cc:29807
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition abg-ir.cc:29819
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:29868
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:29823
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition abg-ir.h:1283
bool operator!=(const context_rel &o) const
Inequality operator.
Definition abg-ir.cc:27801
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
Definition abg-corpus.h:95
The base type of all declarations.
Definition abg-ir.h:1584
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition abg-ir.cc:17103
void set_is_declaration_only(bool f)
Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl.
Definition abg-ir.cc:6126
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition abg-ir.cc:6315
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition abg-ir.cc:5598
void set_is_in_public_symbol_table(bool)
Set the flag saying if this decl is from a symbol that is in a public symbols table,...
Definition abg-ir.cc:5681
friend bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
Definition abg-ir.cc:6684
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition abg-ir.cc:6059
std::list< typedef_decl_sptr > & get_naming_typedefs() const
Getter for the naming typedef of the current decl.
Definition abg-ir.cc:5827
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition abg-ir.cc:5891
const decl_base * get_naked_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
Definition abg-ir.cc:6104
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition abg-ir.cc:5961
void clear_qualified_name()
Clear the qualified name of this decl.
Definition abg-ir.cc:5588
virtual void set_name(const string &n)
Setter for the name of the decl.
Definition abg-ir.cc:5760
const location & get_location() const
Get the location of a given declaration.
Definition abg-ir.cc:5704
binding
ELF binding.
Definition abg-ir.h:1632
virtual const interned_string & get_name() const
Getter for the name of the current decl.
Definition abg-ir.cc:5946
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition abg-ir.cc:5576
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition abg-ir.cc:5641
scope_decl_sptr get_scope() const
Return the type containing the current decl, if any.
Definition abg-ir.cc:5923
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition abg-ir.cc:5774
friend void set_member_is_static(const decl_base_sptr &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:28220
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition abg-ir.cc:6048
const decl_base_sptr get_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
Definition abg-ir.cc:6085
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:6653
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition abg-ir.cc:9642
bool has_naming_typedef(const typedef_decl_sptr)
Test if the current decl has a given naming typedef.
Definition abg-ir.cc:5867
void set_location(const location &l)
Set the location for a given declaration.
Definition abg-ir.cc:5745
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition abg-ir.cc:5787
virtual void set_scope(scope_decl_sptr)
Setter of the scope of the current decl.
Definition abg-ir.cc:6343
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition abg-ir.cc:5912
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition abg-ir.cc:5631
visibility get_visibility() const
Getter for the visibility of the decl.
Definition abg-ir.cc:5902
visibility
ELF visibility.
Definition abg-ir.h:1622
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition abg-ir.cc:6114
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:6332
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition abg-ir.cc:6070
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition abg-ir.cc:5881
void add_naming_typedef(const typedef_decl_sptr)
Set the naming typedef of the current instance of decl_base.
Definition abg-ir.cc:5848
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:6624
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition abg-ir.cc:7742
virtual ~decl_base()
Destructor of the decl_base type.
Definition abg-ir.cc:6319
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:6304
const interned_string & get_qualified_parent_name() const
Return a copy of the qualified name of the parent of the current decl.
Definition abg-ir.cc:5936
bool get_is_anonymous_or_has_anonymous_parent() const
Definition abg-ir.cc:5813
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition abg-ir.cc:5802
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl_sptr scpe)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
Definition abg-ir.cc:9616
bool get_is_in_public_symbol_table() const
Test if the decl is defined in a ELF symbol table as a public symbol.
Definition abg-ir.cc:5670
friend bool equals(const decl_base &l, const decl_base &r, change_kind *, bool qualified_name, bool linkage_name)
Compares two instances of decl_base.
Definition abg-ir.cc:6243
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition abg-ir.cc:5614
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representatin of the current declaration.
Definition abg-ir.cc:5987
friend bool maybe_compare_as_member_decls(const decl_base &l, const decl_base &r, change_kind *k)
Compare the properties that belong to the "is-a-member-relation" of a decl.
Definition abg-ir.cc:6193
friend bool var_equals_modulo_types(const var_decl &, const var_decl &, change_kind *)
Compares two instances of var_decl without taking their type into account.
Definition abg-ir.cc:22302
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition abg-ir.h:3004
const var_decl_sptr get_anonymous_data_member() const
Return a non-nil value if this data member context relationship has an anonymous data member....
Definition abg-ir.cc:3971
void set_anonymous_data_member(var_decl_sptr)
Set the containing anonymous data member of this data member context relationship....
Definition abg-ir.cc:3984
The abstraction of the version of an ELF symbol.
Definition abg-ir.h:1230
version & operator=(const version &o)
Assign a version to the current one.
Definition abg-ir.cc:3886
bool operator==(const version &o) const
Compares the current version against another one.
Definition abg-ir.cc:3868
bool is_default() const
Getter for the 'is_default' property of the version.
Definition abg-ir.cc:3848
const string & str() const
Getter for the version name.
Definition abg-ir.cc:3834
bool operator!=(const version &o) const
Inequality operator.
Definition abg-ir.cc:3877
Abstraction of an elf symbol.
Definition abg-ir.h:959
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition abg-ir.cc:2920
elf_symbol_sptr get_alias_which_equals(const elf_symbol &other) const
In the list of aliases of a given elf symbol, get the alias that equals this current symbol.
Definition abg-ir.cc:3287
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition abg-ir.cc:3177
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition abg-ir.cc:2708
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition abg-ir.cc:2987
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition abg-ir.cc:2890
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition abg-ir.cc:3028
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition abg-ir.cc:2697
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition abg-ir.cc:2942
binding
The binding of a symbol.
Definition abg-ir.h:976
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition abg-ir.cc:3035
string get_aliases_id_string(const string_elf_symbols_map_type &symtab, bool include_symbol_itself=true) const
Return a comma separated list of the id of the current symbol as well as the id string of its aliases...
Definition abg-ir.cc:3308
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition abg-ir.cc:2758
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition abg-ir.cc:3191
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition abg-ir.cc:3053
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition abg-ir.cc:2954
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition abg-ir.cc:2865
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition abg-ir.cc:3102
void set_size(size_t)
Setter of the size of the symbol.
Definition abg-ir.cc:2738
const string & get_name() const
Getter for the name of the elf_symbol.
Definition abg-ir.cc:2687
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition abg-ir.cc:2748
static bool get_name_and_version_from_id(const string &id, string &name, string &ver)
Given the ID of a symbol, get the name and the version of said symbol.
Definition abg-ir.cc:3374
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition abg-ir.cc:2856
type
The type of a symbol.
Definition abg-ir.h:963
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition abg-ir.cc:2778
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition abg-ir.cc:2900
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition abg-ir.cc:2790
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition abg-ir.cc:3433
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition abg-ir.cc:3007
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition abg-ir.cc:2910
static elf_symbol_sptr create(const environment &e, size_t i, size_t s, const string &n, type t, binding b, bool d, bool c, const version &ve, visibility vi, bool is_in_ksymtab=false, const abg_compat::optional< uint32_t > &crc={}, const abg_compat::optional< std::string > &ns={}, bool is_suppressed=false)
Factory of instances of elf_symbol.
Definition abg-ir.cc:2585
visibility
The visibility of the symbol.
Definition abg-ir.h:985
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition abg-ir.cc:2768
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition abg-ir.cc:3143
void set_index(size_t)
Setter for the index.
Definition abg-ir.cc:2677
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition abg-ir.cc:2801
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition abg-ir.cc:3162
size_t get_index() const
Getter for the index.
Definition abg-ir.cc:2667
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition abg-ir.cc:3238
elf_symbol_sptr get_alias_from_name(const string &name) const
From the aliases of the current symbol, lookup one with a given name.
Definition abg-ir.cc:3265
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition abg-ir.cc:2660
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition abg-ir.cc:2718
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition abg-ir.cc:2840
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition abg-ir.cc:2879
size_t get_size() const
Getter of the size of the symbol.
Definition abg-ir.cc:2728
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition abg-ir.cc:2812
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition abg-ir.cc:2930
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition abg-ir.cc:3017
bool operator==(const elf_symbol &) const
Test if two main symbols are textually equal, or, if they have aliases that are textually equal.
Definition abg-ir.cc:3419
The abstraction of an enumerator.
Definition abg-ir.h:2882
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition abg-ir.cc:21634
bool operator!=(const enumerator &other) const
Inequality operator.
Definition abg-ir.cc:21694
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition abg-ir.cc:21736
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition abg-ir.cc:21758
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition abg-ir.cc:21703
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition abg-ir.cc:21765
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:21751
const string & get_qualified_name(bool internal=false) const
Getter for the qualified name of the current instance of enum_type_decl::enumerator....
Definition abg-ir.cc:21720
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:21744
bool operator==(const enumerator &other) const
Equality operator.
Definition abg-ir.cc:21681
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition abg-ir.cc:21665
Abstracts a declaration for an enum type.
Definition abg-ir.h:2796
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition abg-ir.h:2812
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:21065
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition abg-ir.cc:21234
const enumerators & get_enumerators() const
Definition abg-ir.cc:21078
bool find_enumerator_by_value(int64_t value, enum_type_decl::enumerator &result)
Find an enumerator by its value.
Definition abg-ir.cc:21125
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
Definition abg-ir.cc:21090
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:21212
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition abg-ir.cc:21073
bool find_enumerator_by_name(const string &name, enum_type_decl::enumerator &result)
Find an enumerator by its name.
Definition abg-ir.cc:21150
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:21555
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of enum_type_decl.
Definition abg-ir.cc:21182
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition abg-ir.h:216
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
Definition abg-ir.cc:4455
bool is_void_pointer_type(const type_base_sptr &) const
Test if a given type is the same as the void pointer type of the environment.
Definition abg-ir.cc:4522
std::unordered_map< string, std::vector< type_base_sptr > > canonical_types_map_type
A convenience typedef for a map of canonical types. The key is the pretty representation string of a ...
Definition abg-ir.h:226
bool user_set_analyze_exported_interfaces_only() const
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() p...
Definition abg-ir.cc:4602
const vector< type_base_sptr > * get_canonical_types(const char *name) const
Get the vector of canonical types which have a given "string representation".
Definition abg-ir.cc:4775
const type_base_sptr & get_void_type() const
Get the unique type_decl that represents a "void" type for the current environment....
Definition abg-ir.cc:4375
static size_t get_number_of_threads_to_use()
Getter of the number of threads to use, as set by the user.
Definition abg-ir.cc:4650
bool is_variadic_parameter_type(const type_base *) const
Test if a type is a variadic parameter type as defined in the current environment.
Definition abg-ir.cc:4554
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition abg-ir.cc:4429
const type_base_sptr & get_void_pointer_type() const
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the o...
Definition abg-ir.cc:4395
const config & get_config() const
Getter of the general configuration object.
Definition abg-ir.cc:4592
environment()
Default constructor of the environment type.
Definition abg-ir.cc:4252
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "string representation".
Definition abg-ir.cc:4819
const type_base_sptr & get_variadic_parameter_type() const
Get a type_decl instance that represents a the type of a variadic function parameter....
Definition abg-ir.cc:4415
bool is_void_type(const type_base_sptr &) const
Test if a given type is a void type as defined in the current environment.
Definition abg-ir.cc:4491
virtual ~environment()
Destructor for the environment type.
Definition abg-ir.cc:4257
const vector< type_base_sptr > & get_sorted_canonical_types() const
Get the sorted list of canonical types.
Definition abg-ir.cc:4831
interned_string intern(const string &) const
Do intern a string.
Definition abg-ir.cc:4585
static size_t process_thread_pool_size_string(const string &)
Process a thread pool size string and convert it to a numeric value.
Definition abg-ir.cc:1448
friend void keep_type_alive(type_base_sptr)
Make sure that the life time of a given (smart pointer to a) type is the same as the life time of the...
Definition abg-ir.cc:30007
static void set_number_of_threads_to_use(size_t)
Setter of the number of threads to use, as set by the user.
Definition abg-ir.cc:4661
bool analyze_exported_interfaces_only() const
Getter for the property that controls if we are to restrict the analysis to the types that are only r...
Definition abg-ir.cc:4628
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition abg-ir.cc:4265
Abstraction of a function parameter.
Definition abg-ir.h:3344
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition abg-ir.cc:24759
interned_string get_type_name() const
Definition abg-ir.cc:24549
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition abg-ir.cc:24587
const string get_type_pretty_representation() const
Definition abg-ir.cc:24568
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition abg-ir.cc:24735
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Compute and return a copy of the pretty representation of the current function parameter.
Definition abg-ir.cc:24779
Abstraction for a function declaration.
Definition abg-ir.h:3167
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3190
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition abg-ir.cc:23952
string get_pretty_representation_of_declarator(bool internal=false) const
Compute and return the pretty representation for the part of the function declaration that starts at ...
Definition abg-ir.cc:23865
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition abg-ir.cc:23969
const elf_symbol_sptr get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using function_decl::set_sy...
Definition abg-ir.cc:24013
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:24408
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition abg-ir.cc:24073
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition abg-ir.cc:24308
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition abg-ir.cc:23902
const type_base_sptr get_return_type() const
Definition abg-ir.cc:24048
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition abg-ir.cc:24087
const std::vector< parameter_sptr > & get_parameters() const
Definition abg-ir.cc:24053
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition abg-ir.cc:24063
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition abg-ir.cc:23995
virtual ~function_decl()
Destructor of the function_decl type.
Definition abg-ir.cc:24426
parameters::const_iterator get_first_non_artificial_parm() const
Get the first parameter of the function that is not compiler-generated.
Definition abg-ir.cc:23929
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition abg-ir.cc:24294
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3193
bool is_declared_inline() const
Test if the function was declared inline.
Definition abg-ir.cc:24023
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of function_decl.
Definition abg-ir.cc:23797
interned_string get_id() const
Return an ID that tries to uniquely identify the function inside a program or a library.
Definition abg-ir.cc:24369
Abstract a function template declaration.
Definition abg-ir.h:3780
friend void set_pattern(function_tdecl_sptr, function_decl_sptr p)
Set a new pattern to the function template.
Definition abg-ir.cc:29636
binding get_binding() const
Get the binding of the function template.
Definition abg-ir.cc:29655
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition abg-ir.cc:29648
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:29715
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition abg-ir.cc:29664
Abstraction of a function type.
Definition abg-ir.h:3429
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3439
unsigned get_nb_parameters() const
The number of parameters of the function type in a thread-safe manner.
Definition abg-ir.cc:22829
bool has_empty_parameters() const
Test if a the function type has empty parameters in a thread-safe manner.
Definition abg-ir.cc:22815
const parameter_sptr get_parm_at(size_t) const
Get the function parameter at a given index, starting from zero.
Definition abg-ir.cc:22889
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition abg-ir.cc:22979
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:22783
virtual bool traverse(ir_node_visitor &)
Traverses an instance of function_type, visiting all the sub-types and decls that it might contain.
Definition abg-ir.cc:23291
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition abg-ir.cc:22945
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:23188
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:22689
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition abg-ir.cc:23250
void append_parameter(parameter_sptr parm)
Append a new parameter to the vector of parameters of the current instance of function_type.
Definition abg-ir.cc:22929
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition abg-ir.cc:22905
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition abg-ir.cc:23208
const parameter_sptr get_parm_at_index_from_first_non_implicit_parm(size_t) const
Get the Ith parameter of the vector of parameters of the current instance of function_type.
Definition abg-ir.cc:22864
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition abg-ir.cc:22794
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition abg-ir.cc:22805
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:23139
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition abg-ir.cc:22844
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3441
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current function_type.
Definition abg-ir.cc:23274
parameters::const_iterator get_first_non_artificial_parm() const
Get the first parameter of the function that is not compiler-generated.
Definition abg-ir.cc:23165
This abstracts the global scope of a given translation unit.
Definition abg-ir.h:1991
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition abg-ir.h:4756
bool allow_visiting_already_visited_type_node() const
Get if the walker using this visitor is allowed to re-visit a type node that was previously visited o...
Definition abg-ir.cc:31904
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition abg-ir.cc:31971
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition abg-ir.cc:31961
bool allow_visiting_member_type_nodes() const
Get if the walker using this visitor is allowed to visit member type nodes.
Definition abg-ir.cc:31922
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition abg-ir.cc:31883
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition abg-ir.cc:31932
The entry point to manage locations.
Definition abg-ir.h:440
location create_new_location(const std::string &fle, size_t lne, size_t col)
Insert the triplet representing a source locus into our internal vector of location triplet....
Definition abg-ir.cc:794
void expand_location(const location &location, std::string &path, unsigned &line, unsigned &column) const
Given an instance of location type, return the triplet {path,line,column} that represents the source ...
Definition abg-ir.cc:818
The source location of a token.
Definition abg-ir.h:385
void set_artificial(size_t v)
Set the artificial-ness of the location.
Definition abg-ir.cc:667
location()
Default constructor for the location type.
Definition abg-ir.cc:692
bool get_is_artificial() const
Test if the location is artificial.
Definition abg-ir.cc:646
bool operator<(const location &other) const
"Less than" operator of the location type.
Definition abg-ir.cc:724
location & operator=(const location &l)
Assignment operator of the location.
Definition abg-ir.cc:683
bool operator==(const location &other) const
Equality operator of the location type.
Definition abg-ir.cc:714
unsigned get_value() const
Get the value of the location.
Definition abg-ir.cc:698
string expand(void) const
Expand the location into a string.
Definition abg-ir.cc:758
Abstraction of a member function context relationship. This relates a member function to its parent c...
Definition abg-ir.h:4513
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition abg-ir.cc:28931
bool is_const() const
Getter for the 'is-const' property.
Definition abg-ir.cc:28978
size_t vtable_offset() const
Getter for the vtable offset property.
Definition abg-ir.cc:28905
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition abg-ir.cc:28954
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition abg-ir.h:3867
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition abg-ir.h:3887
bool get_is_static() const
Definition abg-ir.h:3899
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition abg-ir.h:3894
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition abg-ir.h:3906
Abstracts a member class template template.
Definition abg-ir.h:4643
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition abg-ir.cc:27968
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:28053
Abstract a member function template.
Definition abg-ir.h:4588
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:27947
Abstraction of the declaration of a method.
Definition abg-ir.h:3915
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition abg-ir.cc:7632
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition abg-ir.cc:26785
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition abg-ir.cc:7513
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition abg-ir.cc:7675
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition abg-ir.cc:7481
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition abg-ir.cc:7574
const method_type_sptr get_type() const
Definition abg-ir.cc:26817
friend bool member_function_has_vtable_offset(const function_decl &)
Test if a virtual member function has a vtable offset set.
Definition abg-ir.cc:7664
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition abg-ir.cc:7544
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition abg-ir.cc:7602
Abstracts the type of a class member function.
Definition abg-ir.h:3527
void set_class_type(const class_or_union_sptr &t)
Sets the class type of the current instance of method_type.
Definition abg-ir.cc:23498
bool get_is_static() const
Fetter of the "is-static" property of method_type.
Definition abg-ir.cc:23563
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:23476
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition abg-ir.cc:23533
virtual bool traverse(ir_node_visitor &)
Traverses an instance of method_type, visiting all the sub-types and decls that it might contain.
Definition abg-ir.cc:23624
bool get_is_for_static_method() const
Test if the current method type is for a static method or not.
Definition abg-ir.cc:23578
void set_is_static(bool)
Setter of the "is-static" property of method_type.
Definition abg-ir.cc:23553
friend interned_string get_method_type_name(const method_type &fn_type, bool internal)
Get the name of a given method type and return a copy of it.
Definition abg-ir.cc:10468
virtual ~method_type()
The destructor of method_type.
Definition abg-ir.cc:23668
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current method_type.
Definition abg-ir.cc:23523
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition abg-ir.cc:23486
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition abg-ir.cc:23543
The abstraction of a namespace declaration.
Definition abg-ir.h:2211
bool is_empty_or_has_empty_sub_namespaces() const
Test if the current namespace_decl is empty or contains empty namespaces itself.
Definition abg-ir.cc:18200
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:18231
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition abg-ir.cc:18186
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return a copy of the pretty representation of the namespace.
Definition abg-ir.cc:18172
Abstracts non type template parameters.
Definition abg-ir.h:3690
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition abg-ir.cc:29352
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:29357
The abstraction of a pointer type.
Definition abg-ir.h:2354
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition abg-ir.cc:18905
virtual void get_qualified_name(interned_string &, bool internal=false) const
Build and return the qualified name of the current instance of pointer_type_def.
Definition abg-ir.cc:19032
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18895
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:18822
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19124
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition abg-ir.cc:18968
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition abg-ir.cc:19012
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition abg-ir.cc:19019
The abstraction of a pointer-to-member type.
Definition abg-ir.h:2489
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Get the qualified name for the current ptr_to_mbr_type.
Definition abg-ir.cc:19792
virtual const interned_string & get_name() const
Getter of the name of the current ptr-to-mbr-type.
Definition abg-ir.cc:19702
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19715
const type_base_sptr & get_containing_type() const
Getter of the type containing the member pointed-to by the current ptr_to_mbr_type.
Definition abg-ir.cc:19735
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
Definition abg-ir.cc:19776
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function for ptr_to_mbr_type.
Definition abg-ir.cc:19843
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
Definition abg-ir.cc:19726
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
Definition abg-ir.cc:19868
The abstraction of a qualified type.
Definition abg-ir.h:2240
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for qualified_type_def.
Definition abg-ir.cc:18535
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition abg-ir.cc:18668
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition abg-ir.cc:18399
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18387
string get_cv_quals_string_prefix() const
Compute and return the string prefix or suffix representing the qualifiers hold by the current instan...
Definition abg-ir.cc:18653
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition abg-ir.h:2259
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:18325
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition abg-ir.cc:18641
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:18607
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition abg-ir.cc:18633
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition abg-ir.cc:18658
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition abg-ir.cc:18479
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition abg-ir.cc:18302
Abstracts a reference type.
Definition abg-ir.h:2420
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the reference_type_def.
Definition abg-ir.cc:19453
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19316
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:19218
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19573
void set_pointed_to_type(type_base_sptr &pointed_to_type)
Setter of the pointed_to type of the current reference type.
Definition abg-ir.cc:19326
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition abg-ir.cc:19395
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of reference_type_def.
Definition abg-ir.cc:19552
A declaration that introduces a scope.
Definition abg-ir.h:1853
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl_sptr scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
Definition abg-ir.cc:9616
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition abg-ir.cc:9028
friend void add_member_type(scope_decl_sptr scope, type_base_sptr t)
Add a member type to a given scope.
Definition abg-ir.cc:9231
friend bool remove_member_decl(scope_decl_sptr scope, decl_base_sptr member)
Remove a declaration from the current scope.
Definition abg-ir.cc:9377
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition abg-ir.cc:9642
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition abg-ir.cc:9046
friend decl_base_sptr add_member_decl(scope_decl_sptr scope, decl_base_sptr member)
Add a member decl to this scope. Note that user code should not use this, but rather use add_decl_to_...
Definition abg-ir.cc:9147
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition abg-ir.cc:9081
friend decl_base_sptr insert_decl_into_scope(decl_base_sptr decl, scope_decl::declarations::iterator before, scope_decl_sptr scope)
Inserts a declaration into a given scope, before a given IR child node of the scope.
Definition abg-ir.cc:9666
declarations get_member_decls_copy() const
Getter for a copy of the member declarations carried by the current scope_decl.
Definition abg-ir.cc:8987
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition abg-ir.h:1864
bool is_empty() const
Test if the current scope is empty.
Definition abg-ir.cc:9095
type_base_sptrs_type get_sorted_member_types_copy() const
Get a copy of the sorted member types.
Definition abg-ir.cc:9325
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:9587
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition abg-ir.cc:9179
bool remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition abg-ir.cc:9258
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition abg-ir.h:1862
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition abg-ir.h:1860
const type_base_sptrs_type & get_sorted_canonical_types() const
Return a vector of sorted canonical types of the current scope.
Definition abg-ir.cc:8945
bool find_iterator_for_member(const decl_base *, declarations::iterator &)
Find a member of the current scope and return an iterator on it.
Definition abg-ir.cc:9538
type_base_sptr find_member_type(const string &name) const
Find a member type of a given name, inside the current scope_decl.
Definition abg-ir.cc:9190
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition abg-ir.cc:8969
const canonical_type_sptr_set_type & get_canonical_types() const
@eturn the set of canonical types of the the current scope.
Definition abg-ir.cc:8933
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition abg-ir.cc:9279
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
Definition abg-ir.cc:9492
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition abg-ir.cc:9005
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition abg-ir.cc:9064
A type that introduces a scope.
Definition abg-ir.h:2188
virtual bool traverse(ir_node_visitor &)
Traverses an instance of scope_type_decl, visiting all the sub-types and decls that it might contain.
Definition abg-ir.cc:18094
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition abg-ir.cc:18056
The base class of templates.
Definition abg-ir.h:3595
const std::list< template_parameter_sptr > & get_template_parameters() const
Get the list of template parameters of the current instance of template_decl.
Definition abg-ir.cc:29027
virtual ~template_decl()
Destructor.
Definition abg-ir.cc:29052
void add_template_parameter(const template_parameter_sptr p)
Add a new template parameter to the current instance of template_decl.
Definition abg-ir.cc:29019
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:29061
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition abg-ir.h:3627
virtual ~template_parameter()
Destructor.
Definition abg-ir.cc:29181
bool operator!=(const template_parameter &) const
Inequality operator.
Definition abg-ir.cc:29177
Abstracts a template template parameter.
Definition abg-ir.h:3723
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:29430
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
Definition abg-ir.h:692
const scope_decl_sptr get_global_scope() const
Getter of the the global scope of the translation unit.
Definition abg-ir.cc:1683
void set_address_size(char)
Setter of the address size in this translation unit.
Definition abg-ir.cc:1920
const type_sptr_set_type & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
Definition abg-ir.cc:1725
const std::string & get_absolute_path() const
Get the concatenation of the build directory and the relative path of the translation unit.
Definition abg-ir.cc:1820
void set_is_constructed(bool)
Setter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
Definition abg-ir.cc:1958
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
Definition abg-ir.cc:1971
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
Definition abg-ir.cc:1872
char get_address_size() const
Getter of the address size in this translation unit.
Definition abg-ir.cc:1910
const std::string & get_compilation_dir_path() const
Get the path of the directory that was 'current' when the translation unit was compiled.
Definition abg-ir.cc:1795
friend type_base_sptr synthesize_type_from_translation_unit(const type_base_sptr &type, translation_unit &tu)
In a translation unit, lookup a given type or synthesize it if it's a qualified type.
Definition abg-ir.cc:16069
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
Definition abg-ir.cc:1850
void set_language(language l)
Setter of the language of the source code of the translation unit.
Definition abg-ir.cc:1749
void bind_function_type_life_time(function_type_sptr) const
Ensure that the life time of a function type is bound to the life time of the current translation uni...
Definition abg-ir.cc:1997
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
Definition abg-ir.cc:1896
bool is_constructed() const
Getter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
Definition abg-ir.cc:1939
friend function_type_sptr synthesize_function_type_from_translation_unit(const function_type &fn_type, translation_unit &tu)
In a translation unit, lookup the sub-types that make up a given function type and if the sub-types a...
Definition abg-ir.cc:16152
const std::string & get_path() const
Get the path of the current translation unit.
Definition abg-ir.cc:1765
void set_compilation_dir_path(const std::string &)
Set the path of the directory that was 'current' when the translation unit was compiled.
Definition abg-ir.cc:1809
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
Definition abg-ir.cc:1880
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
Definition abg-ir.cc:1779
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
Definition abg-ir.cc:2049
language
The language of the translation unit.
Definition abg-ir.h:706
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition abg-ir.h:702
bool operator!=(const translation_unit &) const
Inequality operator.
Definition abg-ir.cc:1986
const environment & get_environment() const
Getter of the environment of the current translation_unit.
Definition abg-ir.cc:1732
const type_maps & get_types() const
Getter of the types of the current translation_unit.
Definition abg-ir.cc:1709
language get_language() const
Getter of the language of the source code of the translation unit.
Definition abg-ir.cc:1739
The interface for types which are feeling social and want to be visited during the traversal of a hie...
An abstraction helper for type declarations.
Definition abg-ir.h:2014
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition abg-ir.cc:17165
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition abg-ir.cc:17233
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:17132
virtual bool traverse(ir_node_visitor &)
Default implementation of traversal for types. This function does nothing. It must be implemented by ...
Definition abg-ir.cc:17268
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
Definition abg-ir.cc:16719
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition abg-ir.cc:17223
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition abg-ir.cc:17216
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition abg-ir.cc:17206
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition abg-ir.cc:17253
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition abg-ir.cc:17243
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition abg-ir.cc:17146
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition abg-ir.h:3758
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition abg-ir.cc:29536
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition abg-ir.cc:29543
A basic type declaration that introduces no scope.
Definition abg-ir.h:2122
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for type_decl.
Definition abg-ir.cc:17888
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:17728
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17967
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:17826
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:17782
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of type_decl.
Definition abg-ir.cc:17947
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Definition abg-ir.h:593
istring_type_base_wptrs_map_type & typedef_types()
Getter for the map that associates the name of a typedef to the vector of instances of typedef_decl_s...
Definition abg-ir.cc:968
istring_type_base_wptrs_map_type & function_types()
Getter for the map that associates the name of a function type to the vector of instances of function...
Definition abg-ir.cc:1071
istring_type_base_wptrs_map_type & reference_types()
Getter for the map that associates the name of a reference type to the vector of instances of referen...
Definition abg-ir.cc:1022
const istring_type_base_wptrs_map_type & class_types() const
Getter for the map that associates the name of a class type to the vector of instances of class_decl_...
Definition abg-ir.cc:926
istring_type_base_wptrs_map_type & union_types()
Getter for the map that associates the name of a union type to the vector of instances of union_decl_...
Definition abg-ir.cc:940
istring_type_base_wptrs_map_type & array_types()
Getter for the map that associates the name of an array type to the vector of instances of array_type...
Definition abg-ir.cc:1036
istring_type_base_wptrs_map_type & enum_types()
Getter for the map that associates the name of an enum type to the vector of instances of enum_type_d...
Definition abg-ir.cc:954
bool empty() const
Test if the type_maps is empty.
Definition abg-ir.cc:894
istring_type_base_wptrs_map_type & qualified_types()
Getter for the map that associates the name of a qualified type to the vector of instances of qualifi...
Definition abg-ir.cc:981
istring_type_base_wptrs_map_type & ptr_to_mbr_types()
Getter for the map that associates the name of a pointer-to-member type to the vector of instances of...
Definition abg-ir.cc:1001
istring_type_base_wptrs_map_type & pointer_types()
Getter for the map that associates the name of a pointer type to the vector of instances of pointer_t...
Definition abg-ir.cc:994
const istring_type_base_wptrs_map_type & basic_types() const
Getter for the map that associates the name of a basic type to the vector instances of type_decl_sptr...
Definition abg-ir.cc:912
const vector< type_base_wptr > & get_types_sorted() const
Getter of all types types sorted by their pretty representation.
Definition abg-ir.cc:1583
const istring_type_base_wptrs_map_type & subrange_types() const
Getter for the map that associates the name of a subrange type to the vector of instances of array_ty...
Definition abg-ir.cc:1057
The base class of both types and declarations.
Definition abg-ir.h:1378
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition abg-ir.cc:5251
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current decl.
Definition abg-ir.cc:5332
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:5033
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition abg-ir.cc:5022
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition abg-ir.cc:5184
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition abg-ir.cc:5191
std::recursive_mutex & get_mutex() const
Get the recursive mutex associated to the artifact.
Definition abg-ir.cc:5359
friend type_or_decl_base::type_or_decl_kind & operator|=(type_or_decl_base::type_or_decl_kind &, type_or_decl_base::type_or_decl_kind)
bitwise "|=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
Definition abg-ir.cc:4983
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition abg-ir.cc:5243
friend hash_t set_or_get_cached_hash_value(const T &type_or_decl)
Set the hash value of an IR node and return it.
offset_t get_native_offset() const
Get the native offset of a given artifact.
Definition abg-ir.cc:5205
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:5135
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition abg-ir.cc:5056
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:5045
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition abg-ir.cc:5367
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition abg-ir.cc:5076
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition abg-ir.cc:12404
void set_native_offset(const offset_t)
Set the native offset of a given artifact.
Definition abg-ir.cc:5216
friend type_or_decl_base::type_or_decl_kind & operator&=(type_or_decl_base::type_or_decl_kind &, type_or_decl_base::type_or_decl_kind)
bitwise "A&=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
Definition abg-ir.cc:5003
void set_original_artefact(const type_or_decl_base *)
Set the original artefact that the current artefact was copied from.
Definition abg-ir.cc:5305
const type_or_decl_base * get_original_artefact() const
Get the original artefact that the current artefact was copied from.
Definition abg-ir.cc:5296
void set_corpus(corpus *) const
Set the ABI corpus associated to the current ABI artifact.
Definition abg-ir.cc:5233
friend hash_t peek_hash_value(const type_or_decl_base &)
Get the hash value associated to an IR node.
Definition abg-ir.cc:30142
const void * type_or_decl_base_pointer() const
Getter of the pointer to either the type_base sub-object of the current instance if it's a type,...
Definition abg-ir.cc:5111
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition abg-ir.cc:11971
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition abg-ir.cc:5166
type_or_decl_kind
This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact....
Definition abg-ir.h:1389
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition abg-ir.cc:5148
friend type_or_decl_base::type_or_decl_kind operator|(type_or_decl_base::type_or_decl_kind, type_or_decl_base::type_or_decl_kind)
bitwise "OR" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
Definition abg-ir.cc:4973
friend hash_t get_subtype_hash(const type_or_decl_base *t)
Compute (or get) the hash of a sub-type of the type for which we are currently computing the hash....
Definition abg-hash.cc:349
friend type_or_decl_base::type_or_decl_kind operator&(type_or_decl_base::type_or_decl_kind, type_or_decl_base::type_or_decl_kind)
bitwise "AND" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
Definition abg-ir.cc:4993
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition abg-ir.cc:12044
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition abg-ir.cc:5283
Abstracts a type template parameter.
Definition abg-ir.h:3656
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:29223
The abstraction of a typedef declaration.
Definition abg-ir.h:2936
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
Definition abg-ir.cc:22045
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition abg-ir.cc:22030
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition abg-ir.cc:21860
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:21847
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:22077
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition abg-ir.cc:22023
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:21966
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition abg-ir.cc:21889
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for a typedef_decl.
Definition abg-ir.cc:22007
Abstracts a union type declaration.
Definition abg-ir.h:4449
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:28328
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:28445
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition abg-ir.cc:28385
virtual ~union_decl()
Destructor of the union_decl type.
Definition abg-ir.cc:28519
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of union_decl.
Definition abg-ir.cc:28352
Abstracts a variable declaration.
Definition abg-ir.h:3069
binding get_binding() const
Getter of the binding of the variable.
Definition abg-ir.cc:22196
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition abg-ir.cc:22178
void set_binding(binding b)
Setter of the binding of the variable.
Definition abg-ir.cc:22203
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition abg-ir.cc:7285
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition abg-ir.cc:22241
virtual const interned_string & get_qualified_name(bool internal=false) const
Get the qualified name of a given variable or data member.
Definition abg-ir.cc:22495
const elf_symbol_sptr get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using var_decl::set_symbol(...
Definition abg-ir.cc:22234
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition abg-ir.cc:22189
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition abg-ir.cc:7430
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition abg-ir.cc:22171
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:22657
string get_anon_dm_reliable_name(bool qualified=true) const
Get a name that is valid even for an anonymous data member.
Definition abg-ir.cc:22634
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition abg-ir.cc:7359
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition abg-ir.cc:22218
friend void set_data_member_offset(var_decl_sptr m, uint64_t o)
Set the offset of a data member into its containing class.
Definition abg-ir.cc:7253
friend void set_data_member_is_laid_out(var_decl_sptr m, bool l)
Set a flag saying if a data member is laid out.
Definition abg-ir.cc:7416
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition abg-ir.cc:22425
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
Definition abg-ir.cc:22525
interned_string get_id() const
Return an ID that tries to uniquely identify the variable inside a program or a library.
Definition abg-ir.cc:22444
real_type::modifiers_type operator~(real_type::modifiers_type l)
Bitwise one's complement operator for real_type::modifiers_type.
Definition abg-ir.cc:17325
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition abg-fwd.h:236
hash_t peek_hash_value(const type_or_decl_base &artefact)
Get the hash value associated to an IR node.
Definition abg-ir.cc:30142
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
Definition abg-fwd.h:222
unordered_map< string, type_base_sptr > string_type_base_sptr_map_type
A convenience typedef for a map which key is a string and which value is a type_base_sptr.
Definition abg-ir.h:563
bool equals(const decl_base &l, const decl_base &r, change_kind *k, bool qualified_name, bool linkage_name)
Compares two instances of decl_base.
Definition abg-ir.cc:6243
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition abg-fwd.h:273
access_specifier
Access specifier for class members.
Definition abg-ir.h:915
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition abg-ir.cc:24390
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
Definition abg-fwd.h:293
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
void fixup_virtual_member_function(method_decl_sptr method)
When a virtual member function has seen its virtualness set by set_member_function_is_virtual(),...
Definition abg-ir.cc:27048
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two array types are equals modulo CV qualifiers.
Definition abg-ir.cc:20690
unordered_set< type_or_decl_base_sptr, type_or_decl_hash, type_or_decl_equal > artifact_sptr_set_type
A convenience typedef for a hash set of type_or_decl_base_sptr.
Definition abg-ir.h:550
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
Definition abg-ir.cc:2061
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
Definition abg-fwd.h:129
class_decl::base_spec * is_class_base_spec(const type_or_decl_base *tod)
Test if an ABI artifact is a class base specifier.
Definition abg-ir.cc:27862
array_type_def::subrange_type * is_subrange_type(const type_or_decl_base *type)
Test if a type is an array_type_def::subrange_type.
Definition abg-ir.cc:13446
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition abg-ir.h:924
unordered_set< const type_or_decl_base *, type_or_decl_hash, type_or_decl_equal > artifact_ptr_set_type
A convenience typedef for a hash set of const type_or_decl_base*.
Definition abg-ir.h:555
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition abg-ir.h:1332
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition abg-ir.h:1336
@ SUBTYPE_CHANGE_KIND
This means that a given IR artifact has changes in some of its sub-types, with respect to the other a...
Definition abg-ir.h:1352
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition abg-ir.h:1347
@ LOCAL_NON_TYPE_CHANGE_KIND
This means that a given IR artifact has a local non-type change. That is a change that is carried by ...
Definition abg-ir.h:1341
abg_compat::optional< uint64_t > offset_t
The abstraction for a native offset.
Definition abg-ir.h:117
bool operator==(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep comparison operator for pointers to translation units.
Definition abg-ir.cc:2370
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
Definition abg-ir.h:146
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
Definition abg-fwd.h:245
string get_pretty_representation(const type_or_decl_base *tod, bool internal)
Build and return a copy of the pretty representation of an ABI artifact that could be either a type o...
Definition abg-ir.cc:10511
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition abg-ir.h:940
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
Definition abg-fwd.h:318
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition abg-fwd.h:194
bool string_to_elf_symbol_type(const string &s, elf_symbol::type &t)
Convert a string representing a symbol type into an elf_symbol::type.
Definition abg-ir.cc:3693
void fns_to_str(vector< function_decl * >::const_iterator a_begin, vector< function_decl * >::const_iterator a_end, vector< function_decl * >::const_iterator b_begin, vector< function_decl * >::const_iterator b_end, std::ostream &o)
For each sequence of functions given in argument, generate a sequence of string that matches a given ...
Definition abg-ir.cc:32355
string get_name(const type_or_decl_base *tod, bool qualified)
Build and return a copy of the name of an ABI artifact that is either a type or a decl.
Definition abg-ir.cc:9888
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:6653
abg_compat::optional< uint64_t > hash_t
The abstraction for an 8 bytes hash value.
Definition abg-ir.h:109
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition abg-fwd.h:211
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition abg-fwd.h:168
std::ostream & operator<<(std::ostream &o, elf_symbol::type t)
Serialize an instance of symbol_type and stream it to a given output stream.
Definition abg-ir.cc:3565
bool var_equals_modulo_types(const var_decl &l, const var_decl &r, change_kind *k)
Compares two instances of var_decl without taking their type into account.
Definition abg-ir.cc:22302
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
Definition abg-ir.cc:3774
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition abg-ir.cc:2329
std::unordered_map< string, elf_symbol_sptr > string_elf_symbol_sptr_map_type
Convenience typedef for a map which key is a string and which value if the elf symbol of the same nam...
Definition abg-ir.h:932
void perform_type_canonicalization(vector< type_base_sptr > &types, bool do_log, bool show_stats)
Hash and canonicalize a sequence of types.
Definition abg-ir.cc:31859
unordered_map< interned_string, type_base_wptrs_type, hash_interned_string > istring_type_base_wptrs_map_type
A convenience typedef for a map which key is an interned_string and which value is a vector of type_b...
Definition abg-fwd.h:149
bool function_decl_is_less_than(const function_decl &f, const function_decl &s)
Test if the pretty representation of a given function_decl is lexicographically less then the pretty ...
Definition abg-ir.cc:30401
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition abg-ir.cc:3489
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition abg-fwd.h:257
method_decl_sptr copy_member_function(class_or_union_sptr t, const method_decl_sptr &method)
Copy a method of a class_or_union into a new class_or_union.
Definition abg-ir.cc:26001
bool enum_equals_modulo_name(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums are equal modulo their names. That is, the test compares the two enums as if they d...
Definition abg-ir.cc:21539
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
void move_member_type(decl_base_sptr member_type, scope_decl_sptr new_scope)
Move a member type of a scope_decl to another scope_decl.
Definition abg-ir.cc:26138
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition abg-fwd.h:265
bool string_to_elf_symbol_binding(const string &s, elf_symbol::binding &b)
Convert a string representing a an elf symbol binding into an elf_symbol::binding.
Definition abg-ir.cc:3726
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
Definition abg-fwd.h:118
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
Definition abg-fwd.h:137
shared_ptr< string_elf_symbols_map_type > string_elf_symbols_map_sptr
Convenience typedef for a shared pointer to string_elf_symbols_map_type.
Definition abg-ir.h:949
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition abg-ir.h:1273
shared_ptr< string_elf_symbol_sptr_map_type > string_elf_symbol_sptr_map_sptr
Convenience typedef for a shared pointer to an string_elf_symbol_sptr_map_type.
Definition abg-ir.h:937
qualified_type_def_sptr lookup_qualified_type(const interned_string &type_name, const translation_unit &tu)
Lookup a qualified type from a translation unit.
Definition abg-ir.cc:13859
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition abg-ir.cc:2345
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition abg-ir.cc:11948
bool string_to_elf_symbol_visibility(const string &s, elf_symbol::visibility &v)
Convert a string representing a an elf symbol visibility into an elf_symbol::visibility.
Definition abg-ir.cc:3751
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition abg-ir.h:927
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition abg-fwd.h:227
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
Definition abg-ir.cc:21248
translation_unit::language string_to_translation_unit_language(const string &l)
Parse a string representing a language into a translation_unit::language enumerator into a string.
Definition abg-ir.cc:2191
const function_decl::parameter * get_function_parameter(const decl_base *fun, unsigned parm_index)
Get the function parameter designated by its index.
Definition abg-ir.cc:30747
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition abg-ir.cc:13289
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition abg-ir.cc:2313
method_decl * is_method_decl(const type_or_decl_base *d)
Test if a function_decl is actually a method_decl.
Definition abg-ir.cc:26879
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:6624
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition abg-fwd.h:176
vector< type_base * > type_base_ptrs_type
Helper typedef for a vector of pointer to type_base.
Definition abg-ir.h:143
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
Definition abg-ir.h:103
unordered_map< interned_string, type_base_wptr, hash_interned_string > istring_type_base_wptr_map_type
A convenience typedef for a map which key is an interned_string and which value is a type_base_wptr.
Definition abg-ir.h:568
vector< namespace_decl_sptr > namespaces_type
A convenience typedef for vectors of namespace_decl_sptr.
Definition abg-ir.h:2233
void sort_types(IteratorType begin, IteratorType end, SortingFunctorType comp, bool do_log=false)
Sort types.
interned_string get_name_of_qualified_type(const type_base_sptr &underlying_type, qualified_type_def::CV quals, bool qualified, bool internal)
Get the name of a qualified type, given the underlying type and its qualifiers.
Definition abg-ir.cc:10278
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
Definition abg-fwd.h:310
string get_string_representation_of_cv_quals(const qualified_type_def::CV cv_quals)
Get the string representation of a CV qualifier bitmap.
Definition abg-ir.cc:9858
unordered_set< type_base_sptr, shallow_type_hasher, shallow_type_eq > type_sptr_set_type
Convenience typedef for a set of type_base_sptr.
Definition abg-ir.h:194
std::set< translation_unit_sptr, shared_translation_unit_comp > translation_units
Convenience typedef for an ordered set of translation_unit_sptr.
Definition abg-ir.h:887
const var_decl * lookup_data_member(const type_base *type, const char *dm_name)
Look for a data member of a given class, struct or union type and return it.
Definition abg-ir.cc:30704
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition abg-fwd.h:162
unordered_set< type_base_wptr, shallow_type_hasher, shallow_type_eq > type_wptr_set_type
Convenience typedef for a set of type_base_wptr.
Definition abg-ir.h:199
unordered_set< type_base_sptr, canonical_type_hash > canonical_type_sptr_set_type
Helper typedef for an unordered set of type_base_sptr which uses pointer value to tell its members ap...
Definition abg-ir.h:133
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
Definition abg-ir.cc:2354
unordered_map< interned_string, type_or_decl_base_sptr, hash_interned_string > istring_type_or_decl_base_sptr_map_type
A convenience typedef for a map which key is an interned_string and which value is a type_base_wptr.
Definition abg-ir.h:575
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
bool operator!=(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep inequality operator for pointers to translation units.
Definition abg-ir.cc:2389
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition abg-ir.cc:11919
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
Definition abg-ir.cc:3784
std::unordered_map< string, elf_symbols > string_elf_symbols_map_type
Convenience typedef for a map which key is a string and which value is a vector of elf_symbol.
Definition abg-ir.h:945
unordered_set< type_base *, canonical_type_hash > canonical_type_ptr_set_type
Helper typedef for an unordered set of type_base* which uses pointer value to tell its members appart...
Definition abg-ir.h:140
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
Definition abg-fwd.h:298
unordered_map< string, type_base_wptr > string_type_base_wptr_map_type
A convenience typedef for a map which key is a string and which value is a type_base_wptr.
Definition abg-ir.h:559
bool maybe_compare_as_member_decls(const decl_base &l, const decl_base &r, change_kind *k)
Compare the properties that belong to the "is-a-member-relation" of a decl.
Definition abg-ir.cc:6193
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
Definition abg-ir.cc:341
A functor to hash instances of interned_string.
Hash functor for instances of array_type_def::hash.
Definition abg-hash.h:180
Hash functor for instances of array_type_def::subrange_type.
Definition abg-hash.h:170
Functor to hash a canonical type by using its pointer value.
Definition abg-ir.h:124
size_t operator()(const type_base_sptr &l) const
Hash a type by returning the pointer value of its canonical type.
Definition abg-ir.cc:8879
The hashing functor for class_decl::base_spec.
Definition abg-hash.h:253
Hasher for the class_decl type.
Definition abg-hash.h:263
The private data for the class_decl type.
Hasher for the class_or_union type.
Definition abg-hash.h:243
Hash functor for instances of enum_type_decl.
Definition abg-hash.h:190
The private data of the environment type.
Equality functor for instances of function_decl.
Definition abg-ir.h:4713
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition abg-ir.h:4725
The hashing functor for function_type.
Definition abg-hash.h:210
The type of the private data of the function_type type.
The base of an entity of the intermediate representation that is to be traversed.
Definition abg-ir.h:461
virtual bool traverse(ir_node_visitor &v)
Traverse a given IR node and its children, calling an visitor on each node.
Definition abg-ir.cc:31866
The hashing functor for member_base.
Definition abg-hash.h:236
Hashing functor for the method_type type.
Definition abg-hash.h:223
The base class for the visitor type hierarchy used for traversing a hierarchy of nodes.
Hash functor for instances of pointer_type_def.
Definition abg-hash.h:137
Hash functor for instances of ptr_to_mbr_type.
Definition abg-hash.h:157
Hash functor for instances of qualified_type_def.
Definition abg-hash.h:127
Hash functor for instances of reference_type_def.
Definition abg-hash.h:147
An equality functor for type_base_sptr that only compares their pointer values and does not do any de...
Definition abg-ir.h:173
bool operator()(const type_base_sptr &l, const type_base_sptr &r) const
The equality operator.
Definition abg-ir.h:183
A hashing functor for type_base_sptr that doesn't do any deep type comparison but rather just compare...
Definition abg-ir.h:155
uint64_t operator()(const type_base_sptr &t) const
The hashing operator of a type_base_sptr.
Definition abg-ir.h:162
A comparison functor to compare translation units based on their absolute paths.
Definition abg-ir.h:870
bool operator()(const translation_unit_sptr &lhs, const translation_unit_sptr &rhs) const
Compare two translations units based on their absolute paths.
Definition abg-ir.h:879
Private type to hold private members of translation_unit.
Hash functor for instances of type_base.
Definition abg-hash.h:104
Definition of the private data of type_base.
Hash functor for instances of type_decl.
Definition abg-hash.h:117
A comparison functor to compare pointer to instances of type_or_decl_base.
Definition abg-ir.h:3303
bool operator()(const type_or_decl_base_sptr &f, const type_or_decl_base_sptr &s)
Comparison operator for ABI artifacts.
Definition abg-ir.h:3337
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition abg-ir.h:3312
The comparison functor for using instances of type_or_decl_base as values in a hash map or set.
Definition abg-ir.h:475
bool operator()(const type_or_decl_base_sptr &l, const type_or_decl_base_sptr &r) const
The function-call operator to compare the string representations of two ABI artifacts.
Definition abg-ir.h:509
bool operator()(const type_or_decl_base *l, const type_or_decl_base *r) const
The function-call operator to compare the string representations of two ABI artifacts.
Definition abg-ir.h:489
The hashing functor for using instances of type_or_decl_base as values in a hash map or set.
Definition abg-ir.h:517
size_t operator()(const type_or_decl_base *artifact) const
Function-call Operator to hash the string representation of an ABI artifact.
Definition abg-ir.h:527
size_t operator()(const type_or_decl_base_sptr &artifact) const
Function-call Operator to hash the string representation of an ABI artifact.
Definition abg-ir.h:542
A predicate for deep equality of instances of type_base*.
Definition abg-ir.h:2080
A predicate for deep equality of instances of shared_ptr<type_base>
Definition abg-ir.h:2100
Hash functor for instances of typedef_decl.
Definition abg-hash.h:200
Hash functor for instances of union_decl type.
Definition abg-hash.h:273
A comparison functor for pointers to var_decl.
Definition abg-ir.h:4692
bool operator()(const var_decl *l, const var_decl *r) const
Return true if the two instances of var_decl are equal.
Definition abg-ir.h:4701