libabigail
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-2023 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 "abg-cxx-compat.h"
25#include "abg-fwd.h"
26#include "abg-hash.h"
27#include "abg-traverse.h"
28#include "abg-config.h"
29
30/// @file
31///
32/// This file contains the declarations of the Internal Representation
33/// of libabigail.
34
35/// @defgroup Memory Memory management
36/// @{
37///
38/// How objects' lifetime is handled in libabigail.
39///
40/// For memory management and garbage collection of libabigail's IR
41/// artifacts, we use std::shared_ptr and std::weak_ptr.
42///
43/// When manipulating these IR artifacts, there are a few rules to keep in
44/// mind.
45///
46/// <b>The declaration for a type is owned by only one scope </b>
47///
48/// This means that for each instance of abigail::type_base (a type) there
49/// is an instance of abigail::scope_decl that owns a @ref
50/// abigail::decl_base_sptr (a shared pointer to an abigail::decl_base)
51/// that points to the declaration of that type. The
52/// abigail::type_base_sptr is added to the scope using the function
53/// abigail::add_decl_to_scope().
54///
55/// There is a kind of type that is usually not syntactically owned by
56/// a scope: it's function type. In libabigail, function types are
57/// represented by abigail::function_type and abigail::method_type.
58/// These types must be owned by the translation unit they originate
59/// from. Adding them to the translation unit must be done by a call
60/// to the method function
61/// abigail::translation::bind_function_type_life_time().
62///
63/// <b> A declaration that has a type does NOT own the type </b>
64///
65/// This means that, for instance, in an abigail::var_decl (a variable
66/// declaration), the type of the declaration is not owned by the
67/// declaration. In other (concrete) words, the variable declaration
68/// doesn't have a shared pointer to the type. Rather, it has a *weak*
69/// pointer to its type. That means that it has a data member of type
70/// abigail::type_base_wptr that contains the type of the declaration.
71///
72/// But then abigail::var_decl::get_type() returns a shared pointer that
73/// is constructed from the internal weak pointer to the type. That way,
74/// users of the type of the var can own a temporary reference on it and
75/// be assured that the type's life time is long enough for their need.
76///
77/// Likewise, data members, function and template parameters similarly
78/// have weak pointers on their type.
79///
80/// If, for a reason, you really need to keep a type alive for the
81/// entire lifetime of the type system, then you can bind the life
82/// time of that type to the life time of the @ref environment that is
83/// supposed to outlive the type system. You do that by passing the
84/// type to the function environment::keep_type_alive().
85///
86/// @}
87
88namespace abigail
89{
90
91/// The namespace of the internal representation of ABI artifacts like
92/// types and decls.
93namespace ir
94{
95
96// Inject some std types in here.
97using std::unordered_map;
98
99/// A convenience typedef for an unordered set of pointer values
100typedef unordered_set<uintptr_t> pointer_set;
101
102/// Functor to hash a canonical type by using its pointer value.
104{
105 size_t operator()(const type_base_sptr& l) const;
106 size_t operator()(const type_base *l) const;
107}; //end struct canonical_type_hash
108
109/// Helper typedef for an unordered set of type_base_sptr which uses
110/// pointer value to tell its members appart, because the members are
111/// canonical types.
112typedef unordered_set<type_base_sptr,
114
115/// Helper typedef for a vector of pointer to type_base.
116typedef vector<type_base*> type_base_ptrs_type;
117
118/// Helper typedef for a vector of shared pointer to a type_base.
119typedef vector<type_base_sptr> type_base_sptrs_type;
120
121void
123 vector<type_base_sptr>& result);
124
125/// This is an abstraction of the set of resources necessary to manage
126/// several aspects of the internal representations of the Abigail
127/// library.
128///
129/// An environment can be seen as the boundaries in which all related
130/// Abigail artifacts live. So before doing anything using this
131/// library, the first thing to create is, well, you know it now, an
132/// environment.
133///
134/// Note that the lifetime of environment objects must be longer than
135/// the lifetime of any other type in the Abigail system. So a given
136/// instance of @ref environment must stay around as long as you are
137/// using libabigail. It's only when you are done using the library
138/// that you can de-allocate the environment instance.
140{
141public:
142 struct priv;
143 std::unique_ptr<priv> priv_;
144
145 /// A convenience typedef for a map of canonical types. The key is
146 /// the pretty representation string of a particular type and the
147 /// value is the vector of canonical types that have the same pretty
148 /// representation string.
149 typedef std::unordered_map<string, std::vector<type_base_sptr> >
151
152 environment();
153
154 virtual ~environment();
155
158
161
162 const type_base_sptr&
163 get_void_type() const;
164
165 const type_base_sptr&
166 get_void_pointer_type() const;
167
168 const type_base_sptr&
170
171 static string&
173
174 bool
176
177 void
179
180 bool
182
183 void
185
186 bool
188
189 void
191
192 bool
193 is_void_type(const type_base_sptr&) const;
194
195 bool
196 is_void_type(const type_base*) const;
197
198 bool
199 is_void_pointer_type(const type_base_sptr&) const;
200
201 bool
202 is_void_pointer_type(const type_base*) const;
203
204 bool
206
207 bool
208 is_variadic_parameter_type(const type_base_sptr&) const;
209
211 intern(const string&) const;
212
213 const config&
214 get_config() const;
215
216 bool
218
219 void
221
222 bool
224
225#ifdef WITH_DEBUG_SELF_COMPARISON
226 void
227 set_self_comparison_debug_input(const corpus_sptr& corpus);
228
229 void
230 get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
231 corpus_sptr& second_corpus);
232
233 void
234 self_comparison_debug_is_on(bool);
235
236 bool
237 self_comparison_debug_is_on() const;
238#endif
239
240#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
241 void
242 debug_type_canonicalization_is_on(bool flag);
243
244 bool
245 debug_type_canonicalization_is_on() const;
246
247 void
248 debug_die_canonicalization_is_on(bool flag);
249
250 bool
251 debug_die_canonicalization_is_on() const;
252#endif
253
254 vector<type_base_sptr>* get_canonical_types(const char* name);
255
256 type_base* get_canonical_type(const char* name, unsigned index);
257
258#ifdef WITH_DEBUG_SELF_COMPARISON
259 const unordered_map<string, uintptr_t>&
260 get_type_id_canonical_type_map() const;
261
262 unordered_map<string, uintptr_t>&
263 get_type_id_canonical_type_map();
264
265 const unordered_map<uintptr_t, string>&
266 get_pointer_type_id_map() const;
267
268 unordered_map<uintptr_t, string>&
269 get_pointer_type_id_map();
270
271 string
272 get_type_id_from_pointer(uintptr_t ptr) const;
273
274 string
275 get_type_id_from_type(const type_base *ptr) const;
276
277 uintptr_t
278 get_canonical_type_from_type_id(const char*) const;
279#endif
280
281 friend class class_or_union;
282 friend class class_decl;
283 friend class function_type;
284
285 friend void keep_type_alive(type_base_sptr);
286}; // end class environment
287
288class location_manager;
289/// @brief The source location of a token.
290///
291/// This represents the location of a token coming from a given
292/// translation unit. This location is actually an abstraction of
293/// cursor in the table of all the locations of all the tokens of the
294/// translation unit. That table is managed by the @ref location_manager
295/// type. To get the file path, line and column numbers associated to
296/// a given instance of @ref location, you need to use the
297/// location_manager::expand_location method.
299{
300 unsigned value_;
301 // The location manager to use to decode the value above. There is
302 // one location manager per translation unit, and the location
303 // manager's life time is managed by its translation unit.
304 location_manager* loc_manager_;
305 // Whether the location is artificial. Being artificial means that
306 // the location wasn't generated by the original emitter of the
307 // metadata (i.e, the compiler if the metadata is debug info). For
308 // instance, implicit location derived from the position of XML
309 // elements in the abixml file is represented as artificial
310 // locations.
311 bool is_artificial_;
312
313 location(unsigned v, location_manager* m)
314 : value_(v), loc_manager_(m), is_artificial_(false)
315 {}
316
317 /// Get the location manager to use to decode the value of this
318 /// location.
319 ///
320 /// @return the location manager for the current location value.
322 get_location_manager() const
323 {return loc_manager_;}
324
325public:
326
327 /// Test if the location is artificial.
328 ///
329 /// Being artificial means that the location wasn't generated by the
330 /// original emitter of the metadata (i.e, the compiler if the
331 /// metadata is debug info). For instance, the implicit location
332 /// derived from the position of a given XML element in the abixml
333 /// file is represented as artificial locations. The same XML
334 /// element might carry a non-artificial (natural?) location that was
335 /// originally emitted by the compiler that generated the original
336 /// debug info the abixml file is derived from.
337 ///
338 /// @return true iff the location is artificial.
339 bool
341 {return is_artificial_;}
342
343 /// Set the artificial-ness of the location.
344 ///
345 /// Being artificial means that the location wasn't generated by the
346 /// original emitter of the metadata (i.e, the compiler if the
347 /// metadata is debug info). For instance, the implicit location
348 /// derived from the position of a given XML element in the abixml
349 /// file is represented as artificial locations. The same XML
350 /// element might carry a non-artificial (natural?) location that
351 /// was originally emitted by the compiler that generated the
352 /// original debug info the abixml file is derived from.
353 ///
354 /// @param f the new artificial-ness state.
355 void
357 {is_artificial_ = f;}
358
359 /// Copy constructor of the location.
360 ///
361 /// @param l the location to copy from.
363 : value_(l.value_),
364 loc_manager_(l.loc_manager_),
365 is_artificial_(l.is_artificial_)
366 {}
367
368 /// Assignment operator of the location.
369 ///
370 /// @param l the location to assign to the current one.
371 location&
373 {
374 value_ = l.value_;
375 loc_manager_ = l.loc_manager_;
376 is_artificial_ = l.is_artificial_;
377 return *this;
378 }
379
380 /// Default constructor for the @ref location type.
382 : value_(), loc_manager_(), is_artificial_()
383 {}
384
385 /// Get the value of the location.
386 unsigned
387 get_value() const
388 {return value_;}
389
390 /// Convert the location into a boolean.
391 ///
392 /// @return true iff the value of the location is different from
393 /// zero.
394 operator bool() const
395 {return !!value_;}
396
397 /// Equality operator of the @ref location type.
398 ///
399 /// @param other the other location to compare against.
400 ///
401 /// @return true iff both locations are equal.
402 bool
403 operator==(const location &other) const
404 {return value_ == other.value_;}
405
406 /// "Less than" operator of the @ref location type.
407 ///
408 /// @parm other the other location type to compare against.
409 ///
410 /// @return true iff the current instance is less than the @p other
411 /// one.
412 bool
413 operator<(const location &other) const
414 {return value_ < other.value_;}
415
416 /// Expand the current location into a tripplet file path, line and
417 /// column number.
418 ///
419 /// @param path the output parameter this function sets the expanded
420 /// path to.
421 ///
422 /// @param line the output parameter this function sets the expanded
423 /// line number to.
424 ///
425 /// @param column the output parameter this function sets the
426 /// expanded column number to.
427 void
428 expand(std::string& path, unsigned& line, unsigned& column) const;
429
430 string
431 expand(void) const;
432
433 friend class location_manager;
434}; // end class location
435
436/// @brief The entry point to manage locations.
437///
438/// This type keeps a table of all the locations for tokens of a
439/// given translation unit.
441{
442 struct priv;
443 std::unique_ptr<priv> priv_;
444
445public:
446
448
450
452 create_new_location(const std::string& fle, size_t lne, size_t col);
453
454 void
455 expand_location(const location& location, std::string& path,
456 unsigned& line, unsigned& column) const;
457};
458
459/// The base of an entity of the intermediate representation that is
460/// to be traversed.
462{
463 /// Traverse a given IR node and its children, calling an visitor on
464 /// each node.
465 ///
466 /// @param v the visitor to call on each traversed node.
467 ///
468 /// @return true if the all the IR node tree was traversed.
469 virtual bool
471}; // end class ir_traversable_base
472
473/// The hashing functor for using instances of @ref type_or_decl_base
474/// as values in a hash map or set.
476{
477
478 /// Function-call Operator to hash the string representation of an
479 /// ABI artifact.
480 ///
481 /// @param artifact the ABI artifact to hash.
482 ///
483 /// @return the hash value of the string representation of @p
484 /// artifact.
485 size_t
486 operator()(const type_or_decl_base *artifact) const
487 {
488 string repr = get_pretty_representation(artifact);
489 std::hash<string> do_hash;
490 return do_hash(repr);
491 }
492
493 /// Function-call Operator to hash the string representation of an
494 /// ABI artifact.
495 ///
496 /// @param artifact the ABI artifact to hash.
497 ///
498 /// @return the hash value of the string representation of @p
499 /// artifact.
500 size_t
501 operator()(const type_or_decl_base_sptr& artifact) const
502 {return operator()(artifact.get());}
503}; // end struct type_or_decl_hash
504
505/// The comparison functor for using instances of @ref
506/// type_or_decl_base as values in a hash map or set.
508{
509
510 /// The function-call operator to compare the string representations
511 /// of two ABI artifacts.
512 ///
513 /// @param l the left hand side ABI artifact operand of the
514 /// comparison.
515 ///
516 /// @param r the right hand side ABI artifact operand of the
517 /// comparison.
518 ///
519 /// @return true iff the string representation of @p l equals the one
520 /// of @p r.
521 bool
523 {
524 string repr1 = get_pretty_representation(l);
525 string repr2 = get_pretty_representation(r);
526
527 return repr1 == repr2;
528 }
529
530 /// The function-call operator to compare the string representations
531 /// of two ABI artifacts.
532 ///
533 /// @param l the left hand side ABI artifact operand of the
534 /// comparison.
535 ///
536 /// @param r the right hand side ABI artifact operand of the
537 /// comparison.
538 ///
539 /// @return true iff the string representation of @p l equals the one
540 /// of @p r.
541 bool
543 const type_or_decl_base_sptr &r) const
544 {return operator()(l.get(), r.get());}
545}; // end type_or_decl_equal
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
577/// This is a type that aggregates maps of all the kinds of types that
578/// are supported by libabigail.
579///
580/// For instance, the type_maps contains a map of string to basic
581/// type, a map of string to class type, a map of string to union
582/// types, etc. The key of a map entry is the pretty representation
583/// of the type, and the value of the map entry is the type.
585{
586 struct priv;
587 std::unique_ptr<priv> priv_;
588
589public:
590
591 type_maps();
592
593 ~type_maps();
594
595 bool
596 empty() const;
597
599 basic_types() const;
600
602 basic_types();
603
605 class_types() const;
606
608 class_types();
609
611 union_types();
612
614 union_types() const;
615
617 enum_types();
618
620 enum_types() const;
621
624
626 typedef_types() const;
627
630
632 qualified_types() const;
633
636
638 pointer_types() const;
639
642
644 reference_types() const;
645
647 array_types();
648
650 array_types() const;
651
653 subrange_types() const;
654
657
660
662 function_types() const;
663
664 const vector<type_base_wptr>&
666}; // end class type_maps;
667
668/// This is the abstraction of the set of relevant artefacts (types,
669/// variable declarations, functions, templates, etc) bundled together
670/// into a translation unit.
672{
673 struct priv;
674 std::unique_ptr<priv> priv_;
675
676 // Forbidden
677 translation_unit() = delete;
678
679public:
680 /// Convenience typedef for a shared pointer on a @ref global_scope.
681 typedef shared_ptr<scope_decl> global_scope_sptr;
682
683 /// The language of the translation unit.
685 {
686 LANG_UNKNOWN = 0,
687 LANG_Cobol74,
688 LANG_Cobol85,
689 LANG_C89,
690 LANG_C99,
691 LANG_C11,
692 LANG_C,
693 LANG_C_plus_plus_03,
694 LANG_C_plus_plus_11,
695 LANG_C_plus_plus_14,
696 LANG_C_plus_plus,
697 LANG_ObjC,
698 LANG_ObjC_plus_plus,
699 LANG_Fortran77,
700 LANG_Fortran90,
701 LANG_Fortran95,
702 LANG_Ada83,
703 LANG_Ada95,
704 LANG_Pascal83,
705 LANG_Modula2,
706 LANG_Java,
707 LANG_PLI,
708 LANG_UPC,
709 LANG_D,
710 LANG_Python,
711 LANG_Go,
712 LANG_Rust,
713 LANG_Mips_Assembler
714 };
715
716public:
718 const std::string& path,
719 char address_size = 0);
720
721 virtual ~translation_unit();
722
723 const environment&
724 get_environment() const;
725
727 get_language() const;
728
729 void
731
732 const std::string&
733 get_path() const;
734
735 void
736 set_path(const string&);
737
738 const std::string&
740
741 void
742 set_compilation_dir_path(const std::string&);
743
744 const std::string&
745 get_absolute_path() const;
746
747 void
749
750 const corpus*
751 get_corpus() const;
752
753 corpus*
754 get_corpus();
755
756 const scope_decl_sptr&
757 get_global_scope() const;
758
761
762 const type_maps&
763 get_types() const;
764
765 type_maps&
766 get_types();
767
768 const vector<function_type_sptr>&
769 get_live_fn_types() const;
770
772 get_loc_mgr();
773
774 const location_manager&
775 get_loc_mgr() const;
776
777 bool
778 is_empty() const;
779
780 char
781 get_address_size() const;
782
783 void
784 set_address_size(char);
785
786 bool
787 is_constructed() const;
788
789 void
790 set_is_constructed(bool);
791
792 bool
793 operator==(const translation_unit&) const;
794
795 bool
796 operator!=(const translation_unit&) const;
797
798 void
800
801 virtual bool
803
804 friend function_type_sptr
805 lookup_function_type_in_translation_unit(const function_type& t,
806 const translation_unit& tu);
807
808 friend function_type_sptr
810 translation_unit& tu);
811
812 friend type_base_sptr
813 synthesize_type_from_translation_unit(const type_base_sptr& type,
814 translation_unit& tu);
815};//end class translation_unit
816
817/// A comparison functor to compare translation units based on their
818/// absolute paths.
820{
821 /// Compare two translations units based on their absolute paths.
822 ///
823 /// @param lhs the first translation unit to consider for the
824 /// comparison.
825 ///
826 /// @param rhs the second translatin unit to consider for the
827 /// comparison.
828 bool
830 const translation_unit_sptr& rhs) const
831 {return lhs->get_absolute_path() < rhs->get_absolute_path();}
832}; // end struct shared_translation_unit_comp
833
834/// Convenience typedef for an ordered set of @ref
835/// translation_unit_sptr.
836typedef std::set<translation_unit_sptr,
838
839string
841
844
845bool
847
848bool
850
851bool
853
854bool
856
857bool
859
860bool
862
863/// Access specifier for class members.
865{
866 no_access,
867 public_access,
868 protected_access,
869 private_access,
870};
871
872class elf_symbol;
873/// A convenience typedef for a shared pointer to elf_symbol.
874typedef shared_ptr<elf_symbol> elf_symbol_sptr;
875
876/// A convenience typedef for a weak pointer to elf_symbol.
877typedef weak_ptr<elf_symbol> elf_symbol_wptr;
878
879/// Convenience typedef for a map which key is a string and which
880/// value if the elf symbol of the same name.
881typedef std::unordered_map<string, elf_symbol_sptr>
883
884/// Convenience typedef for a shared pointer to an
885/// string_elf_symbol_sptr_map_type.
886typedef shared_ptr<string_elf_symbol_sptr_map_type>
888
889/// Convenience typedef for a vector of elf_symbol
890typedef std::vector<elf_symbol_sptr> elf_symbols;
891
892/// Convenience typedef for a map which key is a string and which
893/// value is a vector of elf_symbol.
894typedef std::unordered_map<string, elf_symbols>
896
897/// Convenience typedef for a shared pointer to
898/// string_elf_symbols_map_type.
899typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
900
901/// Abstraction of an elf symbol.
902///
903/// This is useful when a given corpus has been read from an ELF file.
904/// In that case, a given decl might be associated to its underlying
905/// ELF symbol, if that decl is publicly exported in the ELF file. In
906/// that case, comparing decls might involve comparing their
907/// underlying symbols as well.
909{
910public:
911 /// The type of a symbol.
912 enum type
913 {
914 NOTYPE_TYPE = 0,
915 OBJECT_TYPE,
916 FUNC_TYPE,
917 SECTION_TYPE,
918 FILE_TYPE,
919 COMMON_TYPE,
920 TLS_TYPE,
921 GNU_IFUNC_TYPE
922 };
923
924 /// The binding of a symbol.
926 {
927 LOCAL_BINDING = 0,
928 GLOBAL_BINDING,
929 WEAK_BINDING,
930 GNU_UNIQUE_BINDING
931 };
932
933 /// The visibility of the symbol.
935 {
936 DEFAULT_VISIBILITY,
937 PROTECTED_VISIBILITY,
938 HIDDEN_VISIBILITY,
939 INTERNAL_VISIBILITY,
940 };
941
942 /// Inject the elf_symbol::version here.
943 class version;
944
945private:
946 struct priv;
947 std::unique_ptr<priv> priv_;
948
949 elf_symbol();
950
951 elf_symbol(const environment& e,
952 size_t i,
953 size_t s,
954 const string& n,
955 type t,
956 binding b,
957 bool d,
958 bool c,
959 const version& ve,
960 visibility vi,
961 bool is_in_ksymtab = false,
962 const abg_compat::optional<uint32_t>& crc = {},
964 bool is_suppressed = false);
965
966 elf_symbol(const elf_symbol&);
967
968 elf_symbol&
969 operator=(const elf_symbol& s);
970
971public:
972
973 static elf_symbol_sptr
974 create(const environment& e,
975 size_t i,
976 size_t s,
977 const string& n,
978 type t,
979 binding b,
980 bool d,
981 bool c,
982 const version& ve,
983 visibility vi,
984 bool is_in_ksymtab = false,
985 const abg_compat::optional<uint32_t>& crc = {},
987 bool is_suppressed = false);
988
989 const environment&
990 get_environment() const;
991
992 size_t
993 get_index() const;
994
995 void
996 set_index(size_t);
997
998 const string&
999 get_name() const;
1000
1001 void
1002 set_name(const string& n);
1003
1004 type
1005 get_type() const;
1006
1007 void
1008 set_type(type t);
1009
1010 size_t
1011 get_size() const;
1012
1013 void
1014 set_size(size_t);
1015
1016 binding
1017 get_binding() const;
1018
1019 void
1021
1022 version&
1023 get_version() const;
1024
1025 void
1026 set_version(const version& v);
1027
1028 void
1030
1032 get_visibility() const;
1033
1034 bool
1035 is_defined() const;
1036
1037 void
1038 is_defined(bool d);
1039
1040 bool
1041 is_public() const;
1042
1043 bool
1044 is_function() const;
1045
1046 bool
1047 is_variable() const;
1048
1049 bool
1050 is_in_ksymtab() const;
1051
1052 void
1054
1056 get_crc() const;
1057
1058 void
1060
1062 get_namespace() const;
1063
1064 void
1066
1067 bool
1068 is_suppressed() const;
1069
1070 void
1072
1073 const elf_symbol_sptr
1074 get_main_symbol() const;
1075
1078
1079 bool
1080 is_main_symbol() const;
1081
1083 update_main_symbol(const std::string&);
1084
1086 get_next_alias() const;
1087
1088 bool
1089 has_aliases() const;
1090
1091 int
1092 get_number_of_aliases() const;
1093
1094 void
1095 add_alias(const elf_symbol_sptr&);
1096
1097 bool
1098 is_common_symbol() const;
1099
1100 bool
1102
1105
1106 void
1108
1109 const string&
1110 get_id_string() const;
1111
1113 get_alias_from_name(const string& name) const;
1114
1116 get_alias_which_equals(const elf_symbol& other) const;
1117
1119 get_alias_with_default_symbol_version() const;
1120
1121 string
1123 bool include_symbol_itself = true) const;
1124
1125 string
1126 get_aliases_id_string(bool include_symbol_itself = true) const;
1127
1128 static bool
1129 get_name_and_version_from_id(const string& id,
1130 string& name,
1131 string& ver);
1132
1133 bool
1134 operator==(const elf_symbol&) const;
1135
1136 bool
1137 does_alias(const elf_symbol&) const;
1138}; // end class elf_symbol.
1139
1140std::ostream&
1141operator<<(std::ostream& o, elf_symbol::type t);
1142
1143std::ostream&
1144operator<<(std::ostream& o, elf_symbol::binding t);
1145
1146std::ostream&
1147operator<<(std::ostream& o, elf_symbol::visibility t);
1148
1149bool
1151
1152bool
1154
1155bool
1157
1158bool
1160
1161bool
1163
1164bool
1165operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1166
1167bool
1168operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1169
1170bool
1171elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1172
1173void
1174compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1175 const string_elf_symbols_map_type& symtab,
1176 vector<elf_symbol_sptr>& alias_set);
1177
1178/// The abstraction of the version of an ELF symbol.
1180{
1181 struct priv;
1182 std::unique_ptr<priv> priv_;
1183
1184public:
1185 version();
1186
1187 version(const string& v,
1188 bool is_default);
1189
1190 version(const version& v);
1191
1192 ~version();
1193
1194 operator const string&() const;
1195
1196 const string&
1197 str() const;
1198
1199 void
1200 str(const string& s);
1201
1202 bool
1203 is_default() const;
1204
1205 void
1206 is_default(bool f);
1207
1208 bool
1209 is_empty() const;
1210
1211 bool
1212 operator==(const version& o) const;
1213
1214 bool
1215 operator!=(const version& o) const;
1216
1217 version&
1218 operator=(const version& o);
1219};// end class elf_symbol::version
1220
1221class context_rel;
1222/// A convenience typedef for shared pointers to @ref context_rel
1223typedef shared_ptr<context_rel> context_rel_sptr;
1224
1225/// The abstraction of the relationship between an entity and its
1226/// containing scope (its context). That relationship can carry
1227/// properties like access rights (if the parent is a class_decl),
1228/// etc.
1229///
1230/// But importantly, this relationship carries a pointer to the
1231/// actualy parent.
1233{
1234protected:
1235 scope_decl* scope_;
1236 enum access_specifier access_;
1237 bool is_static_;
1238
1239public:
1240 context_rel()
1241 : scope_(0),
1242 access_(no_access),
1243 is_static_(false)
1244 {}
1245
1247 : scope_(s),
1248 access_(no_access),
1249 is_static_(false)
1250 {}
1251
1254 bool f)
1255 : scope_(s),
1256 access_(a),
1257 is_static_(f)
1258 {}
1259
1260 scope_decl*
1261 get_scope() const
1262 {return scope_;}
1263
1265 get_access_specifier() const
1266 {return access_;}
1267
1268 void
1269 set_access_specifier(access_specifier a)
1270 {access_ = a;}
1271
1272 bool
1273 get_is_static() const
1274 {return is_static_;}
1275
1276 void
1277 set_is_static(bool s)
1278 {is_static_ = s;}
1279
1280 void
1281 set_scope(scope_decl* s)
1282 {scope_ = s;}
1283
1284 bool
1285 operator==(const context_rel& o)const
1286 {
1287 return (access_ == o.access_
1288 && is_static_ == o.is_static_);
1289 }
1290
1291 /// Inequality operator.
1292 ///
1293 /// @param o the other instance of @ref context_rel to compare the
1294 /// current instance against.
1295 ///
1296 /// @return true iff the current instance of @ref context_rel is
1297 /// different from @p o.
1298 bool
1299 operator!=(const context_rel& o) const
1300 {return !operator==(o);}
1301
1302 virtual ~context_rel();
1303};// end class context_rel
1304
1305/// A bitfield that gives callers of abigail::ir::equals() some
1306/// insight about how different two internal representation artifacts
1307/// are.
1309{
1310 NO_CHANGE_KIND = 0,
1311
1312 /// This means that a given IR artifact has a local type change.
1314
1315 /// This means that a given IR artifact has a local non-type change.
1316 /// That is a change that is carried by the artifact itself, not by
1317 /// its type.
1319
1320 /// Testing (anding) against this mask means that a given IR artifact has
1321 /// local differences, with respect to the other artifact it was compared
1322 /// against. A local change is a change that is carried by the artifact
1323 /// itself (or its type), rather than by one off its sub-types.
1325
1326 /// This means that a given IR artifact has changes in some of its
1327 /// sub-types, with respect to the other artifact it was compared
1328 /// against.
1330};// end enum change_kind
1331
1334
1337
1340
1343
1344bool
1346 const decl_base& r,
1347 change_kind* k);
1348
1349bool
1350equals(const decl_base&, const decl_base&, change_kind*);
1351
1352/// The base class of both types and declarations.
1354{
1355 struct priv;
1356 mutable std::unique_ptr<priv> priv_;
1357
1360
1361protected:
1362
1363 /// This is a bitmap type which instance is meant to contain the
1364 /// runtime type of a given ABI artifact. Bits of the identifiers
1365 /// of the type of a given artifact as well as the types it inherits
1366 /// from are to be set to 1.
1368 {
1369 ABSTRACT_TYPE_OR_DECL,
1370 ABSTRACT_DECL_BASE = 1,
1371 ABSTRACT_SCOPE_DECL = 1 << 1,
1372 GLOBAL_SCOPE_DECL = 1 << 2,
1373 NAMESPACE_DECL = 1 << 3,
1374 VAR_DECL = 1 << 4,
1375 FUNCTION_DECL = 1 << 5,
1376 FUNCTION_PARAMETER_DECL = 1 << 6,
1377 METHOD_DECL = 1 << 7,
1378 TEMPLATE_DECL = 1 << 8,
1379 ABSTRACT_TYPE_BASE = 1 << 9,
1380 ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1381 BASIC_TYPE = 1 << 11,
1382 QUALIFIED_TYPE = 1 << 12,
1383 POINTER_TYPE = 1 << 13,
1384 REFERENCE_TYPE = 1 << 14,
1385 ARRAY_TYPE = 1 << 15,
1386 ENUM_TYPE = 1 << 16,
1387 TYPEDEF_TYPE = 1 << 17,
1388 CLASS_TYPE = 1 << 18,
1389 UNION_TYPE = 1 << 19,
1390 FUNCTION_TYPE = 1 << 20,
1391 METHOD_TYPE = 1 << 21,
1392 }; // end enum type_or_decl_kind
1393
1395 kind() const;
1396
1397 void
1398 kind(enum type_or_decl_kind);
1399
1400 const void*
1401 runtime_type_instance() const;
1402
1403 void*
1405
1406 void
1407 runtime_type_instance(void*);
1408
1409 const void*
1411
1412 void*
1414
1415 bool hashing_started() const;
1416
1417 void hashing_started(bool) const;
1418
1420 operator=(const type_or_decl_base&);
1421
1422public:
1423
1425 enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1426
1427 virtual ~type_or_decl_base();
1428
1429 bool
1430 get_is_artificial() const;
1431
1432 void
1433 set_is_artificial(bool);
1434
1435 const environment&
1436 get_environment() const;
1437
1438 void
1440
1441 location&
1443
1444 bool
1446
1447 const corpus*
1448 get_corpus() const;
1449
1450 corpus*
1451 get_corpus();
1452
1453 void
1455
1456 const translation_unit*
1457 get_translation_unit() const;
1458
1461
1462 virtual bool
1464
1465 virtual string
1466 get_pretty_representation(bool internal = false,
1467 bool qualified_name = true) const = 0;
1468
1472
1476
1480
1484
1485 friend class_decl*
1487
1488 friend pointer_type_def*
1490
1491 friend type_base*
1492 is_type(const type_or_decl_base*);
1493
1494 friend decl_base*
1495 is_decl(const type_or_decl_base* d);
1496}; // end class type_or_decl_base
1497
1501
1505
1509
1513
1514bool
1516
1517bool
1519
1520bool
1522
1523/// The base type of all declarations.
1524class decl_base : public virtual type_or_decl_base
1525{
1526 // Forbidden
1527 decl_base();
1528
1529 struct priv;
1530
1531protected:
1532
1533 const interned_string&
1534 peek_qualified_name() const;
1535
1536 void
1538
1539 void
1540 set_qualified_name(const interned_string&) const;
1541
1542 const interned_string&
1544
1545 void
1547
1548public:
1549 // This is public because some internals of the library need to
1550 // update it. But it's opaque to client code anyway, so no big
1551 // deal. Also, it's not handled by a shared_ptr because accessing
1552 // the data members of the priv struct for this decl_base shows up
1553 // on performance profiles when dealing with big binaries with a lot
1554 // of types; dereferencing the shared_ptr involves locking of some
1555 // sort and that is slower than just dereferencing a pointer likere
1556 // here. There are other types for which the priv pointer is
1557 // managed using shared_ptr just fine, because those didn't show up
1558 // during our performance profiling.
1559 priv* priv_;
1560
1561 /// Facility to hash instances of decl_base.
1562 struct hash;
1563
1564 /// ELF visibility
1566 {
1567 VISIBILITY_NONE,
1568 VISIBILITY_DEFAULT,
1569 VISIBILITY_PROTECTED,
1570 VISIBILITY_HIDDEN,
1571 VISIBILITY_INTERNAL
1572 };
1573
1574 /// ELF binding
1576 {
1577 BINDING_NONE,
1578 BINDING_LOCAL,
1579 BINDING_GLOBAL,
1580 BINDING_WEAK
1581 };
1582
1583 virtual void
1585
1586protected:
1587 const context_rel*
1588 get_context_rel() const;
1589
1592
1593 void
1594 set_context_rel(context_rel *c);
1595 decl_base(const decl_base&);
1596
1597public:
1598 decl_base(const environment& e,
1599 const string& name,
1600 const location& locus,
1601 const string& mangled_name = "",
1602 visibility vis = VISIBILITY_DEFAULT);
1603
1604 decl_base(const environment& e,
1605 const interned_string& name,
1606 const location& locus,
1607 const interned_string& mangled_name = interned_string(),
1608 visibility vis = VISIBILITY_DEFAULT);
1609
1610 decl_base(const environment&, const location&);
1611
1612 virtual bool
1613 operator==(const decl_base&) const;
1614
1615 virtual bool
1616 operator!=(const decl_base&) const;
1617
1618 virtual bool
1620
1621 virtual ~decl_base();
1622
1623 virtual size_t
1624 get_hash() const;
1625
1626 virtual string
1627 get_pretty_representation(bool internal = false,
1628 bool qualified_name = true) const;
1629
1630 virtual void
1631 get_qualified_name(interned_string& qualified_name,
1632 bool internal = false) const;
1633
1634 virtual const interned_string&
1635 get_qualified_name(bool internal = false) const;
1636
1637 virtual const interned_string&
1638 get_scoped_name() const;
1639
1640 bool
1642
1643 void
1645
1646 const location&
1647 get_location() const;
1648
1649 void
1650 set_location(const location& l);
1651
1652 const interned_string&
1653 get_name() const;
1654
1655 const interned_string&
1657
1658 void
1659 set_name(const string& n);
1660
1661 bool
1662 get_is_anonymous() const;
1663
1664 void
1665 set_is_anonymous(bool);
1666
1667 bool
1669
1670 bool
1672
1674 get_naming_typedef() const;
1675
1676 void
1678
1679 const interned_string&
1680 get_linkage_name() const;
1681
1682 virtual void
1683 set_linkage_name(const string& m);
1684
1685 scope_decl*
1686 get_scope() const;
1687
1689 get_visibility() const;
1690
1691 void
1693
1694 const decl_base_sptr
1696
1697 void
1698 set_earlier_declaration(const decl_base_sptr&);
1699
1700 const decl_base_sptr
1702
1703 void
1704 set_definition_of_declaration(const decl_base_sptr&);
1705
1706 const decl_base*
1708
1709 bool
1711
1712 void
1714
1715 friend bool
1716 equals(const decl_base&, const decl_base&, change_kind*);
1717
1718 friend bool
1719 equals(const var_decl&, const var_decl&, change_kind*);
1720
1721 friend bool
1723
1724 friend bool
1726 const decl_base& r,
1727 change_kind* k);
1728
1729 friend decl_base_sptr
1730 add_decl_to_scope(decl_base_sptr decl, scope_decl* scpe);
1731
1732 friend void
1733 remove_decl_from_scope(decl_base_sptr);
1734
1735 friend decl_base_sptr
1736 insert_decl_into_scope(decl_base_sptr,
1737 vector<shared_ptr<decl_base> >::iterator,
1738 scope_decl*);
1739
1740 friend enum access_specifier
1742
1743 friend enum access_specifier
1744 get_member_access_specifier(const decl_base_sptr& d);
1745
1746 friend void
1749
1750 friend bool
1752
1753 friend bool
1754 get_member_is_static(const decl_base_sptr& d);
1755
1756 friend void
1757 set_member_is_static(const decl_base_sptr& d, bool s);
1758
1759 friend void
1760 set_member_is_static(decl_base& d, bool s);
1761
1762 friend bool
1764
1765 friend void
1767
1768 friend class class_or_union;
1769 friend class class_decl;
1770 friend class scope_decl;
1771};// end class decl_base
1772
1773bool
1774operator==(const decl_base_sptr&, const decl_base_sptr&);
1775
1776bool
1777operator!=(const decl_base_sptr&, const decl_base_sptr&);
1778
1779bool
1780operator==(const type_base_sptr&, const type_base_sptr&);
1781
1782bool
1783operator!=(const type_base_sptr&, const type_base_sptr&);
1784
1785std::ostream&
1786operator<<(std::ostream&, decl_base::visibility);
1787
1788std::ostream&
1789operator<<(std::ostream&, decl_base::binding);
1790
1791bool
1792equals(const scope_decl&, const scope_decl&, change_kind*);
1793
1794/// A declaration that introduces a scope.
1795class scope_decl : public virtual decl_base
1796{
1797 struct priv;
1798 std::unique_ptr<priv> priv_;
1799
1800public:
1801
1802 /// Convenience typedef for a vector of @ref decl_base_sptr.
1803 typedef std::vector<decl_base_sptr > declarations;
1804 /// Convenience typedef for a vector of @ref function_type_sptr.
1805 typedef std::vector<function_type_sptr > function_types;
1806 /// Convenience typedef for a vector of @ref scope_decl_sptr.
1807 typedef std::vector<scope_decl_sptr> scopes;
1808
1809 scope_decl();
1810
1811protected:
1812 virtual decl_base_sptr
1813 add_member_decl(const decl_base_sptr& member);
1814
1815 decl_base_sptr
1816 insert_member_decl(decl_base_sptr member, declarations::iterator before);
1817
1818 virtual void
1819 remove_member_decl(decl_base_sptr member);
1820
1821public:
1822 struct hash;
1823
1824 scope_decl(const environment& env,
1825 const string& name, const location& locus,
1826 visibility vis = VISIBILITY_DEFAULT);
1827
1828 scope_decl(const environment& env, location& l);
1829
1830 virtual size_t
1831 get_hash() const;
1832
1833 virtual bool
1834 operator==(const decl_base&) const;
1835
1837 get_canonical_types() const;
1838
1841
1844
1845 const declarations&
1846 get_member_decls() const;
1847
1850
1851 const declarations&
1853
1854 virtual size_t
1856
1857 virtual size_t
1859
1860 virtual size_t
1862
1863 scopes&
1865
1866 const scopes&
1867 get_member_scopes() const;
1868
1869 bool
1870 is_empty() const;
1871
1872 bool
1873 find_iterator_for_member(const decl_base*, declarations::iterator&);
1874
1875 bool
1876 find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1877
1878 void
1879 insert_member_type(type_base_sptr t,
1880 declarations::iterator before);
1881
1882 void
1883 add_member_type(type_base_sptr t);
1884
1885 type_base_sptr
1886 add_member_type(type_base_sptr t, access_specifier a);
1887
1888 void
1889 remove_member_type(type_base_sptr t);
1890
1892 get_member_types() const;
1893
1896
1897 type_base_sptr
1898 find_member_type(const string& name) const;
1899
1900 virtual bool
1902
1903 virtual ~scope_decl();
1904
1905 friend decl_base_sptr
1906 add_decl_to_scope(decl_base_sptr decl, scope_decl* scope);
1907
1908 friend decl_base_sptr
1909 insert_decl_into_scope(decl_base_sptr decl,
1910 scope_decl::declarations::iterator before,
1911 scope_decl* scope);
1912
1913 friend void
1914 remove_decl_from_scope(decl_base_sptr decl);
1915};//end class scope_decl
1916
1917bool
1919
1920bool
1922
1923/// Hasher for the @ref scope_decl type.
1925{
1926 size_t
1927 operator()(const scope_decl& d) const;
1928
1929 size_t
1930 operator()(const scope_decl* d) const;
1931};
1932
1933/// This abstracts the global scope of a given translation unit.
1934///
1935/// Only one instance of this class must be present in a given
1936/// translation_unit. That instance is implicitely created the first
1937/// time translatin_unit::get_global_scope is invoked.
1939{
1940 translation_unit* translation_unit_;
1941
1943
1944public:
1945
1946 friend class translation_unit;
1947
1949 get_translation_unit() const
1950 {return translation_unit_;}
1951
1952 virtual ~global_scope();
1953};
1954
1955bool
1956equals(const type_base&, const type_base&, change_kind*);
1957
1958/// An abstraction helper for type declarations
1959class type_base : public virtual type_or_decl_base
1960{
1961 struct priv;
1962
1963public:
1964 // This priv pointer is not handled by a shared_ptr because
1965 // accessing the data members of the priv struct for this type_base
1966 // shows up on performance profiles when dealing with big binaries
1967 // with a lot of types; dereferencing the shared_ptr involves
1968 // locking of some sort and that is slower than just dereferencing a
1969 // pointer likere here. There are other types for which the priv
1970 // pointer is managed using shared_ptr just fine, because those
1971 // didn't show up during our performance profiling.
1972 priv* priv_;
1973
1974private:
1975 // Forbid this.
1976 type_base();
1977
1978 static type_base_sptr
1979 get_canonical_type_for(type_base_sptr);
1980
1981protected:
1982 virtual void
1984
1985public:
1986
1987 /// A hasher for type_base types.
1988 struct hash;
1989
1990 /// A hasher for types. It gets the dynamic type of the current
1991 /// instance of type and hashes it accordingly. Note that the hashing
1992 /// function of this hasher must be updated each time a new kind of
1993 /// type is added to the IR.
1994 struct dynamic_hash;
1995
1996 /// A hasher for shared_ptr<type_base> that will hash it based on the
1997 /// runtime type of the type pointed to.
1998 struct shared_ptr_hash;
1999
2000 type_base(const environment& e, size_t s, size_t a);
2001
2002 friend type_base_sptr canonicalize(type_base_sptr);
2003
2004 type_base_sptr
2005 get_canonical_type() const;
2006
2007 type_base*
2009
2010 const interned_string&
2011 get_cached_pretty_representation(bool internal = false) const;
2012
2013 virtual bool
2014 operator==(const type_base&) const;
2015
2016 virtual bool
2017 operator!=(const type_base&) const;
2018
2019 virtual bool
2021
2022 virtual ~type_base();
2023
2024 virtual void
2025 set_size_in_bits(size_t);
2026
2027 virtual size_t
2028 get_size_in_bits() const;
2029
2030 virtual void
2031 set_alignment_in_bits(size_t);
2032
2033 virtual size_t
2034 get_alignment_in_bits() const;
2035};//end class type_base
2036
2037/// Hash functor for instances of @ref type_base.
2039{
2040 size_t
2041 operator()(const type_base& t) const;
2042
2043 size_t
2044 operator()(const type_base* t) const;
2045
2046 size_t
2047 operator()(const type_base_sptr t) const;
2048}; // end struct type_base::hash
2049
2050/// A predicate for deep equality of instances of
2051/// type_base*
2053{
2054 bool
2055 operator()(const type_base* l, const type_base* r) const
2056 {
2057 if (!!l != !!r)
2058 return false;
2059
2060 if (l == r)
2061 return true;
2062
2063 if (l)
2064 return *l == *r;
2065
2066 return true;
2067 }
2068};
2069
2070/// A predicate for deep equality of instances of
2071/// shared_ptr<type_base>
2073{
2074 bool
2075 operator()(const type_base_sptr l, const type_base_sptr r) const
2076 {
2077 if (!!l != !!r)
2078 return false;
2079
2080 if (l.get() == r.get())
2081 return true;
2082
2083 if (l)
2084 return *l == *r;
2085
2086 return true;
2087 }
2088};
2089
2090bool
2091equals(const type_decl&, const type_decl&, change_kind*);
2092
2093/// A basic type declaration that introduces no scope.
2094class type_decl : public virtual decl_base, public virtual type_base
2095{
2096 // Forbidden.
2097 type_decl();
2098
2099public:
2100
2101 /// Facility to hash instance of type_decl
2102 struct hash;
2103
2104 type_decl(const environment& env,
2105 const string& name,
2106 size_t size_in_bits,
2107 size_t alignment_in_bits,
2108 const location& locus,
2109 const string& mangled_name = "",
2110 visibility vis = VISIBILITY_DEFAULT);
2111
2112 virtual bool
2113 operator==(const type_base&) const;
2114
2115 virtual bool
2116 operator==(const decl_base&) const;
2117
2118 virtual bool
2119 operator==(const type_decl&) const;
2120
2121 virtual bool
2122 operator!=(const type_base&)const;
2123
2124 virtual bool
2125 operator!=(const decl_base&)const;
2126
2127 virtual bool
2128 operator!=(const type_decl&)const;
2129
2130 virtual void
2131 get_qualified_name(interned_string& qualified_name,
2132 bool internal = false) const;
2133
2134 virtual const interned_string&
2135 get_qualified_name(bool internal = false) const;
2136
2137 virtual string
2138 get_pretty_representation(bool internal = false,
2139 bool qualified_name = true) const;
2140
2141 virtual bool
2143
2144 virtual ~type_decl();
2145};// end class type_decl.
2146
2147bool
2149
2150bool
2152
2153bool
2155
2156/// A type that introduces a scope.
2157class scope_type_decl : public scope_decl, public virtual type_base
2158{
2160
2161public:
2162
2163 /// Hasher for instances of scope_type_decl
2164 struct hash;
2165
2166 scope_type_decl(const environment& env, const string& name,
2167 size_t size_in_bits, size_t alignment_in_bits,
2168 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2169
2170 virtual bool
2171 operator==(const decl_base&) const;
2172
2173 virtual bool
2174 operator==(const type_base&) const;
2175
2176 virtual bool
2178
2179 virtual ~scope_type_decl();
2180};
2181
2182/// The abstraction of a namespace declaration
2184{
2185public:
2186
2187 namespace_decl(const environment& env, const string& name,
2188 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2189
2190 virtual string
2191 get_pretty_representation(bool internal = false,
2192 bool qualified_name = true) const;
2193
2194 virtual bool
2195 operator==(const decl_base&) const;
2196
2197 virtual bool
2199
2200 virtual ~namespace_decl();
2201
2203};// end class namespace_decl
2204
2205/// A convenience typedef for vectors of @ref namespace_decl_sptr
2206typedef vector<namespace_decl_sptr> namespaces_type;
2207
2208bool
2210
2211/// The abstraction of a qualified type.
2212class qualified_type_def : public virtual type_base, public virtual decl_base
2213{
2214 class priv;
2215 std::unique_ptr<priv> priv_;
2216
2217 // Forbidden.
2219
2220protected:
2221 string build_name(bool, bool internal = false) const;
2222 virtual void on_canonical_type_set();
2223
2224public:
2225
2226 /// A Hasher for instances of qualified_type_def
2227 struct hash;
2228
2229 /// Bit field values representing the cv qualifiers of the
2230 /// underlying type.
2231 enum CV
2232 {
2233 CV_NONE = 0,
2234 CV_CONST = 1,
2235 CV_VOLATILE = 1 << 1,
2236 CV_RESTRICT = 1 << 2
2237 };
2238
2239 qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2240
2241 qualified_type_def(const environment& env, CV quals, const location& locus);
2242
2243 virtual size_t
2244 get_size_in_bits() const;
2245
2246 virtual bool
2247 operator==(const decl_base&) const;
2248
2249 virtual bool
2250 operator==(const type_base&) const;
2251
2252 virtual bool
2253 operator==(const qualified_type_def&) const;
2254
2255 CV
2256 get_cv_quals() const;
2257
2258 void
2259 set_cv_quals(CV cv_quals);
2260
2261 string
2263
2264 type_base_sptr
2265 get_underlying_type() const;
2266
2267 void
2268 set_underlying_type(const type_base_sptr&);
2269
2270 virtual void
2271 get_qualified_name(interned_string& qualified_name,
2272 bool internal = false) const;
2273
2274 virtual const interned_string&
2275 get_qualified_name(bool internal = false) const;
2276
2277 virtual bool
2279
2280 virtual ~qualified_type_def();
2281}; // end class qualified_type_def.
2282
2283bool
2284operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2285
2286bool
2287operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2288
2291
2294
2297
2300
2303
2304std::ostream&
2305operator<<(std::ostream&, qualified_type_def::CV);
2306
2307string
2309
2311get_name_of_qualified_type(const type_base_sptr& underlying_type,
2313 bool qualified = true, bool internal = false);
2314
2315qualified_type_def_sptr
2316lookup_qualified_type(const type_base_sptr&,
2318 const translation_unit&);
2319bool
2321
2322/// The abstraction of a pointer type.
2323class pointer_type_def : public virtual type_base, public virtual decl_base
2324{
2325 struct priv;
2326 std::unique_ptr<priv> priv_;
2327
2328 // Forbidden.
2330
2331protected:
2332 virtual void on_canonical_type_set();
2333
2334public:
2335
2336 /// A hasher for instances of pointer_type_def
2337 struct hash;
2338
2339 pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2340 size_t alignment_in_bits, const location& locus);
2341
2342 pointer_type_def(const environment& env, size_t size_in_bits,
2343 size_t alignment_in_bits, const location& locus);
2344
2345 void
2346 set_pointed_to_type(const type_base_sptr&);
2347
2348 virtual bool
2349 operator==(const decl_base&) const;
2350
2351 virtual bool
2352 operator==(const type_base&) const;
2353
2354 bool
2355 operator==(const pointer_type_def&) const;
2356
2357 const type_base_sptr
2358 get_pointed_to_type() const;
2359
2360 type_base*
2362
2363 virtual void
2364 get_qualified_name(interned_string&, bool internal = false) const;
2365
2366 virtual const interned_string&
2367 get_qualified_name(bool internal = false) const;
2368
2369 virtual bool
2371
2372 virtual ~pointer_type_def();
2373}; // end class pointer_type_def
2374
2375bool
2377
2378bool
2380
2381bool
2383
2384
2385/// Abstracts a reference type.
2386class reference_type_def : public virtual type_base, public virtual decl_base
2387{
2388 type_base_wptr pointed_to_type_;
2389 bool is_lvalue_;
2390
2391 // Forbidden.
2393
2394protected:
2395 virtual void on_canonical_type_set();
2396
2397public:
2398
2399 /// Hasher for intances of reference_type_def.
2400 struct hash;
2401
2402 reference_type_def(const type_base_sptr pointed_to_type,
2403 bool lvalue, size_t size_in_bits,
2404 size_t alignment_in_bits, const location& locus);
2405
2406 reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2407 size_t alignment_in_bits, const location& locus);
2408
2409 void
2410 set_pointed_to_type(type_base_sptr& pointed_to_type);
2411
2412 virtual bool
2413 operator==(const decl_base&) const;
2414
2415 virtual bool
2416 operator==(const type_base&) const;
2417
2418 bool
2419 operator==(const reference_type_def&) const;
2420
2421 type_base_sptr
2422 get_pointed_to_type() const;
2423
2424 bool
2425 is_lvalue() const;
2426
2427 virtual void
2428 get_qualified_name(interned_string& qualified_name,
2429 bool internal = false) const;
2430
2431 virtual const interned_string&
2432 get_qualified_name(bool internal = false) const;
2433
2434 virtual string
2435 get_pretty_representation(bool internal = false,
2436 bool qualified_name = true) const;
2437
2438 virtual bool
2440
2441 virtual ~reference_type_def();
2442}; // end class reference_type_def
2443
2444bool
2446
2447bool
2449
2450bool
2452
2453/// The abstraction of an array type.
2454class array_type_def : public virtual type_base, public virtual decl_base
2455{
2456 struct priv;
2457 std::unique_ptr<priv> priv_;
2458
2459 // Forbidden.
2461
2462 void update_size();
2463
2464public:
2465
2466 /// Hasher for intances of array_type_def.
2467 struct hash;
2468
2469 class subrange_type;
2470
2471 /// Convenience typedef for a shared pointer on a @ref
2472 /// function_decl::subrange
2473 typedef shared_ptr<subrange_type> subrange_sptr;
2474
2475 /// Convenience typedef for a vector of @ref subrange_sptr
2476 typedef std::vector<subrange_sptr> subranges_type;
2477
2478 /// Abstraction for an array range type, like in Ada, or just for an
2479 /// array dimension like in C or C++.
2480 class subrange_type : public virtual type_base, public virtual decl_base
2481 {
2482 struct priv;
2483 std::unique_ptr<priv> priv_;
2484
2485 // Forbidden.
2486 subrange_type();
2487 public:
2488
2489 virtual ~subrange_type();
2490 /// This class is to hold the value of the bound of a subrange.
2491 /// The value can be either signed or unsigned, at least when it
2492 /// comes from DWARF. The class keeps the sign information, but
2493 /// allows users to access the value as signed or unsigned as they
2494 /// see fit.
2496 {
2497 public:
2498 enum signedness
2499 {
2500 UNSIGNED_SIGNEDNESS,
2501 SIGNED_SIGNEDNESS
2502 };
2503
2504 private:
2505 signedness s_;
2506
2507 public:
2508 union
2509 {
2510 uint64_t unsigned_;
2511 int64_t signed_;
2512 } v_;
2513 bound_value();
2514 bound_value(uint64_t);
2515 bound_value(int64_t);
2516 enum signedness get_signedness() const;
2517 void set_signedness(enum signedness s);
2518 int64_t get_signed_value() const;
2519 uint64_t get_unsigned_value();
2520 void set_unsigned(uint64_t v);
2521 void set_signed(int64_t v);
2522 bool operator==(const bound_value&) const;
2523 }; //end class bound_value
2524
2525 /// Hasher for an instance of array::subrange
2526 struct hash;
2527
2528 subrange_type(const environment& env,
2529 const string& name,
2530 bound_value lower_bound,
2531 bound_value upper_bound,
2532 const type_base_sptr& underlying_type,
2533 const location& loc,
2534 translation_unit::language l = translation_unit::LANG_C11);
2535
2536 subrange_type(const environment& env,
2537 const string& name,
2538 bound_value lower_bound,
2539 bound_value upper_bound,
2540 const location& loc,
2541 translation_unit::language l = translation_unit::LANG_C11);
2542
2543 subrange_type(const environment& env,
2544 const string& name,
2545 bound_value upper_bound,
2546 const location& loc,
2547 translation_unit::language l = translation_unit::LANG_C11);
2548
2549 type_base_sptr
2550 get_underlying_type() const;
2551
2552 void
2553 set_underlying_type(const type_base_sptr &);
2554
2555 int64_t
2556 get_upper_bound() const;
2557
2558 int64_t
2559 get_lower_bound() const;
2560
2561 void
2562 set_upper_bound(int64_t ub);
2563
2564 void
2565 set_lower_bound(int64_t lb);
2566
2567 uint64_t
2568 get_length() const;
2569
2570 bool
2571 is_infinite() const;
2572
2573 void
2574 is_infinite(bool);
2575
2577 get_language() const;
2578
2579 virtual bool
2580 operator==(const decl_base&) const;
2581
2582 virtual bool
2583 operator==(const type_base&) const;
2584
2585 bool
2586 operator==(const subrange_type& o) const;
2587
2588 bool
2589 operator!=(const decl_base& o) const;
2590
2591 bool
2592 operator!=(const type_base& o) const;
2593
2594 bool
2595 operator!=(const subrange_type& o) const;
2596
2597 string
2598 as_string() const;
2599
2600 static string
2601 vector_as_string(const vector<subrange_sptr>&);
2602
2603 virtual string
2604 get_pretty_representation(bool internal = false,
2605 bool qualified_name = true) const;
2606
2607 virtual bool
2609 }; // end class subrange_type
2610
2611 array_type_def(const type_base_sptr type,
2612 const std::vector<subrange_sptr>& subs,
2613 const location& locus);
2614
2615 array_type_def(const environment& env,
2616 const std::vector<subrange_sptr>& subs,
2617 const location& locus);
2618
2620 get_language() const;
2621
2622 virtual bool
2623 operator==(const decl_base&) const;
2624
2625 virtual bool
2626 operator==(const type_base&) const;
2627
2628 virtual void
2629 get_qualified_name(interned_string& qualified_name,
2630 bool internal = false) const;
2631
2632 virtual const interned_string&
2633 get_qualified_name(bool internal = false) const;
2634
2635 const type_base_sptr
2636 get_element_type() const;
2637
2638 void
2639 set_element_type(const type_base_sptr& element_type);
2640
2641 virtual void
2642 append_subranges(const std::vector<subrange_sptr>& subs);
2643
2644 virtual int
2645 get_dimension_count() const;
2646
2647 virtual bool
2648 is_infinite() const;
2649
2650 virtual string
2651 get_pretty_representation(bool internal = false,
2652 bool qualified_name = true) const;
2653
2654 virtual string
2655 get_subrange_representation() const;
2656
2657 virtual bool
2659
2660 const location&
2661 get_location() const;
2662
2663 const std::vector<subrange_sptr>&
2664 get_subranges() const;
2665
2666 virtual ~array_type_def();
2667
2668}; // end class array_type_def
2669
2672
2675
2676bool
2679 change_kind*);
2680
2681bool
2683
2684/// Abstracts a declaration for an enum type.
2685class enum_type_decl : public virtual type_base, public virtual decl_base
2686{
2687 class priv;
2688 std::unique_ptr<priv> priv_;
2689
2690 // Forbidden
2692
2693public:
2694
2695 /// A hasher for an enum_type_decl.
2696 struct hash;
2697
2698 /// Enumerator Datum.
2699 class enumerator;
2700
2701 /// Convenience typedef for a list of @ref enumerator.
2702 typedef std::vector<enumerator> enumerators;
2703
2704 /// Constructor of an enum type declaration.
2705 ///
2706 /// @param name the name of the enum
2707 ///
2708 /// @param locus the locus at which the enum appears in the source
2709 /// code.
2710 ///
2711 /// @param underlying_type the underlying type of the enum
2712 ///
2713 /// @param enms a list of enumerators for this enum.
2714 ///
2715 /// @param mangled_name the mangled name of the enum type.
2716 ///
2717 /// @param vis the visibility of instances of this type.
2718 enum_type_decl(const string& name,
2719 const location& locus,
2720 type_base_sptr underlying_type,
2721 enumerators& enms,
2722 const string& mangled_name = "",
2723 visibility vis = VISIBILITY_DEFAULT);
2724
2725 type_base_sptr
2726 get_underlying_type() const;
2727
2728 const enumerators&
2729 get_enumerators() const;
2730
2733
2734 virtual string
2735 get_pretty_representation(bool internal = false,
2736 bool qualified_name = true) const;
2737
2738 virtual bool
2739 operator==(const decl_base&) const;
2740
2741 virtual bool
2742 operator==(const type_base&) const;
2743
2744 virtual bool
2746
2747 virtual ~enum_type_decl();
2748
2749 friend bool
2751 const enum_type_decl& r,
2752 change_kind* k);
2753}; // end class enum_type_decl
2754
2755bool
2757
2758bool
2760
2761bool
2763 const enum_type_decl& r,
2764 change_kind* k);
2765
2766/// The abstraction of an enumerator
2768{
2769 class priv;
2770 std::unique_ptr<priv> priv_;
2771
2772public:
2773
2774 enumerator();
2775
2776 ~enumerator();
2777
2778 enumerator(const string& name, int64_t value);
2779
2780 enumerator(const enumerator&);
2781
2782 enumerator&
2783 operator=(const enumerator&);
2784
2785 bool
2786 operator==(const enumerator& other) const;
2787
2788 bool
2789 operator!=(const enumerator& other) const;
2790
2791 const string&
2792 get_name() const;
2793
2794 const string&
2795 get_qualified_name(bool internal = false) const;
2796
2797 void
2798 set_name(const string& n);
2799
2800 int64_t
2801 get_value() const;
2802
2803 void
2804 set_value(int64_t v);
2805
2807 get_enum_type() const;
2808
2809 void
2811}; // end class enum_type_def::enumerator
2812
2813bool
2815
2816/// The abstraction of a typedef declaration.
2817class typedef_decl : public virtual type_base, public virtual decl_base
2818{
2819 struct priv;
2820 std::unique_ptr<priv> priv_;
2821
2822 // Forbidden
2823 typedef_decl();
2824
2825public:
2826
2827 /// Hasher for the typedef_decl type.
2828 struct hash;
2829
2830 typedef_decl(const string& name,
2831 const type_base_sptr underlying_type,
2832 const location& locus,
2833 const string& mangled_name = "",
2834 visibility vis = VISIBILITY_DEFAULT);
2835
2836 typedef_decl(const string& name,
2837 const environment& env,
2838 const location& locus,
2839 const string& mangled_name = "",
2840 visibility vis = VISIBILITY_DEFAULT);
2841
2842 virtual size_t
2843 get_size_in_bits() const;
2844
2845 virtual size_t
2846 get_alignment_in_bits() const;
2847
2848 virtual bool
2849 operator==(const decl_base&) const;
2850
2851 virtual bool
2852 operator==(const type_base&) const;
2853
2854 virtual string
2855 get_pretty_representation(bool internal = false,
2856 bool qualified_name = true) const;
2857
2858 type_base_sptr
2859 get_underlying_type() const;
2860
2861 void
2862 set_underlying_type(const type_base_sptr&);
2863
2864 virtual bool
2866
2867 virtual ~typedef_decl();
2868};// end class typedef_decl
2869
2870/// The abstraction for a data member context relationship. This
2871/// relates a data member to its parent class.
2872///
2873/// The relationship carries properties like the offset of the data
2874/// member, if applicable.
2876{
2877protected:
2878 struct priv;
2879 std::unique_ptr<priv> priv_;
2880
2881public:
2883
2885 bool is_laid_out,
2886 size_t offset_in_bits,
2888 bool is_static);
2889
2891
2892 bool
2893 get_is_laid_out() const;
2894
2895 void
2896 set_is_laid_out(bool f);
2897
2898 size_t
2899 get_offset_in_bits() const;
2900
2901 void
2902 set_offset_in_bits(size_t o);
2903
2904 const var_decl*
2906
2907 void
2909
2910 bool
2911 operator==(const dm_context_rel& o) const;
2912
2913 bool
2914 operator!=(const dm_context_rel& o) const;
2915
2916 virtual ~dm_context_rel();
2917};// end class class_decl::dm_context_rel
2918
2919bool
2920equals(const var_decl&, const var_decl&, change_kind*);
2921
2922bool
2924
2925bool
2927
2928/// Abstracts a variable declaration.
2929class var_decl : public virtual decl_base
2930{
2931 struct priv;
2932 std::unique_ptr<priv> priv_;
2933
2934 // Forbidden
2935 var_decl();
2936
2937 virtual void
2938 set_scope(scope_decl*);
2939
2940public:
2941
2942 /// Hasher for a var_decl type.
2943 struct hash;
2944
2945 /// Equality functor to compare pointers to variable_decl.
2946 struct ptr_equal;
2947
2948 var_decl(const string& name,
2949 type_base_sptr type,
2950 const location& locus,
2951 const string& mangled_name,
2952 visibility vis = VISIBILITY_DEFAULT,
2953 binding bind = BINDING_NONE);
2954
2955 virtual bool
2956 operator==(const decl_base&) const;
2957
2958 const type_base_sptr
2959 get_type() const;
2960
2961 void
2962 set_type(type_base_sptr&);
2963
2964 const type_base*
2965 get_naked_type() const;
2966
2967 binding
2968 get_binding() const;
2969
2970 void
2972
2973 void
2974 set_symbol(const elf_symbol_sptr& sym);
2975
2976 const elf_symbol_sptr&
2977 get_symbol() const;
2978
2980 clone() const;
2981
2983 get_id() const;
2984
2985 virtual const interned_string&
2986 get_qualified_name(bool internal = false) const;
2987
2988 virtual size_t
2989 get_hash() const;
2990
2991 virtual string
2992 get_pretty_representation(bool internal = false,
2993 bool qualified_name = true) const;
2994
2995 string
2996 get_anon_dm_reliable_name(bool qualified = true) const;
2997
2998 virtual bool
3000
3001 virtual ~var_decl();
3002
3003 friend void
3005
3006 friend uint64_t
3008
3009 friend uint64_t
3011
3012 friend uint64_t
3014
3015 friend uint64_t
3017
3018 friend void
3020
3021 friend bool
3023
3024 friend bool
3026}; // end class var_decl
3027
3028bool
3030
3031/// Abstraction for a function declaration.
3032class function_decl : public virtual decl_base
3033{
3034 struct priv;
3035 // This priv pointer is not handled by a shared_ptr because
3036 // accessing the data members of the priv struct for this
3037 // function_decl shows up on performance profiles when dealing with
3038 // big binaries with a lot of types; dereferencing the shared_ptr
3039 // involves locking of some sort and that is slower than just
3040 // dereferencing a pointer likere here. There are other types for
3041 // which the priv pointer is managed using shared_ptr just fine,
3042 // because those didn't show up during our performance profiling.
3043 priv* priv_;
3044
3045public:
3046 /// Hasher for function_decl
3047 struct hash;
3048
3049 /// Equality functor to compare pointers to function_decl
3050 struct ptr_equal;
3051
3052 /// Abstraction for the parameter of a function.
3053 class parameter;
3054
3055 /// Convenience typedef for a shared pointer on a @ref
3056 /// function_decl::parameter
3057 typedef shared_ptr<parameter> parameter_sptr;
3058
3059 /// Convenience typedef for a vector of @ref parameter_sptr
3060 typedef std::vector<parameter_sptr> parameters;
3061
3062 function_decl(const string& name,
3064 bool declared_inline,
3065 const location& locus,
3066 const string& mangled_name,
3067 visibility vis,
3068 binding bind);
3069
3070 function_decl(const string& name,
3071 type_base_sptr fn_type,
3072 bool declared_inline,
3073 const location& locus,
3074 const string& mangled_name = "",
3075 visibility vis = VISIBILITY_DEFAULT,
3076 binding bind = BINDING_GLOBAL);
3077
3078 virtual string
3079 get_pretty_representation(bool internal = false,
3080 bool qualified_name = true) const;
3081
3082 string
3083 get_pretty_representation_of_declarator (bool internal = false) const;
3084
3085 const std::vector<parameter_sptr >&
3086 get_parameters() const;
3087
3088 void
3090
3091 void
3092 append_parameters(std::vector<parameter_sptr >& parms);
3093
3094 parameters::const_iterator
3096
3097 const function_type_sptr
3098 get_type() const;
3099
3100 const function_type*
3101 get_naked_type() const;
3102
3103 const type_base_sptr
3104 get_return_type() const;
3105
3106 void
3107 set_type(const function_type_sptr& fn_type);
3108
3109 void
3110 set_symbol(const elf_symbol_sptr& sym);
3111
3112 const elf_symbol_sptr&
3113 get_symbol() const;
3114
3115 bool
3116 is_declared_inline() const;
3117
3118 binding
3119 get_binding() const;
3120
3122 clone() const;
3123
3124 virtual bool
3125 operator==(const decl_base& o) const;
3126
3127 /// Return true iff the function takes a variable number of
3128 /// parameters.
3129 ///
3130 /// @return true if the function taks a variable number
3131 /// of parameters.
3132 bool
3133 is_variadic() const;
3134
3135 virtual size_t
3136 get_hash() const;
3137
3139 get_id() const;
3140
3141 virtual bool
3143
3144 virtual ~function_decl();
3145}; // end class function_decl
3146
3147bool
3149
3150bool
3152
3153bool
3155
3156bool
3159 change_kind*);
3160
3161/// A comparison functor to compare pointer to instances of @ref
3162/// type_or_decl_base.
3164{
3165 /// Comparison operator for ABI artifacts.
3166 ///
3167 /// @param f the first ABI artifact to consider for the comparison.
3168 ///
3169 /// @param s the second ABI artifact to consider for the comparison.
3170 ///
3171 /// @return true iff @p f is lexicographically less than than @p s.
3172 bool
3174 const type_or_decl_base *s)
3175 {
3176 function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3177 if (f_fn && s_fn)
3178 return function_decl_is_less_than(*f_fn, *s_fn);
3179
3180 var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3181 if (f_var && s_var)
3182 return get_name(f_var) < get_name(s_var);
3183
3184 string l_repr = get_pretty_representation(f),
3185 r_repr = get_pretty_representation(s);
3186
3187 return l_repr < r_repr;
3188 }
3189
3190 /// Comparison operator for ABI artifacts.
3191 ///
3192 /// @param f the first ABI artifact to consider for the comparison.
3193 ///
3194 /// @param s the second ABI artifact to consider for the comparison.
3195 ///
3196 /// @return true iff @p f is lexicographically less than than @p s.
3197 bool
3199 const type_or_decl_base_sptr& s)
3200 {return operator()(f.get(), s.get());}
3201}; // end struct type_or_decl_base_comp
3202
3203/// Abstraction of a function parameter.
3205{
3206 struct priv;
3207 std::unique_ptr<priv> priv_;
3208
3209public:
3210
3211 /// Hasher for an instance of function::parameter
3212 struct hash;
3213
3214 parameter(const type_base_sptr type,
3215 unsigned index,
3216 const string& name,
3217 const location& loc,
3218 bool variadic_marker = false);
3219
3220 parameter(const type_base_sptr type,
3221 unsigned index,
3222 const string& name,
3223 const location& loc,
3224 bool variadic_marker,
3225 bool is_artificial);
3226
3227 parameter(const type_base_sptr type,
3228 const string& name,
3229 const location& loc,
3230 bool variadic_marker = false,
3231 bool is_artificial = false);
3232
3233 parameter(const type_base_sptr type,
3234 unsigned index = 0,
3235 bool variadic_marker = false);
3236
3237 virtual ~parameter();
3238
3239 const type_base_sptr
3240 get_type()const;
3241
3243 get_type_name() const;
3244
3245 const string
3247
3249 get_name_id() const;
3250
3251 unsigned
3252 get_index() const;
3253
3254 void
3255 set_index(unsigned i);
3256
3257 bool
3258 get_variadic_marker() const;
3259
3260 bool
3261 operator==(const parameter& o) const;
3262
3263 virtual bool
3264 operator==(const decl_base&) const;
3265
3266 virtual bool
3268
3269 virtual size_t
3270 get_hash() const;
3271
3272 virtual void
3273 get_qualified_name(interned_string& qualified_name,
3274 bool internal = false) const;
3275
3276 virtual string
3277 get_pretty_representation(bool internal = false,
3278 bool qualified_name = true) const;
3279}; // end class function_decl::parameter
3280
3281bool
3284
3285/// A hashing functor for a function_decl::parameter.
3287{
3288 size_t
3289 operator()(const function_decl::parameter&) const;
3290
3291 size_t
3292 operator()(const function_decl::parameter*) const;
3293
3294 size_t
3295 operator()(const function_decl::parameter_sptr) const;
3296}; // end struct function_decl::parameter::hash
3297
3300
3303
3304bool
3306
3307/// Abstraction of a function type.
3308class function_type : public virtual type_base
3309{
3310protected:
3311 virtual void on_canonical_type_set();
3312
3313public:
3314 /// Hasher for an instance of function_type
3315 struct hash;
3316
3317 /// Convenience typedef for a shared pointer on a @ref
3318 /// function_decl::parameter
3319 typedef shared_ptr<function_decl::parameter> parameter_sptr;
3320 /// Convenience typedef for a vector of @ref parameter_sptr
3321 typedef std::vector<parameter_sptr> parameters;
3322
3323 struct priv;
3324 std::unique_ptr<priv> priv_;
3325
3326private:
3327 function_type();
3328
3329public:
3330
3331 function_type(type_base_sptr return_type,
3332 const parameters& parms,
3333 size_t size_in_bits,
3334 size_t alignment_in_bits);
3335
3336 function_type(type_base_sptr return_type,
3337 size_t size_in_bits,
3338 size_t alignment_in_bits);
3339
3340 function_type(const environment& env,
3341 size_t size_in_bits,
3342 size_t alignment_in_bits);
3343
3344 type_base_sptr
3345 get_return_type() const;
3346
3347 void
3348 set_return_type(type_base_sptr t);
3349
3350 const parameters&
3351 get_parameters() const;
3352
3353 const parameter_sptr
3355
3356 void
3357 set_parameters(const parameters &p);
3358
3359 void
3361
3362 bool
3363 is_variadic() const;
3364
3365 parameters::const_iterator
3367
3368 parameters::const_iterator
3369 get_first_parm() const;
3370
3371 const interned_string&
3372 get_cached_name(bool internal = false) const;
3373
3374 virtual bool
3375 operator==(const type_base&) const;
3376
3377 virtual string
3378 get_pretty_representation(bool internal = false,
3379 bool qualified_name = true) const;
3380
3381 virtual bool
3383
3384 virtual ~function_type();
3385
3386 friend bool
3388};//end class function_type
3389
3390/// The hashing functor for @ref function_type.
3392{
3393 size_t
3394 operator()(const function_type& t) const;
3395
3396 size_t
3397 operator()(const function_type* t) const;
3398
3399 size_t
3400 operator()(const function_type_sptr t) const;
3401};// end struct function_type::hash
3402
3403/// Abstracts the type of a class member function.
3405{
3406 struct priv;
3407 std::unique_ptr<priv> priv_;
3408
3409 method_type();
3410
3411public:
3412
3413 /// Hasher for intances of method_type
3414 struct hash;
3415
3416 method_type(type_base_sptr return_type,
3417 class_or_union_sptr class_type,
3418 const std::vector<function_decl::parameter_sptr>& parms,
3419 bool is_const,
3420 size_t size_in_bits,
3421 size_t alignment_in_bits);
3422
3423 method_type(type_base_sptr return_type,
3424 type_base_sptr class_type,
3425 const std::vector<function_decl::parameter_sptr>& parms,
3426 bool is_const,
3427 size_t size_in_bits,
3428 size_t alignment_in_bits);
3429
3430 method_type(class_or_union_sptr class_type,
3431 bool is_const,
3432 size_t size_in_bits,
3433 size_t alignment_in_bits);
3434
3435 method_type(const environment& env,
3436 size_t size_in_bits,
3437 size_t alignment_in_bits);
3438
3439 class_or_union_sptr
3440 get_class_type() const;
3441
3442 void
3443 set_class_type(const class_or_union_sptr& t);
3444
3445 void set_is_const(bool);
3446
3447 bool get_is_const() const;
3448
3449 virtual ~method_type();
3450
3451 virtual string
3452 get_pretty_representation(bool internal = false,
3453 bool qualified_name = true) const;
3454
3455 friend interned_string
3456 get_method_type_name(const method_type& fn_type, bool internal);
3457};// end class method_type.
3458
3459/// The base class of templates.
3460class template_decl : public virtual decl_base
3461{
3462 class priv;
3463 std::unique_ptr<priv> priv_;
3464
3465 template_decl();
3466
3467public:
3468
3469 /// Hasher.
3470 struct hash;
3471
3472 template_decl(const environment& env,
3473 const string& name,
3474 const location& locus,
3475 visibility vis = VISIBILITY_DEFAULT);
3476
3477 void
3479
3480 const std::list<template_parameter_sptr>&
3482
3483 virtual bool
3484 operator==(const decl_base& o) const;
3485
3486 virtual bool
3487 operator==(const template_decl& o) const;
3488
3489 virtual ~template_decl();
3490};//end class template_decl
3491
3492/// Base class for a template parameter. Client code should use the
3493/// more specialized type_template_parameter,
3494/// non_type_template_parameter and template_template_parameter below.
3496{
3497 class priv;
3498 std::unique_ptr<priv> priv_;
3499
3500 // Forbidden
3502
3503 public:
3504
3505 /// Hashers.
3506 struct hash;
3507 struct dynamic_hash;
3508 struct shared_ptr_hash;
3509
3510 template_parameter(unsigned index,
3511 template_decl_sptr enclosing_tdecl);
3512
3513 virtual bool
3514 operator==(const template_parameter&) const;
3515
3516 bool
3517 operator!=(const template_parameter&) const;
3518
3519 unsigned
3520 get_index() const;
3521
3522 const template_decl_sptr
3523 get_enclosing_template_decl() const;
3524
3525 bool
3526 get_hashing_has_started() const;
3527
3528 void
3529 set_hashing_has_started(bool f) const;
3530
3531 virtual ~template_parameter();
3532};//end class template_parameter
3533
3535{
3536 size_t
3537 operator()(const template_decl& t) const;
3538};// end struct template_decl::hash
3539
3540/// Abstracts a type template parameter.
3541class type_tparameter : public template_parameter, public virtual type_decl
3542{
3543 class priv;
3544 std::unique_ptr<priv> priv_;
3545
3546 // Forbidden
3548
3549public:
3550
3551 /// Hasher.
3552 struct hash;
3553
3554 type_tparameter(unsigned index,
3555 template_decl_sptr enclosing_tdecl,
3556 const string& name,
3557 const location& locus);
3558
3559 virtual bool
3560 operator==(const type_base&) const;
3561
3562 virtual bool
3563 operator==(const type_decl&) const;
3564
3565 virtual bool
3566 operator==(const decl_base&) const;
3567
3568 virtual bool
3569 operator==(const template_parameter&) const;
3570
3571 virtual bool
3572 operator==(const type_tparameter&) const;
3573
3574 virtual ~type_tparameter();
3575};// end class type_tparameter.
3576
3577/// Abstracts non type template parameters.
3579{
3580 class priv;
3581 std::unique_ptr<priv> priv_;
3582
3583 type_base_wptr type_;
3584
3585 // Forbidden
3587
3588public:
3589 /// Hasher.
3590 struct hash;
3591
3592 non_type_tparameter(unsigned index,
3593 template_decl_sptr enclosing_tdecl,
3594 const string& name,
3595 type_base_sptr type,
3596 const location& locus);
3597 virtual size_t
3598 get_hash() const;
3599
3600 virtual bool
3601 operator==(const decl_base&) const;
3602
3603 virtual bool
3604 operator==(const template_parameter&) const;
3605
3606 const type_base_sptr
3607 get_type() const;
3608
3609 virtual ~non_type_tparameter();
3610};// end class non_type_tparameter
3611
3612/// Hasher for the @ref non_type_tparameter type.
3614{
3615 size_t
3616 operator()(const non_type_tparameter& t) const;
3617
3618 size_t
3619 operator()(const non_type_tparameter* t) const;
3620};
3621
3623
3624/// Abstracts a template template parameter.
3626{
3627 class priv;
3628 std::unique_ptr<priv> priv_;
3629
3630 // Forbidden
3632
3633public:
3634
3635 /// A hasher for instances of template_tparameter
3636 struct hash;
3637
3638 template_tparameter(unsigned index,
3639 template_decl_sptr enclosing_tdecl,
3640 const string& name,
3641 const location& locus);
3642
3643 virtual bool
3644 operator==(const type_base&) const;
3645
3646 virtual bool
3647 operator==(const decl_base&) const;
3648
3649 virtual bool
3650 operator==(const template_parameter&) const;
3651
3652 virtual bool
3653 operator==(const template_decl&) const;
3654
3655 virtual ~template_tparameter();
3656};
3657
3658/// This abstracts a composition of types based on template type
3659/// parameters. The result of the composition is a type that can be
3660/// referred to by a template non-type parameter. Instances of this
3661/// type can appear at the same level as template parameters, in the
3662/// scope of a template_decl.
3663class type_composition : public template_parameter, public virtual decl_base
3664{
3665 class priv;
3666 std::unique_ptr<priv> priv_;
3667
3669
3670public:
3671 struct hash;
3672
3673 type_composition(unsigned index,
3674 template_decl_sptr tdecl,
3675 type_base_sptr composed_type);
3676
3677 const type_base_sptr
3678 get_composed_type() const;
3679
3680 void
3681 set_composed_type(type_base_sptr t);
3682
3683 virtual size_t
3684 get_hash() const;
3685
3686 virtual ~type_composition();
3687};
3688
3689/// Hasher for the @ref type_composition type.
3691{
3692 size_t
3693 operator()(const type_composition& t) const;
3694
3695 size_t
3696 operator()(const type_composition* t) const;
3697
3698}; //struct type_composition::hash
3699
3700/// Abstract a function template declaration.
3702{
3703 class priv;
3704 std::unique_ptr<priv> priv_;
3705
3706 // Forbidden
3708
3709public:
3710
3711 /// Hash functor for function templates.
3712 struct hash;
3713 struct shared_ptr_hash;
3714
3715 function_tdecl(const environment& env,
3716 const location& locus,
3717 visibility vis = VISIBILITY_DEFAULT,
3718 binding bind = BINDING_NONE);
3719
3721 const location& locus,
3722 visibility vis = VISIBILITY_DEFAULT,
3723 binding bind = BINDING_NONE);
3724
3725 virtual bool
3726 operator==(const decl_base&) const;
3727
3728 virtual bool
3729 operator==(const template_decl&) const;
3730
3731 virtual bool
3732 operator==(const function_tdecl&) const;
3733
3734 void
3735 set_pattern(shared_ptr<function_decl> p);
3736
3737 shared_ptr<function_decl>
3738 get_pattern() const;
3739
3740 binding
3741 get_binding() const;
3742
3743 virtual bool
3745
3746 virtual ~function_tdecl();
3747}; // end class function_tdecl.
3748
3749/// Abstract a class template.
3751{
3752 class priv;
3753 std::unique_ptr<priv> priv_;
3754
3755 // Forbidden
3756 class_tdecl();
3757
3758public:
3759
3760 /// Hashers.
3761 struct hash;
3762 struct shared_ptr_hash;
3763
3764 class_tdecl(const environment& env, const location& locus,
3765 visibility vis = VISIBILITY_DEFAULT);
3766
3768 const location& locus,
3769 visibility vis = VISIBILITY_DEFAULT);
3770
3771 virtual bool
3772 operator==(const decl_base&) const;
3773
3774 virtual bool
3775 operator==(const template_decl&) const;
3776
3777 virtual bool
3778 operator==(const class_tdecl&) const;
3779
3780 void
3782
3783 shared_ptr<class_decl>
3784 get_pattern() const;
3785
3786 virtual bool
3788
3789 virtual ~class_tdecl();
3790};// end class class_tdecl
3791
3792/// The base class for member types, data members and member
3793/// functions. Its purpose is mainly to carry the access specifier
3794/// (and possibly other properties that might be shared by all class
3795/// members) for the member.
3797{
3798protected:
3799 enum access_specifier access_;
3800 bool is_static_;
3801
3802private:
3803 // Forbidden
3804 member_base();
3805
3806public:
3807 /// Hasher.
3808 struct hash;
3809
3810 member_base(access_specifier a, bool is_static = false)
3811 : access_(a), is_static_(is_static)
3812 {}
3813
3814 /// Getter for the access specifier of this member.
3815 ///
3816 /// @return the access specifier for this member.
3819 {return access_;}
3820
3821 /// Setter for the access specifier of this member.
3822 ///
3823 /// @param a the new access specifier.
3824 void
3826 {access_ = a;}
3827
3828 /// @return true if the member is static, false otherwise.
3829 bool
3831 {return is_static_;}
3832
3833 /// Set a flag saying if the parameter is static or not.
3834 ///
3835 /// @param f set to true if the member is static, false otherwise.
3836 void
3838 {is_static_ = f;}
3839
3840 virtual bool
3841 operator==(const member_base& o) const;
3842};// end class member_base
3843
3844/// Abstraction of the declaration of a method.
3846{
3847 method_decl();
3848
3849 virtual void
3850 set_scope(scope_decl*);
3851
3852public:
3853
3854 method_decl(const string& name, method_type_sptr type,
3855 bool declared_inline, const location& locus,
3856 const string& mangled_name = "",
3857 visibility vis = VISIBILITY_DEFAULT,
3858 binding bind = BINDING_GLOBAL);
3859
3860 method_decl(const string& name,
3861 function_type_sptr type,
3862 bool declared_inline,
3863 const location& locus,
3864 const string& mangled_name = "",
3865 visibility vis = VISIBILITY_DEFAULT,
3866 binding bind = BINDING_GLOBAL);
3867
3868 method_decl(const string& name, type_base_sptr type,
3869 bool declared_inline, const location& locus,
3870 const string& mangled_name = "",
3871 visibility vis = VISIBILITY_DEFAULT,
3872 binding bind = BINDING_GLOBAL);
3873
3874 virtual void
3875 set_linkage_name(const string&);
3876
3877 /// @return the type of the current instance of the
3878 /// method_decl.
3879 const method_type_sptr
3880 get_type() const;
3881
3882 void
3883 set_type(const method_type_sptr fn_type)
3884 {function_decl::set_type(fn_type);}
3885
3886 friend bool
3888
3889 friend void
3891
3892 friend void
3894
3895 friend bool
3897
3898 friend void
3900
3901 friend void
3903
3904 friend bool
3905 get_member_function_is_static(const function_decl&);
3906
3907 friend void
3908 set_member_function_is_static(const function_decl&, bool);
3909
3910 friend bool
3912
3913 friend void
3915
3916 friend void
3918
3919 friend bool
3921
3922 friend ssize_t
3924
3925 friend void
3927
3928 friend void
3930
3931 friend bool
3933
3934 friend void
3936
3937 virtual ~method_decl();
3938};// end class method_decl
3939
3940bool
3941operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3942
3943bool
3944operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
3945
3946/// The base type of @ref class_decl and @ref union_decl
3948{
3949public:
3950 struct priv;
3951 priv *priv_;
3952
3953private:
3954 // Forbidden
3956
3957protected:
3958
3959 virtual decl_base_sptr
3960 add_member_decl(const decl_base_sptr&);
3961
3962 decl_base_sptr
3963 insert_member_decl(decl_base_sptr member);
3964
3965 virtual void
3966 remove_member_decl(decl_base_sptr);
3967
3968 void
3970
3971public:
3972 /// Hasher.
3973 struct hash;
3974
3975 /// Convenience typedef
3976 /// @{
3977 typedef vector<type_base_sptr> member_types;
3978 typedef vector<var_decl_sptr> data_members;
3979 typedef vector<method_decl_sptr> member_functions;
3980 typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
3981 typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
3982 typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
3983 /// @}
3984
3985 class_or_union(const environment& env, const string& name,
3986 size_t size_in_bits, size_t align_in_bits,
3987 const location& locus, visibility vis,
3988 member_types& mbrs, data_members& data_mbrs,
3989 member_functions& member_fns);
3990
3991 class_or_union(const environment& env, const string& name,
3992 size_t size_in_bits, size_t align_in_bits,
3993 const location& locus, visibility vis);
3994
3995 class_or_union(const environment& env, const string& name,
3996 bool is_declaration_only = true);
3997
3998 virtual void
3999 set_size_in_bits(size_t);
4000
4001 virtual size_t
4002 get_size_in_bits() const;
4003
4004 virtual size_t
4005 get_alignment_in_bits() const;
4006
4007 virtual void
4008 set_alignment_in_bits(size_t);
4009
4010 virtual size_t
4012
4013 virtual size_t
4015
4016 virtual size_t
4018
4019 void
4021 bool is_laid_out, bool is_static,
4022 size_t offset_in_bits);
4023
4024 const data_members&
4025 get_data_members() const;
4026
4027 const var_decl_sptr
4028 find_data_member(const string&) const;
4029
4030 const var_decl_sptr
4031 find_data_member(const var_decl_sptr&) const;
4032
4033 const var_decl_sptr
4035
4036 const data_members&
4038
4039 void
4040 add_member_function(method_decl_sptr f,
4042 bool is_static, bool is_ctor,
4043 bool is_dtor, bool is_const);
4044
4045 void
4046 add_member_function(method_decl_sptr f,
4048 bool is_virtual,
4049 size_t vtable_offset,
4050 bool is_static, bool is_ctor,
4051 bool is_dtor, bool is_const);
4052
4053 const member_functions&
4054 get_member_functions() const;
4055
4056 const method_decl*
4057 find_member_function(const string& mangled_name) const;
4058
4060 find_member_function(const string& mangled_name);
4061
4062 method_decl_sptr
4063 find_member_function_sptr(const string& mangled_name);
4064
4065 const method_decl*
4066 find_member_function_from_signature(const string& s) const;
4067
4069 find_member_function_from_signature(const string& s);
4070
4071 void
4072 add_member_function_template(member_function_template_sptr);
4073
4074 const member_function_templates&
4076
4077 void
4078 add_member_class_template(member_class_template_sptr m);
4079
4080 const member_class_templates&
4082
4083 bool
4084 has_no_member() const;
4085
4086 virtual bool
4087 operator==(const decl_base&) const;
4088
4089 virtual bool
4090 operator==(const type_base&) const;
4091
4092 virtual bool
4093 operator==(const class_or_union&) const;
4094
4095 virtual bool
4097
4098 virtual ~class_or_union();
4099
4100 friend method_decl_sptr
4101 copy_member_function(class_or_union_sptr& t,
4102 const method_decl*m);
4103
4104 friend method_decl_sptr
4105 copy_member_function(class_or_union_sptr& t,
4106 const method_decl_sptr& m);
4107
4108 friend void
4109 fixup_virtual_member_function(method_decl_sptr method);
4110
4111 friend void
4112 set_member_is_static(decl_base& d, bool s);
4113
4114 friend bool
4116
4117 friend bool
4118 equals(const class_decl&, const class_decl&, change_kind*);
4119
4120 friend class method_decl;
4121 friend class class_decl;
4122}; // end class class_or_union
4123
4124method_decl_sptr
4125copy_member_function(const class_or_union_sptr& clazz,
4126 const method_decl_sptr& f);
4127
4128method_decl_sptr
4129copy_member_function(const class_or_union_sptr& clazz,
4130 const method_decl* f);
4131
4132bool
4133operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4134
4135bool
4136operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4137
4138/// Hasher for the @ref class_or_union type
4140{
4141 size_t
4142 operator()(const class_or_union& t) const;
4143
4144 size_t
4145 operator()(const class_or_union* t) const;
4146}; // end struct class_decl::hash
4147
4148/// Abstracts a class declaration.
4150{
4151 // Forbidden
4152 class_decl();
4153
4154protected:
4155
4156 decl_base_sptr
4157 insert_member_decl(decl_base_sptr member);
4158
4159public:
4160 /// Hasher.
4161 struct hash;
4162
4163 /// Forward declarations.
4164 class base_spec;
4165
4166 /// Convenience typedef
4167 /// @{
4168 typedef shared_ptr<base_spec> base_spec_sptr;
4169 typedef vector<base_spec_sptr> base_specs;
4170
4171 /// @}
4172
4173protected:
4174 virtual void
4176
4177private:
4178 struct priv;
4179 // This priv it's not handled by a shared_ptr because accessing the
4180 // data members of the priv struct for this class_decl shows up on
4181 // performance profiles when dealing with big binaries with a lot of
4182 // types; dereferencing the shared_ptr involves locking of some sort
4183 // and that is slower than just dereferencing a pointer likere here.
4184 // There are other types for which the priv pointer is managed using
4185 // shared_ptr just fine, because those didn't show up during our
4186 // performance profiling.
4187 priv * priv_;
4188
4189public:
4190
4191 class_decl(const environment& env, const string& name,
4192 size_t size_in_bits, size_t align_in_bits,
4193 bool is_struct, const location& locus,
4194 visibility vis, base_specs& bases,
4195 member_types& mbrs, data_members& data_mbrs,
4196 member_functions& member_fns);
4197
4198 class_decl(const environment& env, const string& name,
4199 size_t size_in_bits, size_t align_in_bits,
4200 bool is_struct, const location& locus,
4201 visibility vis, base_specs& bases,
4202 member_types& mbrs, data_members& data_mbrs,
4203 member_functions& member_fns, bool is_anonymous);
4204
4205 class_decl(const environment& env, const string& name,
4206 size_t size_in_bits, size_t align_in_bits,
4207 bool is_struct, const location& locus, visibility vis);
4208
4209 class_decl(const environment& env, const string& name,
4210 size_t size_in_bits, size_t align_in_bits,
4211 bool is_struct, const location& locus,
4212 visibility vis, bool is_anonymous);
4213
4214 class_decl(const environment& env, const string& name, bool is_struct,
4215 bool is_declaration_only = true);
4216
4217 virtual string
4218 get_pretty_representation(bool internal = false,
4219 bool qualified_name = true) const;
4220
4221 void
4222 is_struct(bool f);
4223
4224 bool
4225 is_struct() const;
4226
4227 void
4228 add_base_specifier(shared_ptr<base_spec> b);
4229
4230 const base_specs&
4231 get_base_specifiers() const;
4232
4234 find_base_class(const string&) const;
4235
4236 const member_functions&
4237 get_virtual_mem_fns() const;
4238
4241
4242 void
4244
4245 bool
4246 has_no_base_nor_member() const;
4247
4248 bool
4250
4251 bool
4252 has_virtual_bases() const;
4253
4254 bool
4255 has_vtable() const;
4256
4257 ssize_t
4259
4260 virtual size_t
4261 get_hash() const;
4262
4263 virtual bool
4264 operator==(const decl_base&) const;
4265
4266 virtual bool
4267 operator==(const type_base&) const;
4268
4269 virtual bool
4270 operator==(const class_or_union&) const;
4271
4272 virtual bool
4273 operator==(const class_decl&) const;
4274
4275 virtual bool
4277
4278 virtual ~class_decl();
4279
4280 friend void
4281 fixup_virtual_member_function(method_decl_sptr method);
4282
4283 friend void
4284 set_member_is_static(decl_base& d, bool s);
4285
4286 friend bool
4287 equals(const class_decl&, const class_decl&, change_kind*);
4288
4289 friend class method_decl;
4290 friend class class_or_union;
4291};// end class class_decl
4292
4293bool
4294equals(const class_decl&, const class_decl&, change_kind*);
4295
4296method_decl_sptr
4298 const method_decl_sptr& f);
4299
4300method_decl_sptr
4302 const method_decl* f);
4303void
4304fixup_virtual_member_function(method_decl_sptr method);
4305
4306/// Hasher for the @ref class_decl type
4308{
4309 size_t
4310 operator()(const class_decl& t) const;
4311
4312 size_t
4313 operator()(const class_decl* t) const;
4314}; // end struct class_decl::hash
4315
4318
4320get_member_access_specifier(const decl_base_sptr&);
4321
4322void
4325
4326void
4327set_member_access_specifier(const decl_base_sptr&,
4329
4330std::ostream&
4331operator<<(std::ostream&, access_specifier);
4332
4333bool
4334operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4335
4336bool
4337operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4338
4339bool
4341 const class_decl::base_spec&,
4342 change_kind*);
4343
4344/// Abstraction of a base specifier in a class declaration.
4346 public virtual decl_base
4347{
4348 struct priv;
4349 std::unique_ptr<priv> priv_;
4350
4351 // Forbidden
4352 base_spec();
4353
4354public:
4355
4356 /// Hasher.
4357 struct hash;
4358
4360 long offset_in_bits = -1, bool is_virtual = false);
4361
4362 base_spec(const type_base_sptr& base, access_specifier a,
4363 long offset_in_bits = -1, bool is_virtual = false);
4364
4365 virtual ~base_spec();
4366
4368 get_base_class() const;
4369
4370 bool
4371 get_is_virtual() const;
4372
4373 long
4374 get_offset_in_bits() const;
4375
4376 virtual bool
4377 operator==(const decl_base&) const;
4378
4379 virtual bool
4380 operator==(const member_base&) const;
4381
4382 virtual size_t
4383 get_hash() const;
4384
4385 virtual bool
4387};// end class class_decl::base_spec
4388
4389bool
4392
4393bool
4396
4399
4402
4403/// Abstracts a union type declaration.
4405{
4406 // Forbid
4407 union_decl();
4408
4409public:
4410
4411 union_decl(const environment& env, const string& name,
4412 size_t size_in_bits, const location& locus,
4413 visibility vis, member_types& mbrs,
4414 data_members& data_mbrs, member_functions& member_fns);
4415
4416 union_decl(const environment& env, const string& name,
4417 size_t size_in_bits, const location& locus,
4418 visibility vis, member_types& mbrs,
4419 data_members& data_mbrs, member_functions& member_fns,
4420 bool is_anonymous);
4421
4422 union_decl(const environment& env, const string& name,
4423 size_t size_in_bits, const location& locus,
4424 visibility vis);
4425
4426 union_decl(const environment& env, const string& name,
4427 size_t size_in_bits, const location& locus,
4428 visibility vis, bool is_anonymous);
4429
4430 union_decl(const environment& env, const string& name,
4431 bool is_declaration_only = true);
4432
4433 virtual string
4434 get_pretty_representation(bool internal = false,
4435 bool qualified_name = true) const;
4436
4437 virtual bool
4438 operator==(const decl_base&) const;
4439
4440 virtual bool
4441 operator==(const type_base&) const;
4442
4443 virtual bool
4444 operator==(const class_or_union&) const;
4445
4446 virtual bool
4447 operator==(const union_decl&) const;
4448
4449 virtual bool
4451
4452 virtual ~union_decl();
4453}; // union_decl
4454
4455bool
4456equals(const union_decl&, const union_decl&, change_kind*);
4457
4458method_decl_sptr
4459copy_member_function(const union_decl_sptr& union_type,
4460 const method_decl_sptr& f);
4461
4462method_decl_sptr
4463copy_member_function(const union_decl_sptr& union_type,
4464 const method_decl* f);
4465
4466bool
4467operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4468
4469bool
4470operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4471
4472/// Abstraction of a member function context relationship. This
4473/// relates a member function to its parent class.
4475{
4476protected:
4477 bool is_virtual_;
4478 ssize_t vtable_offset_in_bits_;
4479 bool is_constructor_;
4480 bool is_destructor_;
4481 bool is_const_;
4482
4483public:
4485 : context_rel(),
4486 is_virtual_(false),
4487 vtable_offset_in_bits_(-1),
4488 is_constructor_(false),
4489 is_destructor_(false),
4490 is_const_(false)
4491 {}
4492
4494 : context_rel(s),
4495 is_virtual_(false),
4496 vtable_offset_in_bits_(-1),
4497 is_constructor_(false),
4498 is_destructor_(false),
4499 is_const_(false)
4500 {}
4501
4503 bool is_constructor,
4504 bool is_destructor,
4505 bool is_const,
4506 bool is_virtual,
4507 size_t vtable_offset_in_bits,
4508 access_specifier access,
4509 bool is_static)
4510 : context_rel(s, access, is_static),
4511 is_virtual_(is_virtual),
4512 vtable_offset_in_bits_(vtable_offset_in_bits),
4513 is_constructor_(is_constructor),
4514 is_destructor_(is_destructor),
4515 is_const_(is_const)
4516 {}
4517
4518 bool
4519 is_virtual() const
4520 {return is_virtual_;}
4521
4522 void
4523 is_virtual(bool is_virtual)
4524 {is_virtual_ = is_virtual;}
4525
4526 /// Getter for the vtable offset property.
4527 ///
4528 /// This is the vtable offset of the member function of this
4529 /// relation.
4530 ///
4531 /// @return the vtable offset property of the relation.
4532 size_t
4534 {return vtable_offset_in_bits_;}
4535
4536 /// Setter for the vtable offset property.
4537 ///
4538 /// This is the vtable offset of the member function of this
4539 /// relation.
4540 ///
4541 /// @partam s the new vtable offset.
4542 void
4544 {vtable_offset_in_bits_ = s;}
4545
4546 /// Getter for the 'is-constructor' property.
4547 ///
4548 /// This tells if the member function of this relation is a
4549 /// constructor.
4550 ///
4551 /// @return the is-constructor property of the relation.
4552 bool
4554 {return is_constructor_;}
4555
4556 /// Setter for the 'is-constructor' property.
4557 ///
4558 /// @param f the new value of the the property. Is true if this is
4559 /// for a constructor, false otherwise.
4560 void
4562 {is_constructor_ = f;}
4563
4564 /// Getter for the 'is-destructor' property.
4565 ///
4566 /// Tells if the member function of this relation is a destructor.
4567 ///
4568 /// @return the is-destructor property of the relation;
4569 bool
4571 {return is_destructor_;}
4572
4573 /// Setter for the 'is-destructor' property.
4574 ///
4575 /// @param f the new value of the property. Is true if this is for
4576 /// a destructor, false otherwise.
4577 void
4579 {is_destructor_ = f;}
4580
4581 /// Getter for the 'is-const' property.
4582 ///
4583 /// Tells if the member function of this relation is a const member
4584 /// function.
4585 ///
4586 /// @return the 'is-const' property of the relation.
4587 bool
4588 is_const() const
4589 {return is_const_;}
4590
4591 /// Setter for the 'is-const' property.
4592 ///
4593 /// @param f the new value of the property. Is true if this is for
4594 /// a const entity, false otherwise.
4595 void
4596 is_const(bool f)
4597 {is_const_ = f;}
4598
4599 virtual ~mem_fn_context_rel();
4600}; // end class mem_fn_context_rel
4601
4604
4607
4608method_decl_sptr
4610
4611const var_decl*
4612lookup_data_member(const type_base* type,
4613 const char* dm_name);
4614
4617 unsigned parm_num);
4618
4619/// Abstract a member function template.
4620class member_function_template : public member_base, public virtual decl_base
4621{
4622 bool is_constructor_;
4623 bool is_const_;
4624 shared_ptr<function_tdecl> fn_tmpl_;
4625
4626 // Forbiden
4628
4629public:
4630 /// Hasher.
4631 struct hash;
4632
4634 access_specifier access, bool is_static,
4635 bool is_constructor, bool is_const)
4636 : type_or_decl_base(f->get_environment()),
4637 decl_base(f->get_environment(), f->get_name(), location()),
4638 member_base(access, is_static), is_constructor_(is_constructor),
4639 is_const_(is_const), fn_tmpl_(f)
4640 {}
4641
4642 bool
4643 is_constructor() const
4644 {return is_constructor_;}
4645
4646 bool
4647 is_const() const
4648 {return is_const_;}
4649
4650 operator const function_tdecl& () const
4651 {return *fn_tmpl_;}
4652
4654 as_function_tdecl() const
4655 {return fn_tmpl_;}
4656
4657 virtual bool
4658 operator==(const member_base& o) const;
4659
4660 virtual bool
4662};// end class member_function_template
4663
4664bool
4665operator==(const member_function_template_sptr& l,
4666 const member_function_template_sptr& r);
4667
4668bool
4669operator!=(const member_function_template_sptr& l,
4670 const member_function_template_sptr& r);
4671
4672/// Abstracts a member class template template
4674 : public member_base,
4675 public virtual decl_base
4676{
4677 shared_ptr<class_tdecl> class_tmpl_;
4678
4679 // Forbidden
4681
4682public:
4683
4684 /// Hasher.
4685 struct hash;
4686
4688 access_specifier access, bool is_static)
4689 : type_or_decl_base(c->get_environment()),
4690 decl_base(c->get_environment(), c->get_name(), location()),
4691 member_base(access, is_static),
4692 class_tmpl_(c)
4693 {}
4694
4695 operator const class_tdecl& () const
4696 { return *class_tmpl_; }
4697
4699 as_class_tdecl() const
4700 {return class_tmpl_;}
4701
4702 virtual bool
4703 operator==(const member_base& o) const;
4704
4705 virtual bool
4706 operator==(const decl_base&) const;
4707
4708 virtual bool
4709 operator==(const member_class_template&) const;
4710
4711 virtual bool
4713};// end class member_class_template
4714
4715bool
4716operator==(const member_class_template_sptr& l,
4717 const member_class_template_sptr& r);
4718
4719bool
4720operator!=(const member_class_template_sptr& l,
4721 const member_class_template_sptr& r);
4722
4723// Forward declarations for select nested hashers.
4725{
4726 size_t
4727 operator()(const shared_ptr<type_base> t) const;
4728};
4729
4731{
4732 size_t
4733 operator()(const type_base* t) const;
4734};
4735
4736/// A hashing functor for instances and pointers of @ref var_decl.
4738{
4739 size_t
4740 operator()(const var_decl& t) const;
4741
4742 size_t
4743 operator()(const var_decl* t) const;
4744}; //end struct var_decl::hash
4745
4746/// A comparison functor for pointers to @ref var_decl.
4748{
4749 /// Return true if the two instances of @ref var_decl are equal.
4750 ///
4751 /// @param l the first variable to compare.
4752 ///
4753 /// @param r the second variable to compare.
4754 ///
4755 /// @return true if @p l equals @p r.
4756 bool
4757 operator()(const var_decl* l, const var_decl* r) const
4758 {
4759 if (l == r)
4760 return true;
4761 if (!!l != !!r)
4762 return false;
4763 return (*l == *r);
4764 }
4765};// end struct var_decl::ptr_equal
4766
4767/// A hashing functor fo instances and pointers of @ref function_decl.
4769{
4770 size_t
4771 operator()(const function_decl& t) const;
4772
4773 size_t
4774 operator()(const function_decl* t) const;
4775};//end struct function_decl::hash
4776
4777/// Equality functor for instances of @ref function_decl
4779{
4780 /// Tests if two pointers to @ref function_decl are equal.
4781 ///
4782 /// @param l the first pointer to @ref function_decl to consider in
4783 /// the comparison.
4784 ///
4785 /// @param r the second pointer to @ref function_decl to consider in
4786 /// the comparison.
4787 ///
4788 /// @return true if the two functions @p l and @p r are equal, false
4789 /// otherwise.
4790 bool
4791 operator()(const function_decl* l, const function_decl* r) const
4792 {
4793 if (l == r)
4794 return true;
4795 if (!!l != !!r)
4796 return false;
4797 return (*l == *r);
4798 }
4799};// function_decl::ptr_equal
4800
4801/// The hashing functor for class_decl::base_spec.
4803{
4804 size_t
4805 operator()(const base_spec& t) const;
4806};
4807
4808/// The hashing functor for member_base.
4810{
4811 size_t
4812 operator()(const member_base& m) const;
4813};
4814
4815/// The hashing functor for member_function_template.
4817{
4818 size_t
4819 operator()(const member_function_template& t) const;
4820};
4821
4822/// The hashing functor for member_class_template
4824{
4825 size_t
4826 operator()(const member_class_template& t) const;
4827};
4828
4830{
4831 size_t
4832 operator()(const function_tdecl& t) const;
4833};
4834
4836{
4837 size_t
4838 operator()(const shared_ptr<function_tdecl> f) const;
4839};
4840
4842{
4843 size_t
4844 operator()(const class_tdecl& t) const;
4845};
4846
4848{
4849 size_t
4850 operator()(const shared_ptr<class_tdecl> t) const;
4851};
4852
4853/// The base class for the visitor type hierarchy used for traversing
4854/// a translation unit.
4855///
4856/// Client code willing to get notified for a certain kind of node
4857/// during the IR traversal might want to define a visitor class that
4858/// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4859/// or ir_node_visitor::visit_end() method of its choice, and provide
4860/// and implementation for it. If either
4861/// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4862/// return false, it means the traversal has to stop immediately after
4863/// the methods' return. If the methods return true, it means the
4864/// traversal keeps going.
4865///
4866/// That new visitor class would then be passed to e.g,
4867/// translation_unit::traverse or to the traverse method of any type
4868/// where the traversal is supposed to start from.
4870{
4871 struct priv;
4872 std::unique_ptr<priv> priv_;
4873
4874public:
4875
4877
4878 virtual ~ir_node_visitor();
4879
4885
4886 virtual bool visit_begin(decl_base*);
4887 virtual bool visit_end(decl_base*);
4888
4889 virtual bool visit_begin(scope_decl*);
4890 virtual bool visit_end(scope_decl*);
4891
4892 virtual bool visit_begin(type_base*);
4893 virtual bool visit_end(type_base*);
4894
4895 virtual bool visit_begin(scope_type_decl*);
4896 virtual bool visit_end(scope_type_decl*);
4897
4898 virtual bool visit_begin(type_decl*);
4899 virtual bool visit_end(type_decl*);
4900
4901 virtual bool visit_begin(namespace_decl*);
4902 virtual bool visit_end(namespace_decl*);
4903
4904 virtual bool visit_begin(qualified_type_def*);
4905 virtual bool visit_end(qualified_type_def*);
4906
4907 virtual bool visit_begin(pointer_type_def*);
4908 virtual bool visit_end(pointer_type_def*);
4909
4910 virtual bool visit_begin(reference_type_def*);
4911 virtual bool visit_end(reference_type_def*);
4912
4913 virtual bool visit_begin(array_type_def*);
4914 virtual bool visit_end(array_type_def*);
4915
4916 virtual bool visit_begin(array_type_def::subrange_type*);
4917 virtual bool visit_end(array_type_def::subrange_type*);
4918
4919 virtual bool visit_begin(enum_type_decl*);
4920 virtual bool visit_end(enum_type_decl*);
4921
4922 virtual bool visit_begin(typedef_decl*);
4923 virtual bool visit_end(typedef_decl*);
4924
4925 virtual bool visit_begin(function_type*);
4926 virtual bool visit_end(function_type*);
4927
4928 virtual bool visit_begin(var_decl*);
4929 virtual bool visit_end(var_decl*);
4930
4931 virtual bool visit_begin(function_decl*);
4932 virtual bool visit_end(function_decl*);
4933
4934 virtual bool visit_begin(function_decl::parameter*);
4935 virtual bool visit_end(function_decl::parameter*);
4936
4937 virtual bool visit_begin(function_tdecl*);
4938 virtual bool visit_end(function_tdecl*);
4939
4940 virtual bool visit_begin(class_tdecl*);
4941 virtual bool visit_end(class_tdecl*);
4942
4943 virtual bool visit_begin(class_or_union *);
4944 virtual bool visit_end(class_or_union *);
4945
4946 virtual bool visit_begin(class_decl*);
4947 virtual bool visit_end(class_decl*);
4948
4949 virtual bool visit_begin(union_decl*);
4950 virtual bool visit_end(union_decl*);
4951
4952 virtual bool visit_begin(class_decl::base_spec*);
4953 virtual bool visit_end(class_decl::base_spec*);
4954
4955 virtual bool visit_begin(member_function_template*);
4956 virtual bool visit_end(member_function_template*);
4957
4958 virtual bool visit_begin(member_class_template*);
4959 virtual bool visit_end(member_class_template*);
4960}; // end struct ir_node_visitor
4961
4962// Debugging facility
4963void
4964fns_to_str(vector<function_decl*>::const_iterator a_begin,
4965 vector<function_decl*>::const_iterator a_end,
4966 vector<function_decl*>::const_iterator b_begin,
4967 vector<function_decl*>::const_iterator b_end,
4968 std::ostream& o);
4969
4970}// end namespace ir
4971} // end namespace abigail
4972#endif // __ABG_IR_H__
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:2496
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition: abg-ir.cc:17575
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:17543
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:17536
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition: abg-ir.cc:17550
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition: abg-ir.cc:17587
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition: abg-ir.cc:17558
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition: abg-ir.cc:17508
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition: abg-ir.cc:17565
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition: abg-ir.h:2481
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition: abg-ir.cc:17751
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition: abg-ir.cc:17744
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:17720
string as_string() const
Return a string representation of the sub range.
Definition: abg-ir.cc:17800
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17989
bool is_infinite() const
Test if the length of the subrange type is infinite.
Definition: abg-ir.cc:17778
bool operator!=(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:17928
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition: abg-ir.cc:17730
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:17712
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:17884
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition: abg-ir.cc:17737
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:17967
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition: abg-ir.cc:17823
uint64_t get_length() const
Getter of the length of the subrange type.
Definition: abg-ir.cc:17761
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition: abg-ir.cc:17793
The abstraction of an array type.
Definition: abg-ir.h:2455
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:18395
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition: abg-ir.cc:18326
virtual bool is_infinite() const
Definition: abg-ir.cc:18365
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition: abg-ir.cc:18341
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition: abg-ir.h:2473
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18455
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition: abg-ir.cc:18482
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:18304
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition: abg-ir.h:2476
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:18177
translation_unit::language get_language() const
Get the language of the array.
Definition: abg-ir.cc:18293
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition: abg-ir.cc:18351
Abstraction of a base specifier in a class declaration.
Definition: abg-ir.h:4347
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition: abg-ir.cc:23459
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition: abg-ir.cc:23466
long get_offset_in_bits() const
Getter of the offset of the base.
Definition: abg-ir.cc:23473
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:23499
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition: abg-ir.cc:23593
virtual size_t get_hash() const
Calculate the hash value for a class_decl::base_spec.
Definition: abg-ir.cc:23480
Abstracts a class declaration.
Definition: abg-ir.h:4150
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:23998
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition: abg-ir.cc:24049
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:23339
bool is_struct() const
Test if the class is a struct.
Definition: abg-ir.cc:23277
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition: abg-ir.cc:23294
virtual ~class_decl()
Destructor of the class_decl type.
Definition: abg-ir.cc:24649
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:23255
bool has_vtable() const
Test if the current instance has a vtable.
Definition: abg-ir.cc:24077
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition: abg-ir.cc:24091
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition: abg-ir.cc:24058
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24565
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition: abg-ir.h:4168
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition: abg-ir.cc:23284
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition: abg-ir.cc:23320
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition: abg-ir.cc:23344
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition: abg-ir.cc:24229
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition: abg-ir.cc:24417
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:24952
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition: abg-ir.cc:24040
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:24108
class_decl_sptr find_base_class(const string &) const
Find a base class of a given qualified name for the current class.
Definition: abg-ir.cc:23304
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition: abg-ir.h:4169
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:23365
The base type of class_decl and union_decl.
Definition: abg-ir.h:3948
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition: abg-ir.cc:22113
void add_member_function(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:22331
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:22264
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition: abg-ir.cc:22359
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:23998
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition: abg-ir.cc:21999
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition: abg-ir.cc:22435
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition: abg-ir.cc:22098
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition: abg-ir.cc:22131
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition: abg-ir.cc:22449
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition: abg-ir.h:3980
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition: abg-ir.h:3979
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition: abg-ir.cc:22223
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition: abg-ir.h:3981
void add_data_member(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:22180
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:22410
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:22394
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition: abg-ir.cc:22082
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition: abg-ir.cc:22491
virtual decl_base_sptr add_member_decl(const decl_base_sptr &)
Add a member declaration to the current instance of class_or_union. The member declaration can be eit...
Definition: abg-ir.cc:21987
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21905
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition: abg-ir.cc:22463
const data_members & get_non_static_data_members() const
Get the non-static data memebers of this class_or_union.
Definition: abg-ir.cc:22314
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:22368
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:22024
vector< var_decl_sptr > data_members
Convenience typedef.
Definition: abg-ir.h:3978
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition: abg-ir.cc:21978
bool has_no_member() const
Definition: abg-ir.cc:22476
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:22525
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:24952
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition: abg-ir.cc:22050
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition: abg-ir.cc:22442
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition: abg-ir.cc:22066
vector< type_base_sptr > member_types
Convenience typedef.
Definition: abg-ir.h:3977
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition: abg-ir.cc:22149
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:22234
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition: abg-ir.cc:22595
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition: abg-ir.h:3982
Abstract a class template.
Definition: abg-ir.h:3751
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition: abg-ir.cc:26339
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition: abg-ir.cc:26328
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26388
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:26343
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition: abg-ir.h:1233
bool operator!=(const context_rel &o) const
Inequality operator.
Definition: abg-ir.h:1299
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
Definition: abg-corpus.h:25
The base type of all declarations.
Definition: abg-ir.h:1525
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition: abg-ir.cc:15120
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:5105
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition: abg-ir.cc:5362
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition: abg-ir.cc:4934
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition: abg-ir.cc:4643
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:4727
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:5717
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition: abg-ir.cc:5053
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition: abg-ir.cc:4909
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:5089
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition: abg-ir.cc:4965
void clear_qualified_name()
Clear the qualified name of this decl.
Definition: abg-ir.cc:4636
void set_name(const string &n)
Setter for the name of the decl.
Definition: abg-ir.cc:4797
const location & get_location() const
Get the location of a given declaration.
Definition: abg-ir.cc:4747
binding
ELF binding.
Definition: abg-ir.h:1576
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
Definition: abg-ir.cc:4857
const interned_string & get_name() const
Getter for the name of the current decl.
Definition: abg-ir.cc:4953
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition: abg-ir.cc:5389
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition: abg-ir.cc:4627
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition: abg-ir.cc:4677
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6712
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition: abg-ir.cc:4810
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *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:8347
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:25026
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition: abg-ir.cc:5045
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:5073
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5686
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition: abg-ir.cc:8371
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition: abg-ir.cc:4875
void set_location(const location &l)
Set the location for a given declaration.
Definition: abg-ir.cc:4785
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition: abg-ir.cc:4820
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition: abg-ir.cc:4926
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4670
visibility get_visibility() const
Getter for the visibility of the decl.
Definition: abg-ir.cc:4919
visibility
ELF visibility.
Definition: abg-ir.h:1566
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition: abg-ir.cc:5096
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:5378
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition: abg-ir.cc:5061
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition: abg-ir.cc:4902
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5657
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition: abg-ir.cc:6674
virtual ~decl_base()
Destructor of the decl_base type.
Definition: abg-ir.cc:5366
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:5351
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:4946
bool get_is_anonymous_or_has_anonymous_parent() const
Definition: abg-ir.cc:4843
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition: abg-ir.cc:4832
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:4719
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition: abg-ir.cc:5268
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
Definition: abg-ir.cc:4696
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4656
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:4988
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:5169
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:19638
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition: abg-ir.h:2876
const var_decl * 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:3158
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition: abg-ir.cc:3168
The abstraction of the version of an ELF symbol.
Definition: abg-ir.h:1180
version & operator=(const version &o)
Assign a version to the current one.
Definition: abg-ir.cc:3071
bool operator==(const version &o) const
Compares the current version against another one.
Definition: abg-ir.cc:3053
bool is_default() const
Getter for the 'is_default' property of the version.
Definition: abg-ir.cc:3033
const string & str() const
Getter for the version name.
Definition: abg-ir.cc:3019
bool operator!=(const version &o) const
Inequality operator.
Definition: abg-ir.cc:3062
Abstraction of an elf symbol.
Definition: abg-ir.h:909
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition: abg-ir.cc:2156
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:2479
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition: abg-ir.cc:2374
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:1996
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition: abg-ir.cc:2211
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2135
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition: abg-ir.cc:2240
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition: abg-ir.cc:1986
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition: abg-ir.cc:2172
binding
The binding of a symbol.
Definition: abg-ir.h:926
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition: abg-ir.cc:2247
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:2500
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2031
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition: abg-ir.cc:2385
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition: abg-ir.cc:2264
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition: abg-ir.cc:2181
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition: abg-ir.cc:2119
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition: abg-ir.cc:2310
void set_size(size_t)
Setter of the size of the symbol.
Definition: abg-ir.cc:2017
const string & get_name() const
Getter for the name of the elf_symbol.
Definition: abg-ir.cc:1979
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2024
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:2566
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition: abg-ir.cc:2110
type
The type of a symbol.
Definition: abg-ir.h:913
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition: abg-ir.cc:2045
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition: abg-ir.cc:2142
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2056
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition: abg-ir.cc:2625
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition: abg-ir.cc:2225
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition: abg-ir.cc:2149
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:1902
visibility
The visibility of the symbol.
Definition: abg-ir.h:935
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition: abg-ir.cc:2038
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition: abg-ir.cc:2343
void set_index(size_t)
Setter for the index.
Definition: abg-ir.cc:1972
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2064
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition: abg-ir.cc:2359
size_t get_index() const
Getter for the index.
Definition: abg-ir.cc:1965
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition: abg-ir.cc:2430
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:2457
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition: abg-ir.cc:1958
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2003
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition: abg-ir.cc:2094
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2127
size_t get_size() const
Getter of the size of the symbol.
Definition: abg-ir.cc:2010
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition: abg-ir.cc:2072
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition: abg-ir.cc:2163
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition: abg-ir.cc:2232
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:2611
The abstraction of an enumerator.
Definition: abg-ir.h:2768
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:19044
bool operator!=(const enumerator &other) const
Inequality operator.
Definition: abg-ir.cc:19104
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition: abg-ir.cc:19146
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition: abg-ir.cc:19168
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition: abg-ir.cc:19113
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition: abg-ir.cc:19175
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:19161
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:19130
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:19154
bool operator==(const enumerator &other) const
Equality operator.
Definition: abg-ir.cc:19091
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:19075
Abstracts a declaration for an enum type.
Definition: abg-ir.h:2686
friend bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
Definition: abg-ir.cc:18634
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition: abg-ir.h:2702
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition: abg-ir.cc:18622
const enumerators & get_enumerators() const
Definition: abg-ir.cc:18553
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18600
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition: abg-ir.cc:18548
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:18965
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:18579
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition: abg-ir.h:140
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
Definition: abg-ir.cc:3655
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:3722
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:150
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:3802
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:3536
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:3754
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition: abg-ir.cc:3587
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:3555
const config & get_config() const
Getter of the general configuration object.
Definition: abg-ir.cc:3792
environment()
Default constructor of the environment type.
Definition: abg-ir.cc:3183
vector< type_base_sptr > * get_canonical_types(const char *name)
Get the vector of canonical types which have a given "string representation".
Definition: abg-ir.cc:3939
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition: abg-ir.cc:3599
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:3962
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:3574
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:3691
virtual ~environment()
Destructor for the environment type.
Definition: abg-ir.cc:3188
interned_string intern(const string &) const
Do intern a string.
Definition: abg-ir.cc:3785
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:26527
bool do_on_the_fly_canonicalization() const
Getter for the "on-the-fly-canonicalization" flag.
Definition: abg-ir.cc:3622
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:3828
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition: abg-ir.cc:3196
Abstraction of a function parameter.
Definition: abg-ir.h:3205
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition: abg-ir.cc:21738
interned_string get_type_name() const
Definition: abg-ir.cc:21527
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition: abg-ir.cc:21565
const string get_type_pretty_representation() const
Definition: abg-ir.cc:21546
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition: abg-ir.cc:21703
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
Definition: abg-ir.cc:21723
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:21758
Abstraction for a function declaration.
Definition: abg-ir.h:3033
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3057
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:20920
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition: abg-ir.cc:21014
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21389
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition: abg-ir.cc:21084
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition: abg-ir.cc:21308
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition: abg-ir.cc:20980
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition: abg-ir.cc:20999
function_decl(const string &name, function_type_sptr function_type, bool declared_inline, const location &locus, const string &mangled_name, visibility vis, binding bind)
Constructor of the function_decl.
Definition: abg-ir.cc:20801
const type_base_sptr get_return_type() const
Definition: abg-ir.cc:21065
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition: abg-ir.cc:21097
const std::vector< parameter_sptr > & get_parameters() const
Definition: abg-ir.cc:21070
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition: abg-ir.cc:21077
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition: abg-ir.cc:21036
virtual ~function_decl()
Destructor of the function_decl type.
Definition: abg-ir.cc:21405
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:21052
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition: abg-ir.cc:21294
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3060
virtual size_t get_hash() const
The virtual implementation of 'get_hash' for a function_decl.
Definition: abg-ir.cc:21320
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:20870
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:21336
Abstract a function template declaration.
Definition: abg-ir.h:3702
binding get_binding() const
Get the binding of the function template.
Definition: abg-ir.cc:26176
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition: abg-ir.cc:26158
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition: abg-ir.cc:26169
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26236
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition: abg-ir.cc:26185
Abstraction of a function type.
Definition: abg-ir.h:3309
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3319
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition: abg-ir.cc:20231
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:20513
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition: abg-ir.cc:20198
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:20409
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:20012
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition: abg-ir.cc:20472
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:20183
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition: abg-ir.cc:20160
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition: abg-ir.cc:20429
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:20139
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition: abg-ir.cc:20102
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition: abg-ir.cc:20110
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:20387
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition: abg-ir.cc:20119
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3321
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:20496
This abstracts the global scope of a given translation unit.
Definition: abg-ir.h:1939
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition: abg-ir.h:4870
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:27227
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition: abg-ir.cc:27271
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition: abg-ir.cc:27261
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition: abg-ir.cc:27206
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition: abg-ir.cc:27237
The entry point to manage locations.
Definition: abg-ir.h:441
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:448
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:471
The source location of a token.
Definition: abg-ir.h:299
location()
Default constructor for the location type.
Definition: abg-ir.h:381
bool get_is_artificial() const
Test if the location is artificial.
Definition: abg-ir.h:340
bool operator<(const location &other) const
"Less than" operator of the location type.
Definition: abg-ir.h:413
location & operator=(const location &l)
Assignment operator of the location.
Definition: abg-ir.h:372
bool operator==(const location &other) const
Equality operator of the location type.
Definition: abg-ir.h:403
location(const location &l)
Copy constructor of the location.
Definition: abg-ir.h:362
unsigned get_value() const
Get the value of the location.
Definition: abg-ir.h:387
void set_is_artificial(bool f)
Set the artificial-ness of the location.
Definition: abg-ir.h:356
string expand(void) const
Expand the location into a string.
Definition: abg-ir.cc:413
Abstraction of a member function context relationship. This relates a member function to its parent c...
Definition: abg-ir.h:4475
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition: abg-ir.h:4553
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition: abg-ir.h:4543
bool is_const() const
Getter for the 'is-const' property.
Definition: abg-ir.h:4588
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition: abg-ir.h:4578
void is_const(bool f)
Setter for the 'is-const' property.
Definition: abg-ir.h:4596
size_t vtable_offset() const
Getter for the vtable offset property.
Definition: abg-ir.h:4533
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition: abg-ir.h:4561
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition: abg-ir.h:4570
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition: abg-ir.h:3797
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition: abg-ir.h:3818
bool get_is_static() const
Definition: abg-ir.h:3830
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition: abg-ir.h:3825
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition: abg-ir.h:3837
Abstracts a member class template template.
Definition: abg-ir.h:4676
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition: abg-ir.cc:24812
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24897
Abstract a member function template.
Definition: abg-ir.h:4621
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24791
Abstraction of the declaration of a method.
Definition: abg-ir.h:3846
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition: abg-ir.cc:6571
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition: abg-ir.cc:23740
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6712
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition: abg-ir.cc:6458
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition: abg-ir.cc:6611
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition: abg-ir.cc:6428
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition: abg-ir.cc:6515
const method_type_sptr get_type() const
Definition: abg-ir.cc:23767
friend void set_member_function_vtable_offset(function_decl &, ssize_t)
Set the vtable offset of a member function.
Definition: abg-ir.cc:6644
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:6600
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition: abg-ir.cc:6487
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition: abg-ir.cc:6543
friend bool get_member_function_is_virtual(const function_decl &)
Test if a given member function is virtual.
Definition: abg-ir.cc:6674
Abstracts the type of a class member function.
Definition: abg-ir.h:3405
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:20700
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition: abg-ir.cc:20732
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:9135
virtual ~method_type()
The destructor of method_type.
Definition: abg-ir.cc:20743
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:20724
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition: abg-ir.cc:20691
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition: abg-ir.cc:20739
The abstraction of a namespace declaration.
Definition: abg-ir.h:2184
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:16187
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16218
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
Definition: abg-ir.cc:16121
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition: abg-ir.cc:16173
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:16159
Abstracts non type template parameters.
Definition: abg-ir.h:3579
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition: abg-ir.cc:25855
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:25869
virtual size_t get_hash() const
Get the hash value of the current instance.
Definition: abg-ir.cc:25862
The abstraction of a pointer type.
Definition: abg-ir.h:2324
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition: abg-ir.cc:16851
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:16986
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:16782
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17069
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition: abg-ir.cc:16922
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition: abg-ir.cc:16966
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition: abg-ir.cc:16973
The abstraction of a qualified type.
Definition: abg-ir.h:2213
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:16509
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition: abg-ir.cc:16633
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition: abg-ir.cc:16373
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:16621
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition: abg-ir.h:2232
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:16313
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition: abg-ir.cc:16612
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16581
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition: abg-ir.cc:16607
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition: abg-ir.cc:16626
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition: abg-ir.cc:16453
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition: abg-ir.cc:16290
Abstracts a reference type.
Definition: abg-ir.h:2387
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:17368
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:17142
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17434
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:17240
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition: abg-ir.cc:17310
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:17413
A declaration that introduces a scope.
Definition: abg-ir.h:1796
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition: abg-ir.cc:7855
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition: abg-ir.cc:8035
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition: abg-ir.cc:7994
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition: abg-ir.cc:8010
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition: abg-ir.cc:8371
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition: abg-ir.cc:7873
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition: abg-ir.cc:7908
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition: abg-ir.h:1807
bool is_empty() const
Test if the current scope is empty.
Definition: abg-ir.cc:7922
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:8317
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition: abg-ir.cc:7969
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition: abg-ir.h:1805
decl_base_sptr insert_member_decl(decl_base_sptr member, declarations::iterator before)
Insert a member decl to this scope, right before an element pointed to by a given iterator....
Definition: abg-ir.cc:8081
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition: abg-ir.h:1803
friend decl_base_sptr insert_decl_into_scope(decl_base_sptr decl, scope_decl::declarations::iterator before, scope_decl *scope)
Inserts a declaration into a given scope, before a given IR child node of the scope.
Definition: abg-ir.cc:8391
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:7791
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:8269
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition: abg-ir.cc:8111
virtual decl_base_sptr add_member_decl(const 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:7938
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:7980
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7815
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:7779
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition: abg-ir.cc:8054
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *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:8347
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:8223
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7833
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition: abg-ir.cc:7891
virtual size_t get_hash() const
Return the hash value for the current instance of scope_decl.
Definition: abg-ir.cc:8148
A type that introduces a scope.
Definition: abg-ir.h:2158
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:16080
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition: abg-ir.cc:16042
The base class of templates.
Definition: abg-ir.h:3461
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:25523
virtual ~template_decl()
Destructor.
Definition: abg-ir.cc:25548
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:25515
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:25557
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition: abg-ir.h:3496
virtual ~template_parameter()
Destructor.
Definition: abg-ir.cc:25684
bool operator!=(const template_parameter &) const
Inequality operator.
Definition: abg-ir.cc:25680
Abstracts a template template parameter.
Definition: abg-ir.h:3626
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:25942
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
Definition: abg-ir.h:672
void set_address_size(char)
Setter of the address size in this translation unit.
Definition: abg-ir.cc:1393
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:1308
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:1425
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
Definition: abg-ir.cc:1435
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
Definition: abg-ir.cc:1351
char get_address_size() const
Getter of the address size in this translation unit.
Definition: abg-ir.cc:1386
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:1289
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:14243
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
Definition: abg-ir.cc:1335
void set_language(language l)
Setter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1252
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:1461
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
Definition: abg-ir.cc:1188
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
Definition: abg-ir.cc:1375
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:1409
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:14326
const std::string & get_path() const
Get the path of the current translation unit.
Definition: abg-ir.cc:1265
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:1300
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
Definition: abg-ir.cc:1359
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
Definition: abg-ir.cc:1276
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
Definition: abg-ir.cc:1493
language
The language of the translation unit.
Definition: abg-ir.h:685
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition: abg-ir.h:681
bool operator!=(const translation_unit &) const
Inequality operator.
Definition: abg-ir.cc:1450
const vector< function_type_sptr > & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
Definition: abg-ir.cc:1231
const environment & get_environment() const
Getter of the environment of the current translation_unit.
Definition: abg-ir.cc:1238
const type_maps & get_types() const
Getter of the types of the current translation_unit.
Definition: abg-ir.cc:1215
language get_language() const
Getter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1245
The interface for types which are feeling social and want to be visited during the traversal of a hie...
Definition: abg-traverse.h:39
An abstraction helper for type declarations.
Definition: abg-ir.h:1960
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
Definition: abg-ir.cc:15182
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition: abg-ir.cc:15165
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition: abg-ir.cc:15261
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:15287
friend type_base_sptr canonicalize(type_base_sptr)
Compute the canonical type of a given type.
Definition: abg-ir.cc:15034
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:14944
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition: abg-ir.cc:15254
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition: abg-ir.cc:15247
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition: abg-ir.cc:15237
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition: abg-ir.cc:15275
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition: abg-ir.cc:15268
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition: abg-ir.cc:15149
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition: abg-ir.h:3664
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition: abg-ir.cc:26048
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition: abg-ir.cc:26055
virtual size_t get_hash() const
Get the hash value for the current instance.
Definition: abg-ir.cc:26062
A basic type declaration that introduces no scope.
Definition: abg-ir.h:2095
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:15874
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:15953
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:15812
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:15768
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:15933
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Definition: abg-ir.h:585
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:591
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:680
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:631
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:549
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:563
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:645
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:577
bool empty() const
Test if the type_maps is empty.
Definition: abg-ir.cc:517
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:604
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
Definition: abg-ir.cc:1124
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:617
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:535
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:666
The base class of both types and declarations.
Definition: abg-ir.h:1354
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4400
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4214
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition: abg-ir.cc:4203
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition: abg-ir.cc:4360
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition: abg-ir.cc:4367
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:4164
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition: abg-ir.cc:4392
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition: abg-ir.cc:4237
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4226
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition: abg-ir.cc:4425
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition: abg-ir.cc:4257
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition: abg-ir.cc:10521
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:4184
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:4292
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition: abg-ir.cc:10188
friend pointer_type_def * is_pointer_type(type_or_decl_base *)
Test whether a type is a pointer_type_def.
Definition: abg-ir.cc:10635
bool hashing_started() const
Getter for the 'hashing_started' property.
Definition: abg-ir.cc:4310
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition: abg-ir.cc:4342
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:1368
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition: abg-ir.cc:4324
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:4154
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:4174
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition: abg-ir.cc:10261
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4417
Abstracts a type template parameter.
Definition: abg-ir.h:3542
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:25726
The abstraction of a typedef declaration.
Definition: abg-ir.h:2818
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition: abg-ir.cc:19403
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition: abg-ir.cc:19258
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19418
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition: abg-ir.cc:19396
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:19338
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition: abg-ir.cc:19275
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:19379
Abstracts a union type declaration.
Definition: abg-ir.h:4405
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:25317
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition: abg-ir.cc:25257
virtual ~union_decl()
Destructor of the union_decl type.
Definition: abg-ir.cc:25390
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:25224
Abstracts a variable declaration.
Definition: abg-ir.h:2930
binding get_binding() const
Getter of the binding of the variable.
Definition: abg-ir.cc:19532
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition: abg-ir.cc:19514
void set_binding(binding b)
Setter of the binding of the variable.
Definition: abg-ir.cc:19539
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition: abg-ir.cc:6232
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition: abg-ir.cc:19577
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:19840
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:19525
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition: abg-ir.cc:6377
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:19507
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19984
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:19961
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition: abg-ir.cc:6306
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition: abg-ir.cc:19554
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:6200
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:6363
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:19570
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition: abg-ir.cc:19765
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:19807
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:19870
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:19784
string get_pretty_representation(diff *d)
Get a copy of the pretty representation of a diff node.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition: abg-fwd.h:232
bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
Definition: abg-ir.cc:18634
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
Definition: abg-fwd.h:218
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
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:266
access_specifier
Access specifier for class members.
Definition: abg-ir.h:865
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition: abg-ir.cc:21371
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
Definition: abg-fwd.h:290
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
Definition: abg-corpus.cc:1617
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:23998
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two variables are equals modulo CV qualifiers.
Definition: abg-ir.cc:18254
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:1505
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:24706
integral_type::modifiers_type operator~(integral_type::modifiers_type l)
Bitwise one's complement operator for integral_type::modifiers_type.
Definition: abg-ir.cc:15344
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:11226
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:874
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:1309
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition: abg-ir.h:1313
@ 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:1329
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition: abg-ir.h:1324
@ 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:1318
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:1688
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
Definition: abg-ir.h:119
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:9198
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition: abg-ir.h:890
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
Definition: abg-fwd.h:315
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition: abg-fwd.h:190
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:2878
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:27623
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:8583
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5686
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition: abg-fwd.h:207
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition: abg-fwd.h:164
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:2750
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:19638
void sort_types(const canonical_type_sptr_set_type &types, vector< type_base_sptr > &result)
Sort types in a hopefully stable manner.
Definition: abg-ir.cc:3516
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
Definition: abg-corpus.cc:1603
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:2959
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition: abg-ir.cc:1651
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:882
decl_base_sptr insert_decl_into_scope(decl_base_sptr decl, scope_decl::declarations::iterator before, scope_decl *scope)
Inserts a declaration into a given scope, before a given IR child node of the scope.
Definition: abg-ir.cc:8391
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:26818
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition: abg-ir.cc:2681
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:249
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
Definition: abg-corpus.cc:1631
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition: abg-fwd.h:261
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:2911
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:121
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:899
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition: abg-ir.h:1223
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:887
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:11679
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition: abg-ir.cc:1665
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10165
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition: abg-ir.cc:5268
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:2936
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition: abg-ir.h:877
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition: abg-fwd.h:223
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:1575
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:27106
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition: abg-ir.cc:11084
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition: abg-ir.cc:1637
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:23829
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5657
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition: abg-fwd.h:172
vector< type_base * > type_base_ptrs_type
Helper typedef for a vector of pointer to type_base.
Definition: abg-ir.h:116
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
Definition: abg-ir.h:100
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
Definition: abg-ir.cc:8663
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:2206
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:8946
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
Definition: abg-fwd.h:307
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:8553
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:837
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:27084
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition: abg-fwd.h:158
translation_unit * get_translation_unit(const decl_base &decl)
Return the translation unit a declaration belongs to.
Definition: abg-ir.cc:9964
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:113
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
Definition: abg-ir.cc:1674
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.
Definition: abg-corpus.cc:1645
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:1707
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10136
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:2969
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:895
method_decl_sptr copy_member_function(const 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:22827
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
Definition: abg-fwd.h:295
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:5169
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
Definition: abg-ir.cc:152
A functor to hash instances of interned_string.
Functor to hash a canonical type by using its pointer value.
Definition: abg-ir.h:104
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:7718
The hashing functor for class_decl::base_spec.
Definition: abg-ir.h:4803
Hasher for the class_decl type.
Definition: abg-ir.h:4308
size_t operator()(const class_decl &t) const
Compute a hash for a class_decl.
Definition: abg-hash.cc:686
Hasher for the class_or_union type.
Definition: abg-ir.h:4140
size_t operator()(const class_or_union &t) const
Compute a hash for a class_or_union.
Definition: abg-hash.cc:607
The private data of the environment type.
Definition: abg-ir-priv.h:389
A hashing functor fo instances and pointers of function_decl.
Definition: abg-ir.h:4769
size_t operator()(const function_decl &t) const
Compute a hash value for an instance of function_decl.
Definition: abg-hash.cc:396
A hashing functor for a function_decl::parameter.
Definition: abg-ir.h:3287
Equality functor for instances of function_decl.
Definition: abg-ir.h:4779
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition: abg-ir.h:4791
The hashing functor for function_type.
Definition: abg-ir.h:3392
size_t operator()(const function_type &t) const
Hashing function for function_type.
Definition: abg-hash.cc:501
The type of the private data of the function_type type.
Definition: abg-ir-priv.h:1521
The base of an entity of the intermediate representation that is to be traversed.
Definition: abg-ir.h:462
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:27189
The hashing functor for member_base.
Definition: abg-ir.h:4810
The hashing functor for member_class_template.
Definition: abg-ir.h:4824
The hashing functor for member_function_template.
Definition: abg-ir.h:4817
The base class for the visitor type hierarchy used for traversing a hierarchy of nodes.
Definition: abg-traverse.h:28
Hasher for the non_type_tparameter type.
Definition: abg-ir.h:3614
size_t operator()(const non_type_tparameter &t) const
Compute a hash value for a non_type_tparameter.
Definition: abg-hash.cc:828
Hasher for the scope_decl type.
Definition: abg-ir.h:1925
size_t operator()(const scope_decl &d) const
Hashing operator for the scope_decl type.
Definition: abg-hash.cc:169
A comparison functor to compare translation units based on their absolute paths.
Definition: abg-ir.h:820
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:829
Private type to hold private members of translation_unit.
Definition: abg-ir-priv.h:143
size_t operator()(const type_base *t) const
A hashing function for type declarations.
Definition: abg-hash.cc:988
Hash functor for instances of type_base.
Definition: abg-ir.h:2039
size_t operator()(const type_base &t) const
Hash function for an instance of type_base.
Definition: abg-hash.cc:95
Definition of the private data of type_base.
Definition: abg-ir-priv.h:179
Hasher for the type_composition type.
Definition: abg-ir.h:3691
size_t operator()(const type_composition &t) const
Compute a hash value for a type_composition type.
Definition: abg-hash.cc:892
A comparison functor to compare pointer to instances of type_or_decl_base.
Definition: abg-ir.h:3164
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:3198
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition: abg-ir.h:3173
The comparison functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:508
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:542
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:522
The hashing functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:476
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:486
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:501
A predicate for deep equality of instances of type_base*.
Definition: abg-ir.h:2053
A predicate for deep equality of instances of shared_ptr<type_base>
Definition: abg-ir.h:2073
A hashing functor for instances and pointers of var_decl.
Definition: abg-ir.h:4738
size_t operator()(const var_decl &t) const
Compute a hash for an instance var_decl.
Definition: abg-hash.cc:357
A comparison functor for pointers to var_decl.
Definition: abg-ir.h:4748
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:4757