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-2025 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-traverse.h"
27#include "abg-config.h"
28
29/// @file
30///
31/// This file contains the declarations of the Internal Representation
32/// of libabigail.
33
34/// @defgroup Memory Memory management
35/// @{
36///
37/// How objects' lifetime is handled in libabigail.
38///
39/// For memory management and garbage collection of libabigail's IR
40/// artifacts, we use std::shared_ptr and std::weak_ptr.
41///
42/// When manipulating these IR artifacts, there are a few rules to keep in
43/// mind.
44///
45/// <b>The declaration for a type is owned by only one scope </b>
46///
47/// This means that for each instance of abigail::type_base (a type) there
48/// is an instance of abigail::scope_decl that owns a @ref
49/// abigail::decl_base_sptr (a shared pointer to an abigail::decl_base)
50/// that points to the declaration of that type. The
51/// abigail::type_base_sptr is added to the scope using the function
52/// abigail::add_decl_to_scope().
53///
54/// There is a kind of type that is usually not syntactically owned by
55/// a scope: it's function type. In libabigail, function types are
56/// represented by abigail::function_type and abigail::method_type.
57/// These types must be owned by the translation unit they originate
58/// from. Adding them to the translation unit must be done by a call
59/// to the method function
60/// abigail::translation::bind_function_type_life_time().
61///
62/// <b> A declaration that has a type does NOT own the type </b>
63///
64/// This means that, for instance, in an abigail::var_decl (a variable
65/// declaration), the type of the declaration is not owned by the
66/// declaration. In other (concrete) words, the variable declaration
67/// doesn't have a shared pointer to the type. Rather, it has a *weak*
68/// pointer to its type. That means that it has a data member of type
69/// abigail::type_base_wptr that contains the type of the declaration.
70///
71/// But then abigail::var_decl::get_type() returns a shared pointer that
72/// is constructed from the internal weak pointer to the type. That way,
73/// users of the type of the var can own a temporary reference on it and
74/// be assured that the type's life time is long enough for their need.
75///
76/// Likewise, data members, function and template parameters similarly
77/// have weak pointers on their type.
78///
79/// If, for a reason, you really need to keep a type alive for the
80/// entire lifetime of the type system, then you can bind the life
81/// time of that type to the life time of the @ref environment that is
82/// supposed to outlive the type system. You do that by passing the
83/// type to the function environment::keep_type_alive().
84///
85/// @}
86
87namespace abigail
88{
89
90/// The namespace of the internal representation of ABI artifacts like
91/// types and decls.
92namespace ir
93{
94
95// Inject some std types in here.
96using std::unordered_map;
97
98/// A convenience typedef for an unordered set of pointer values
99typedef unordered_set<uintptr_t> pointer_set;
100
101/// The abstraction for an 8 bytes hash value.
102///
103/// As this is an optional uint64_t value, it allows the represent
104/// empty hash values.
106
107hash_t
109
110/// Functor to hash a canonical type by using its pointer value.
112{
113 size_t operator()(const type_base_sptr& l) const;
114 size_t operator()(const type_base *l) const;
115}; //end struct canonical_type_hash
116
117/// Helper typedef for an unordered set of type_base_sptr which uses
118/// pointer value to tell its members appart, because the members are
119/// canonical types.
120typedef unordered_set<type_base_sptr,
122
123/// Helper typedef for a vector of pointer to type_base.
124typedef vector<type_base*> type_base_ptrs_type;
125
126/// Helper typedef for a vector of shared pointer to a type_base.
127typedef vector<type_base_sptr> type_base_sptrs_type;
128
129void
131 vector<type_base_sptr>& result);
132
133/// This is an abstraction of the set of resources necessary to manage
134/// several aspects of the internal representations of the Abigail
135/// library.
136///
137/// An environment can be seen as the boundaries in which all related
138/// Abigail artifacts live. So before doing anything using this
139/// library, the first thing to create is, well, you know it now, an
140/// environment.
141///
142/// Note that the lifetime of environment objects must be longer than
143/// the lifetime of any other type in the Abigail system. So a given
144/// instance of @ref environment must stay around as long as you are
145/// using libabigail. It's only when you are done using the library
146/// that you can de-allocate the environment instance.
148{
149public:
150 struct priv;
151 std::unique_ptr<priv> priv_;
152
153 /// A convenience typedef for a map of canonical types. The key is
154 /// the pretty representation string of a particular type and the
155 /// value is the vector of canonical types that have the same pretty
156 /// representation string.
157 typedef std::unordered_map<string, std::vector<type_base_sptr> >
159
160 environment();
161
162 virtual ~environment();
163
166
169
170 const type_base_sptr&
171 get_void_type() const;
172
173 const type_base_sptr&
174 get_void_pointer_type() const;
175
176 const type_base_sptr&
178
179 static string&
181
182 bool
184
185 void
187
188 bool
190
191 void
193
194 bool
196
197 void
199
200 bool
201 is_void_type(const type_base_sptr&) const;
202
203 bool
204 is_void_type(const type_base*) const;
205
206 bool
207 is_void_pointer_type(const type_base_sptr&) const;
208
209 bool
210 is_void_pointer_type(const type_base*) const;
211
212 bool
214
215 bool
216 is_variadic_parameter_type(const type_base_sptr&) const;
217
219 intern(const string&) const;
220
221 const config&
222 get_config() const;
223
224 bool
226
227 void
229
230 bool
232
233#ifdef WITH_DEBUG_SELF_COMPARISON
234 void
235 set_self_comparison_debug_input(const corpus_sptr& corpus);
236
237 void
238 get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
239 corpus_sptr& second_corpus);
240
241 void
242 self_comparison_debug_is_on(bool);
243
244 bool
245 self_comparison_debug_is_on() const;
246#endif
247
248#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
249 void
250 debug_type_canonicalization_is_on(bool flag);
251
252 bool
253 debug_type_canonicalization_is_on() const;
254
255 void
256 debug_die_canonicalization_is_on(bool flag);
257
258 bool
259 debug_die_canonicalization_is_on() const;
260#endif
261
262 const vector<type_base_sptr>* get_canonical_types(const char* name) const;
263
264 type_base* get_canonical_type(const char* name, unsigned index);
265
266#ifdef WITH_DEBUG_SELF_COMPARISON
267 const unordered_map<string, uintptr_t>&
268 get_type_id_canonical_type_map() const;
269
270 unordered_map<string, uintptr_t>&
271 get_type_id_canonical_type_map();
272
273 const unordered_map<uintptr_t, string>&
274 get_pointer_type_id_map() const;
275
276 unordered_map<uintptr_t, string>&
277 get_pointer_type_id_map();
278
279 string
280 get_type_id_from_pointer(uintptr_t ptr) const;
281
282 string
283 get_type_id_from_type(const type_base *ptr) const;
284
285 uintptr_t
286 get_canonical_type_from_type_id(const char*) const;
287#endif
288
289 friend class class_or_union;
290 friend class class_decl;
291 friend class function_type;
292
293 friend void keep_type_alive(type_base_sptr);
294}; // end class environment
295
296class location_manager;
297/// @brief The source location of a token.
298///
299/// This represents the location of a token coming from a given
300/// translation unit. This location is actually an abstraction of
301/// cursor in the table of all the locations of all the tokens of the
302/// translation unit. That table is managed by the @ref location_manager
303/// type. To get the file path, line and column numbers associated to
304/// a given instance of @ref location, you need to use the
305/// location_manager::expand_location method.
307{
308 unsigned value_;
309 // The location manager to use to decode the value above. There is
310 // one location manager per translation unit, and the location
311 // manager's life time is managed by its translation unit.
312 location_manager* loc_manager_;
313 // Whether the location is artificial. Being artificial means that
314 // the location wasn't generated by the original emitter of the
315 // metadata (i.e, the compiler if the metadata is debug info). For
316 // instance, implicit location derived from the position of XML
317 // elements in the abixml file is represented as artificial
318 // locations.
319 bool is_artificial_;
320
321 location(unsigned v, location_manager* m)
322 : value_(v), loc_manager_(m), is_artificial_(false)
323 {}
324
325 /// Get the location manager to use to decode the value of this
326 /// location.
327 ///
328 /// @return the location manager for the current location value.
330 get_location_manager() const
331 {return loc_manager_;}
332
333public:
334
335 /// Test if the location is artificial.
336 ///
337 /// Being artificial means that the location wasn't generated by the
338 /// original emitter of the metadata (i.e, the compiler if the
339 /// metadata is debug info). For instance, the implicit location
340 /// derived from the position of a given XML element in the abixml
341 /// file is represented as artificial locations. The same XML
342 /// element might carry a non-artificial (natural?) location that was
343 /// originally emitted by the compiler that generated the original
344 /// debug info the abixml file is derived from.
345 ///
346 /// @return true iff the location is artificial.
347 bool
349 {return is_artificial_;}
350
351 /// Set the artificial-ness of the location.
352 ///
353 /// Being artificial means that the location wasn't generated by the
354 /// original emitter of the metadata (i.e, the compiler if the
355 /// metadata is debug info). For instance, the implicit location
356 /// derived from the position of a given XML element in the abixml
357 /// file is represented as artificial locations. The same XML
358 /// element might carry a non-artificial (natural?) location that
359 /// was originally emitted by the compiler that generated the
360 /// original debug info the abixml file is derived from.
361 ///
362 /// @param f the new artificial-ness state.
363 void
365 {is_artificial_ = f;}
366
367 /// Copy constructor of the location.
368 ///
369 /// @param l the location to copy from.
371 : value_(l.value_),
372 loc_manager_(l.loc_manager_),
373 is_artificial_(l.is_artificial_)
374 {}
375
376 /// Assignment operator of the location.
377 ///
378 /// @param l the location to assign to the current one.
379 location&
381 {
382 value_ = l.value_;
383 loc_manager_ = l.loc_manager_;
384 is_artificial_ = l.is_artificial_;
385 return *this;
386 }
387
388 /// Default constructor for the @ref location type.
390 : value_(), loc_manager_(), is_artificial_()
391 {}
392
393 /// Get the value of the location.
394 unsigned
395 get_value() const
396 {return value_;}
397
398 /// Convert the location into a boolean.
399 ///
400 /// @return true iff the value of the location is different from
401 /// zero.
402 operator bool() const
403 {return !!value_;}
404
405 /// Equality operator of the @ref location type.
406 ///
407 /// @param other the other location to compare against.
408 ///
409 /// @return true iff both locations are equal.
410 bool
411 operator==(const location &other) const
412 {return value_ == other.value_;}
413
414 /// "Less than" operator of the @ref location type.
415 ///
416 /// @parm other the other location type to compare against.
417 ///
418 /// @return true iff the current instance is less than the @p other
419 /// one.
420 bool
421 operator<(const location &other) const
422 {return value_ < other.value_;}
423
424 /// Expand the current location into a tripplet file path, line and
425 /// column number.
426 ///
427 /// @param path the output parameter this function sets the expanded
428 /// path to.
429 ///
430 /// @param line the output parameter this function sets the expanded
431 /// line number to.
432 ///
433 /// @param column the output parameter this function sets the
434 /// expanded column number to.
435 void
436 expand(std::string& path, unsigned& line, unsigned& column) const;
437
438 string
439 expand(void) const;
440
441 friend class location_manager;
442}; // end class location
443
444/// @brief The entry point to manage locations.
445///
446/// This type keeps a table of all the locations for tokens of a
447/// given translation unit.
449{
450 struct priv;
451 std::unique_ptr<priv> priv_;
452
453public:
454
456
458
460 create_new_location(const std::string& fle, size_t lne, size_t col);
461
462 void
463 expand_location(const location& location, std::string& path,
464 unsigned& line, unsigned& column) const;
465};
466
467/// The base of an entity of the intermediate representation that is
468/// to be traversed.
470{
471 /// Traverse a given IR node and its children, calling an visitor on
472 /// each node.
473 ///
474 /// @param v the visitor to call on each traversed node.
475 ///
476 /// @return true if the all the IR node tree was traversed.
477 virtual bool
479}; // end class ir_traversable_base
480
481/// The comparison functor for using instances of @ref
482/// type_or_decl_base as values in a hash map or set.
484{
485
486 /// The function-call operator to compare the string representations
487 /// of two ABI artifacts.
488 ///
489 /// @param l the left hand side ABI artifact operand of the
490 /// comparison.
491 ///
492 /// @param r the right hand side ABI artifact operand of the
493 /// comparison.
494 ///
495 /// @return true iff the string representation of @p l equals the one
496 /// of @p r.
497 bool
499 {
500 string repr1 = get_pretty_representation(l);
501 string repr2 = get_pretty_representation(r);
502
503 return repr1 == repr2;
504 }
505
506 /// The function-call operator to compare the string representations
507 /// of two ABI artifacts.
508 ///
509 /// @param l the left hand side ABI artifact operand of the
510 /// comparison.
511 ///
512 /// @param r the right hand side ABI artifact operand of the
513 /// comparison.
514 ///
515 /// @return true iff the string representation of @p l equals the one
516 /// of @p r.
517 bool
519 const type_or_decl_base_sptr &r) const
520 {return operator()(l.get(), r.get());}
521}; // end type_or_decl_equal
522
523/// The hashing functor for using instances of @ref type_or_decl_base
524/// as values in a hash map or set.
526{
527
528 /// Function-call Operator to hash the string representation of an
529 /// ABI artifact.
530 ///
531 /// @param artifact the ABI artifact to hash.
532 ///
533 /// @return the hash value of the string representation of @p
534 /// artifact.
535 size_t
536 operator()(const type_or_decl_base *artifact) const
537 {
538 string repr = get_pretty_representation(artifact);
539 std::hash<string> do_hash;
540 return do_hash(repr);
541 }
542
543 /// Function-call Operator to hash the string representation of an
544 /// ABI artifact.
545 ///
546 /// @param artifact the ABI artifact to hash.
547 ///
548 /// @return the hash value of the string representation of @p
549 /// artifact.
550 size_t
551 operator()(const type_or_decl_base_sptr& artifact) const
552 {return operator()(artifact.get());}
553}; // end struct type_or_decl_hash
554
555
556/// A convenience typedef for a hash set of type_or_decl_base_sptr
557typedef unordered_set<type_or_decl_base_sptr,
560
561/// A convenience typedef for a hash set of const type_or_decl_base*
562typedef unordered_set<const type_or_decl_base*,
565
566/// A convenience typedef for a map which key is a string and which
567/// value is a @ref type_base_wptr.
568typedef unordered_map<string, type_base_wptr> string_type_base_wptr_map_type;
569
570/// A convenience typedef for a map which key is a string and which
571/// value is a @ref type_base_sptr.
572typedef unordered_map<string, type_base_sptr> string_type_base_sptr_map_type;
573
574/// A convenience typedef for a map which key is an @ref
575/// interned_string and which value is a @ref type_base_wptr.
576typedef unordered_map<interned_string, type_base_wptr, hash_interned_string>
578
579/// A convenience typedef for a map which key is an @ref
580/// interned_string and which value is a @ref type_base_wptr.
581typedef unordered_map<interned_string,
585
586typedef unordered_map<interned_string,
587 const function_decl*,
588 hash_interned_string> istring_function_decl_ptr_map_type;
589
590typedef unordered_map<interned_string,
592 hash_interned_string> istring_var_decl_ptr_map_type;
593
594/// This is a type that aggregates maps of all the kinds of types that
595/// are supported by libabigail.
596///
597/// For instance, the type_maps contains a map of string to basic
598/// type, a map of string to class type, a map of string to union
599/// types, etc. The key of a map entry is the pretty representation
600/// of the type, and the value of the map entry is the type.
602{
603 struct priv;
604 std::unique_ptr<priv> priv_;
605
606public:
607
608 type_maps();
609
610 ~type_maps();
611
612 bool
613 empty() const;
614
616 basic_types() const;
617
619 basic_types();
620
622 class_types() const;
623
625 class_types();
626
628 union_types();
629
631 union_types() const;
632
634 enum_types();
635
637 enum_types() const;
638
641
643 typedef_types() const;
644
647
649 qualified_types() const;
650
653
655 pointer_types() const;
656
659
661 ptr_to_mbr_types() const;
662
665
667 reference_types() const;
668
670 array_types();
671
673 array_types() const;
674
676 subrange_types() const;
677
680
683
685 function_types() const;
686
687 const vector<type_base_wptr>&
689}; // end class type_maps;
690
691/// This is the abstraction of the set of relevant artefacts (types,
692/// variable declarations, functions, templates, etc) bundled together
693/// into a translation unit.
695{
696 struct priv;
697 std::unique_ptr<priv> priv_;
698
699 // Forbidden
700 translation_unit() = delete;
701
702public:
703 /// Convenience typedef for a shared pointer on a @ref global_scope.
704 typedef shared_ptr<scope_decl> global_scope_sptr;
705
706 /// The language of the translation unit.
708 {
709 LANG_UNKNOWN = 0,
710 LANG_Cobol74,
711 LANG_Cobol85,
712 LANG_C89,
713 LANG_C99,
714 LANG_C11,
715 LANG_C17,
716 LANG_C23,
717 LANG_C,
718 LANG_C_plus_plus_03,
719 LANG_C_plus_plus_11,
720 LANG_C_plus_plus_14,
721 LANG_C_plus_plus_17,
722 LANG_C_plus_plus_20,
723 LANG_C_plus_plus_23,
724 LANG_C_plus_plus,
725 LANG_ObjC,
726 LANG_ObjC_plus_plus,
727 LANG_OCaml,
728 LANG_D,
729 LANG_Go,
730 LANG_Rust,
731 LANG_Zig,
732 LANG_Metal,
733 LANG_Fortran77,
734 LANG_Fortran90,
735 LANG_Fortran95,
736 LANG_Fortran18,
737 LANG_Fortran23,
738 LANG_Ada83,
739 LANG_Ada95,
740 LANG_Ada2005,
741 LANG_Ada2012,
742 LANG_Pascal83,
743 LANG_Modula2,
744 LANG_Java,
745 LANG_Kotlin,
746 LANG_C_sharp,
747 LANG_Python,
748 LANG_Ruby,
749 LANG_PLI,
750 LANG_UPC,
751 LANG_Mips_Assembler,
752 LANG_Assembly,
753 LANG_Crystal,
754 LANG_HIP,
755 LANG_Mojo,
756 LANG_GLSL,
757 LANG_GLSL_ES,
758 LANG_HLSL,
759 LANG_OpenCL_CPP,
760 LANG_CPP_for_OpenCL,
761 LANG_SYCL,
762 LANG_Odin,
763 LANG_P4,
764 LANG_Move,
765 LANG_Hylo
766 };
767
768public:
770 const std::string& path,
771 char address_size = 0);
772
773 virtual ~translation_unit();
774
775 const environment&
776 get_environment() const;
777
779 get_language() const;
780
781 void
783
784 const std::string&
785 get_path() const;
786
787 void
788 set_path(const string&);
789
790 const std::string&
792
793 void
794 set_compilation_dir_path(const std::string&);
795
796 const std::string&
797 get_absolute_path() const;
798
799 void
801
802 const corpus*
803 get_corpus() const;
804
805 corpus*
806 get_corpus();
807
808 const scope_decl_sptr&
809 get_global_scope() const;
810
813
814 const type_maps&
815 get_types() const;
816
817 type_maps&
818 get_types();
819
820 const vector<function_type_sptr>&
821 get_live_fn_types() const;
822
824 get_loc_mgr();
825
826 const location_manager&
827 get_loc_mgr() const;
828
829 bool
830 is_empty() const;
831
832 char
833 get_address_size() const;
834
835 void
836 set_address_size(char);
837
838 bool
839 is_constructed() const;
840
841 void
842 set_is_constructed(bool);
843
844 bool
845 operator==(const translation_unit&) const;
846
847 bool
848 operator!=(const translation_unit&) const;
849
850 void
852
853 virtual bool
855
856 friend function_type_sptr
857 lookup_function_type_in_translation_unit(const function_type& t,
858 const translation_unit& tu);
859
860 friend function_type_sptr
862 translation_unit& tu);
863
864 friend type_base_sptr
865 synthesize_type_from_translation_unit(const type_base_sptr& type,
866 translation_unit& tu);
867};//end class translation_unit
868
869/// A comparison functor to compare translation units based on their
870/// absolute paths.
872{
873 /// Compare two translations units based on their absolute paths.
874 ///
875 /// @param lhs the first translation unit to consider for the
876 /// comparison.
877 ///
878 /// @param rhs the second translatin unit to consider for the
879 /// comparison.
880 bool
882 const translation_unit_sptr& rhs) const
883 {return lhs->get_absolute_path() < rhs->get_absolute_path();}
884}; // end struct shared_translation_unit_comp
885
886/// Convenience typedef for an ordered set of @ref
887/// translation_unit_sptr.
888typedef std::set<translation_unit_sptr,
890
891string
893
896
897bool
899
900bool
902
903bool
905
906bool
908
909bool
911
912bool
914
915/// Access specifier for class members.
917{
918 no_access,
919 public_access,
920 protected_access,
921 private_access,
922};
923
924class elf_symbol;
925/// A convenience typedef for a shared pointer to elf_symbol.
926typedef shared_ptr<elf_symbol> elf_symbol_sptr;
927
928/// A convenience typedef for a weak pointer to elf_symbol.
929typedef weak_ptr<elf_symbol> elf_symbol_wptr;
930
931/// Convenience typedef for a map which key is a string and which
932/// value if the elf symbol of the same name.
933typedef std::unordered_map<string, elf_symbol_sptr>
935
936/// Convenience typedef for a shared pointer to an
937/// string_elf_symbol_sptr_map_type.
938typedef shared_ptr<string_elf_symbol_sptr_map_type>
940
941/// Convenience typedef for a vector of elf_symbol
942typedef std::vector<elf_symbol_sptr> elf_symbols;
943
944/// Convenience typedef for a map which key is a string and which
945/// value is a vector of elf_symbol.
946typedef std::unordered_map<string, elf_symbols>
948
949/// Convenience typedef for a shared pointer to
950/// string_elf_symbols_map_type.
951typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
952
953/// Abstraction of an elf symbol.
954///
955/// This is useful when a given corpus has been read from an ELF file.
956/// In that case, a given decl might be associated to its underlying
957/// ELF symbol, if that decl is publicly exported in the ELF file. In
958/// that case, comparing decls might involve comparing their
959/// underlying symbols as well.
961{
962public:
963 /// The type of a symbol.
964 enum type
965 {
966 NOTYPE_TYPE = 0,
967 OBJECT_TYPE,
968 FUNC_TYPE,
969 SECTION_TYPE,
970 FILE_TYPE,
971 COMMON_TYPE,
972 TLS_TYPE,
973 GNU_IFUNC_TYPE
974 };
975
976 /// The binding of a symbol.
978 {
979 LOCAL_BINDING = 0,
980 GLOBAL_BINDING,
981 WEAK_BINDING,
982 GNU_UNIQUE_BINDING
983 };
984
985 /// The visibility of the symbol.
987 {
988 DEFAULT_VISIBILITY,
989 PROTECTED_VISIBILITY,
990 HIDDEN_VISIBILITY,
991 INTERNAL_VISIBILITY,
992 };
993
994 /// Inject the elf_symbol::version here.
995 class version;
996
997private:
998 struct priv;
999 std::unique_ptr<priv> priv_;
1000
1001 elf_symbol();
1002
1003 elf_symbol(const environment& e,
1004 size_t i,
1005 size_t s,
1006 const string& n,
1007 type t,
1008 binding b,
1009 bool d,
1010 bool c,
1011 const version& ve,
1012 visibility vi,
1013 bool is_in_ksymtab = false,
1014 const abg_compat::optional<uint32_t>& crc = {},
1015 const abg_compat::optional<std::string>& ns = {},
1016 bool is_suppressed = false);
1017
1018 elf_symbol(const elf_symbol&);
1019
1020 elf_symbol&
1021 operator=(const elf_symbol& s);
1022
1023public:
1024
1025 static elf_symbol_sptr
1026 create(const environment& e,
1027 size_t i,
1028 size_t s,
1029 const string& n,
1030 type t,
1031 binding b,
1032 bool d,
1033 bool c,
1034 const version& ve,
1035 visibility vi,
1036 bool is_in_ksymtab = false,
1037 const abg_compat::optional<uint32_t>& crc = {},
1038 const abg_compat::optional<std::string>& ns = {},
1039 bool is_suppressed = false);
1040
1041 const environment&
1042 get_environment() const;
1043
1044 size_t
1045 get_index() const;
1046
1047 void
1048 set_index(size_t);
1049
1050 const string&
1051 get_name() const;
1052
1053 void
1054 set_name(const string& n);
1055
1056 type
1057 get_type() const;
1058
1059 void
1060 set_type(type t);
1061
1062 size_t
1063 get_size() const;
1064
1065 void
1066 set_size(size_t);
1067
1068 binding
1069 get_binding() const;
1070
1071 void
1073
1074 version&
1075 get_version() const;
1076
1077 void
1078 set_version(const version& v);
1079
1080 void
1082
1084 get_visibility() const;
1085
1086 bool
1087 is_defined() const;
1088
1089 void
1090 is_defined(bool d);
1091
1092 bool
1093 is_public() const;
1094
1095 bool
1096 is_function() const;
1097
1098 bool
1099 is_variable() const;
1100
1101 bool
1102 is_in_ksymtab() const;
1103
1104 void
1106
1108 get_crc() const;
1109
1110 void
1112
1114 get_namespace() const;
1115
1116 void
1118
1119 bool
1120 is_suppressed() const;
1121
1122 void
1124
1125 const elf_symbol_sptr
1126 get_main_symbol() const;
1127
1130
1131 bool
1132 is_main_symbol() const;
1133
1135 update_main_symbol(const std::string&);
1136
1138 get_next_alias() const;
1139
1140 bool
1141 has_aliases() const;
1142
1143 int
1144 get_number_of_aliases() const;
1145
1146 void
1147 add_alias(const elf_symbol_sptr&);
1148
1149 bool
1150 is_common_symbol() const;
1151
1152 bool
1154
1157
1158 void
1160
1161 const string&
1162 get_id_string() const;
1163
1165 get_alias_from_name(const string& name) const;
1166
1168 get_alias_which_equals(const elf_symbol& other) const;
1169
1171 get_alias_with_default_symbol_version() const;
1172
1173 string
1175 bool include_symbol_itself = true) const;
1176
1177 string
1178 get_aliases_id_string(bool include_symbol_itself = true) const;
1179
1180 static bool
1181 get_name_and_version_from_id(const string& id,
1182 string& name,
1183 string& ver);
1184
1185 bool
1186 operator==(const elf_symbol&) const;
1187
1188 bool
1189 does_alias(const elf_symbol&) const;
1190}; // end class elf_symbol.
1191
1192std::ostream&
1193operator<<(std::ostream& o, elf_symbol::type t);
1194
1195std::ostream&
1196operator<<(std::ostream& o, elf_symbol::binding t);
1197
1198std::ostream&
1199operator<<(std::ostream& o, elf_symbol::visibility t);
1200
1201bool
1203
1204bool
1206
1207bool
1209
1210bool
1212
1213bool
1215
1216bool
1217operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1218
1219bool
1220operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1221
1222bool
1223elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1224
1225void
1226compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1227 const string_elf_symbols_map_type& symtab,
1228 vector<elf_symbol_sptr>& alias_set);
1229
1230/// The abstraction of the version of an ELF symbol.
1232{
1233 struct priv;
1234 std::unique_ptr<priv> priv_;
1235
1236public:
1237 version();
1238
1239 version(const string& v,
1240 bool is_default);
1241
1242 version(const version& v);
1243
1244 ~version();
1245
1246 operator const string&() const;
1247
1248 const string&
1249 str() const;
1250
1251 void
1252 str(const string& s);
1253
1254 bool
1255 is_default() const;
1256
1257 void
1258 is_default(bool f);
1259
1260 bool
1261 is_empty() const;
1262
1263 bool
1264 operator==(const version& o) const;
1265
1266 bool
1267 operator!=(const version& o) const;
1268
1269 version&
1270 operator=(const version& o);
1271};// end class elf_symbol::version
1272
1273class context_rel;
1274/// A convenience typedef for shared pointers to @ref context_rel
1275typedef shared_ptr<context_rel> context_rel_sptr;
1276
1277/// The abstraction of the relationship between an entity and its
1278/// containing scope (its context). That relationship can carry
1279/// properties like access rights (if the parent is a class_decl),
1280/// etc.
1281///
1282/// But importantly, this relationship carries a pointer to the
1283/// actualy parent.
1285{
1286protected:
1287 scope_decl* scope_;
1288 enum access_specifier access_;
1289 bool is_static_;
1290
1291public:
1292 context_rel()
1293 : scope_(0),
1294 access_(no_access),
1295 is_static_(false)
1296 {}
1297
1299 : scope_(s),
1300 access_(no_access),
1301 is_static_(false)
1302 {}
1303
1306 bool f)
1307 : scope_(s),
1308 access_(a),
1309 is_static_(f)
1310 {}
1311
1312 scope_decl*
1313 get_scope() const
1314 {return scope_;}
1315
1317 get_access_specifier() const
1318 {return access_;}
1319
1320 void
1321 set_access_specifier(access_specifier a)
1322 {access_ = a;}
1323
1324 bool
1325 get_is_static() const
1326 {return is_static_;}
1327
1328 void
1329 set_is_static(bool s)
1330 {is_static_ = s;}
1331
1332 void
1333 set_scope(scope_decl* s)
1334 {scope_ = s;}
1335
1336 bool
1337 operator==(const context_rel& o)const
1338 {
1339 return (access_ == o.access_
1340 && is_static_ == o.is_static_);
1341 }
1342
1343 /// Inequality operator.
1344 ///
1345 /// @param o the other instance of @ref context_rel to compare the
1346 /// current instance against.
1347 ///
1348 /// @return true iff the current instance of @ref context_rel is
1349 /// different from @p o.
1350 bool
1351 operator!=(const context_rel& o) const
1352 {return !operator==(o);}
1353
1354 virtual ~context_rel();
1355};// end class context_rel
1356
1357/// A bitfield that gives callers of abigail::ir::equals() some
1358/// insight about how different two internal representation artifacts
1359/// are.
1361{
1362 NO_CHANGE_KIND = 0,
1363
1364 /// This means that a given IR artifact has a local type change.
1366
1367 /// This means that a given IR artifact has a local non-type change.
1368 /// That is a change that is carried by the artifact itself, not by
1369 /// its type.
1371
1372 /// Testing (anding) against this mask means that a given IR artifact has
1373 /// local differences, with respect to the other artifact it was compared
1374 /// against. A local change is a change that is carried by the artifact
1375 /// itself (or its type), rather than by one off its sub-types.
1377
1378 /// This means that a given IR artifact has changes in some of its
1379 /// sub-types, with respect to the other artifact it was compared
1380 /// against.
1382};// end enum change_kind
1383
1386
1389
1392
1395
1396bool
1398 const decl_base& r,
1399 change_kind* k);
1400
1401bool
1402equals(const decl_base&, const decl_base&, change_kind*);
1403
1404/// The base class of both types and declarations.
1406{
1407 struct priv;
1410
1411public:
1412
1413 /// This is a bitmap type which instance is meant to contain the
1414 /// runtime type of a given ABI artifact. Bits of the identifiers
1415 /// of the type of a given artifact as well as the types it inherits
1416 /// from are to be set to 1.
1418 {
1419 ABSTRACT_TYPE_OR_DECL,
1420 ABSTRACT_DECL_BASE = 1,
1421 ABSTRACT_SCOPE_DECL = 1 << 1,
1422 GLOBAL_SCOPE_DECL = 1 << 2,
1423 NAMESPACE_DECL = 1 << 3,
1424 VAR_DECL = 1 << 4,
1425 FUNCTION_DECL = 1 << 5,
1426 FUNCTION_PARAMETER_DECL = 1 << 6,
1427 METHOD_DECL = 1 << 7,
1428 TEMPLATE_DECL = 1 << 8,
1429 ABSTRACT_TYPE_BASE = 1 << 9,
1430 ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1431 BASIC_TYPE = 1 << 11,
1432 SUBRANGE_TYPE = 1 << 12,
1433 QUALIFIED_TYPE = 1 << 13,
1434 POINTER_TYPE = 1 << 14,
1435 REFERENCE_TYPE = 1 << 15,
1436 POINTER_TO_MEMBER_TYPE = 1 << 16,
1437 ARRAY_TYPE = 1 << 17,
1438 ENUM_TYPE = 1 << 18,
1439 TYPEDEF_TYPE = 1 << 19,
1440 CLASS_TYPE = 1 << 20,
1441 UNION_TYPE = 1 << 21,
1442 FUNCTION_TYPE = 1 << 22,
1443 METHOD_TYPE = 1 << 23,
1444 }; // end enum type_or_decl_kind
1445
1447 kind() const;
1448
1449protected:
1450 void
1451 kind(enum type_or_decl_kind);
1452
1453 const void*
1454 runtime_type_instance() const;
1455
1456 void*
1458
1459 void
1460 runtime_type_instance(void*);
1461
1462 const void*
1464
1465 void*
1467
1468 virtual hash_t
1469 hash_value() const;
1470
1471 void
1472 set_hash_value(hash_t) const;
1473
1475 operator=(const type_or_decl_base&);
1476
1477public:
1478 mutable std::unique_ptr<priv> priv_;
1479
1481 enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1482
1483 virtual ~type_or_decl_base();
1484
1485 bool
1486 get_is_artificial() const;
1487
1488 void
1489 set_is_artificial(bool);
1490
1491 const environment&
1492 get_environment() const;
1493
1494 void
1496
1497 location&
1499
1500 bool
1502
1503 const corpus*
1504 get_corpus() const;
1505
1506 corpus*
1507 get_corpus();
1508
1509 void
1511
1512 const translation_unit*
1513 get_translation_unit() const;
1514
1517
1518 virtual bool
1520
1521 virtual string
1522 get_pretty_representation(bool internal = false,
1523 bool qualified_name = true) const = 0;
1524
1528
1532
1536
1540
1541 friend class_decl*
1543
1544 friend type_base*
1545 is_type(const type_or_decl_base*);
1546
1547 friend decl_base*
1548 is_decl(const type_or_decl_base* d);
1549
1550 friend hash_t
1552
1553 template<typename T>
1554 friend hash_t
1555 set_or_get_cached_hash_value(const T& type_or_decl);
1556}; // end class type_or_decl_base
1557
1561
1565
1569
1573
1574bool
1576
1577bool
1579
1580bool
1582
1583/// The base type of all declarations.
1584class decl_base : public virtual type_or_decl_base
1585{
1586 // Forbidden
1587 decl_base();
1588
1589 struct priv;
1590
1591protected:
1592
1593 const interned_string&
1594 peek_qualified_name() const;
1595
1596 void
1598
1599 void
1600 set_qualified_name(const interned_string&) const;
1601
1602 const interned_string&
1604
1605 void
1607
1608public:
1609 // This is public because some internals of the library need to
1610 // update it. But it's opaque to client code anyway, so no big
1611 // deal. Also, it's not handled by a shared_ptr because accessing
1612 // the data members of the priv struct for this decl_base shows up
1613 // on performance profiles when dealing with big binaries with a lot
1614 // of types; dereferencing the shared_ptr involves locking of some
1615 // sort and that is slower than just dereferencing a pointer likere
1616 // here. There are other types for which the priv pointer is
1617 // managed using shared_ptr just fine, because those didn't show up
1618 // during our performance profiling.
1619 priv* priv_;
1620
1621 /// Facility to hash instances of decl_base.
1622 struct hash;
1623
1624 /// ELF visibility
1626 {
1627 VISIBILITY_NONE,
1628 VISIBILITY_DEFAULT,
1629 VISIBILITY_PROTECTED,
1630 VISIBILITY_HIDDEN,
1631 VISIBILITY_INTERNAL
1632 };
1633
1634 /// ELF binding
1636 {
1637 BINDING_NONE,
1638 BINDING_LOCAL,
1639 BINDING_GLOBAL,
1640 BINDING_WEAK
1641 };
1642
1643 virtual void
1645
1646protected:
1647 void
1648 set_context_rel(context_rel *c);
1649 decl_base(const decl_base&);
1650
1651public:
1652 decl_base(const environment& e,
1653 const string& name,
1654 const location& locus,
1655 const string& mangled_name = "",
1656 visibility vis = VISIBILITY_DEFAULT);
1657
1658 decl_base(const environment& e,
1659 const interned_string& name,
1660 const location& locus,
1661 const interned_string& mangled_name = interned_string(),
1662 visibility vis = VISIBILITY_DEFAULT);
1663
1664 decl_base(const environment&, const location&);
1665
1666 const context_rel*
1667 get_context_rel() const;
1668
1671
1672 const interned_string&
1673 get_cached_pretty_representation(bool internal = false) const;
1674
1675 virtual bool
1676 operator==(const decl_base&) const;
1677
1678 virtual bool
1679 operator!=(const decl_base&) const;
1680
1681 virtual bool
1683
1684 virtual ~decl_base();
1685
1686 virtual string
1687 get_pretty_representation(bool internal = false,
1688 bool qualified_name = true) const;
1689
1690 virtual void
1691 get_qualified_name(interned_string& qualified_name,
1692 bool internal = false) const;
1693
1694 virtual const interned_string&
1695 get_qualified_name(bool internal = false) const;
1696
1697 virtual const interned_string&
1698 get_scoped_name() const;
1699
1700 bool
1702
1703 void
1705
1706 const location&
1707 get_location() const;
1708
1709 void
1710 set_location(const location& l);
1711
1712 virtual const interned_string&
1713 get_name() const;
1714
1715 const interned_string&
1717
1718 virtual void
1719 set_name(const string& n);
1720
1721 bool
1722 get_is_anonymous() const;
1723
1724 void
1725 set_is_anonymous(bool);
1726
1727 bool
1729
1730 bool
1732
1734 get_naming_typedef() const;
1735
1736 void
1738
1739 const interned_string&
1740 get_linkage_name() const;
1741
1742 virtual void
1743 set_linkage_name(const string& m);
1744
1745 scope_decl*
1746 get_scope() const;
1747
1749 get_visibility() const;
1750
1751 void
1753
1754 const decl_base_sptr
1756
1757 void
1758 set_earlier_declaration(const decl_base_sptr&);
1759
1760 const decl_base_sptr
1762
1763 void
1764 set_definition_of_declaration(const decl_base_sptr&);
1765
1766 const decl_base*
1768
1769 bool
1771
1772 void
1774
1775 friend bool
1776 equals(const decl_base&, const decl_base&, change_kind*);
1777
1778 friend bool
1779 equals(const var_decl&, const var_decl&, change_kind*);
1780
1781 friend bool
1783
1784 friend bool
1786 const decl_base& r,
1787 change_kind* k);
1788
1789 friend decl_base_sptr
1790 add_decl_to_scope(decl_base_sptr decl, scope_decl* scpe);
1791
1792 friend void
1793 remove_decl_from_scope(decl_base_sptr);
1794
1795 friend decl_base_sptr
1796 insert_decl_into_scope(decl_base_sptr,
1797 vector<shared_ptr<decl_base> >::iterator,
1798 scope_decl*);
1799
1800 friend enum access_specifier
1802
1803 friend enum access_specifier
1804 get_member_access_specifier(const decl_base_sptr& d);
1805
1806 friend void
1809
1810 friend bool
1812
1813 friend bool
1814 get_member_is_static(const decl_base_sptr& d);
1815
1816 friend void
1817 set_member_is_static(const decl_base_sptr& d, bool s);
1818
1819 friend void
1820 set_member_is_static(decl_base& d, bool s);
1821
1822 friend bool
1824
1825 friend class class_or_union;
1826 friend class class_decl;
1827 friend class scope_decl;
1828};// end class decl_base
1829
1830bool
1831operator==(const decl_base_sptr&, const decl_base_sptr&);
1832
1833bool
1834operator!=(const decl_base_sptr&, const decl_base_sptr&);
1835
1836bool
1837operator==(const type_base_sptr&, const type_base_sptr&);
1838
1839bool
1840operator!=(const type_base_sptr&, const type_base_sptr&);
1841
1842std::ostream&
1843operator<<(std::ostream&, decl_base::visibility);
1844
1845std::ostream&
1846operator<<(std::ostream&, decl_base::binding);
1847
1848bool
1849equals(const scope_decl&, const scope_decl&, change_kind*);
1850
1851/// A declaration that introduces a scope.
1852class scope_decl : public virtual decl_base
1853{
1854 struct priv;
1855 std::unique_ptr<priv> priv_;
1856
1857public:
1858
1859 /// Convenience typedef for a vector of @ref decl_base_sptr.
1860 typedef std::vector<decl_base_sptr > declarations;
1861 /// Convenience typedef for a vector of @ref function_type_sptr.
1862 typedef std::vector<function_type_sptr > function_types;
1863 /// Convenience typedef for a vector of @ref scope_decl_sptr.
1864 typedef std::vector<scope_decl_sptr> scopes;
1865
1866 scope_decl();
1867
1868protected:
1869 virtual decl_base_sptr
1870 add_member_decl(const decl_base_sptr& member);
1871
1872 decl_base_sptr
1873 insert_member_decl(decl_base_sptr member, declarations::iterator before);
1874
1875 virtual void
1876 remove_member_decl(decl_base_sptr member);
1877
1878public:
1879
1880 scope_decl(const environment& env,
1881 const string& name, const location& locus,
1882 visibility vis = VISIBILITY_DEFAULT);
1883
1884 scope_decl(const environment& env, location& l);
1885
1886 virtual bool
1887 operator==(const decl_base&) const;
1888
1890 get_canonical_types() const;
1891
1894
1897
1898 const declarations&
1899 get_member_decls() const;
1900
1903
1904 const declarations&
1906
1907 virtual size_t
1909
1910 virtual size_t
1912
1913 virtual size_t
1915
1916 scopes&
1918
1919 const scopes&
1920 get_member_scopes() const;
1921
1922 bool
1923 is_empty() const;
1924
1925 bool
1926 find_iterator_for_member(const decl_base*, declarations::iterator&);
1927
1928 bool
1929 find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1930
1931 void
1932 insert_member_type(type_base_sptr t,
1933 declarations::iterator before);
1934
1935 void
1936 add_member_type(type_base_sptr t);
1937
1938 type_base_sptr
1939 add_member_type(type_base_sptr t, access_specifier a);
1940
1941 void
1942 remove_member_type(type_base_sptr t);
1943
1945 get_member_types() const;
1946
1949
1950 type_base_sptr
1951 find_member_type(const string& name) const;
1952
1953 virtual bool
1955
1956 virtual ~scope_decl();
1957
1958 friend decl_base_sptr
1959 add_decl_to_scope(decl_base_sptr decl, scope_decl* scope);
1960
1961 friend decl_base_sptr
1962 insert_decl_into_scope(decl_base_sptr decl,
1963 scope_decl::declarations::iterator before,
1964 scope_decl* scope);
1965
1966 friend void
1967 remove_decl_from_scope(decl_base_sptr decl);
1968};//end class scope_decl
1969
1970bool
1972
1973bool
1975
1976/// This abstracts the global scope of a given translation unit.
1977///
1978/// Only one instance of this class must be present in a given
1979/// translation_unit. That instance is implicitely created the first
1980/// time translatin_unit::get_global_scope is invoked.
1982{
1983 translation_unit* translation_unit_;
1984
1986
1987public:
1988
1989 friend class translation_unit;
1990
1992 get_translation_unit() const
1993 {return translation_unit_;}
1994
1995 virtual ~global_scope();
1996};
1997
1998bool
1999equals(const type_base&, const type_base&, change_kind*);
2000
2001/// An abstraction helper for type declarations
2002class type_base : public virtual type_or_decl_base
2003{
2004 struct priv;
2005
2006public:
2007 // This priv pointer is not handled by a shared_ptr because
2008 // accessing the data members of the priv struct for this type_base
2009 // shows up on performance profiles when dealing with big binaries
2010 // with a lot of types; dereferencing the shared_ptr involves
2011 // locking of some sort and that is slower than just dereferencing a
2012 // pointer likere here. There are other types for which the priv
2013 // pointer is managed using shared_ptr just fine, because those
2014 // didn't show up during our performance profiling.
2015 priv* priv_;
2016
2017private:
2018 // Forbid this.
2019 type_base();
2020
2021 static type_base_sptr
2022 get_canonical_type_for(type_base_sptr);
2023
2024protected:
2025 virtual void
2027
2028public:
2029
2030 struct hash;
2031
2032 type_base(const environment& e, size_t s, size_t a);
2033
2034 virtual hash_t
2035 hash_value() const;
2036
2037 friend type_base_sptr canonicalize(type_base_sptr, bool, bool);
2038
2039 type_base_sptr
2040 get_canonical_type() const;
2041
2042 type_base*
2044
2045 const interned_string&
2046 get_cached_pretty_representation(bool internal = false) const;
2047
2048 virtual bool
2049 operator==(const type_base&) const;
2050
2051 virtual bool
2052 operator!=(const type_base&) const;
2053
2054 virtual bool
2056
2057 virtual ~type_base();
2058
2059 virtual void
2060 set_size_in_bits(size_t);
2061
2062 virtual size_t
2063 get_size_in_bits() const;
2064
2065 virtual void
2066 set_alignment_in_bits(size_t);
2067
2068 virtual size_t
2069 get_alignment_in_bits() const;
2070};//end class type_base
2071
2072
2073/// A predicate for deep equality of instances of
2074/// type_base*
2076{
2077 bool
2078 operator()(const type_base* l, const type_base* r) const
2079 {
2080 if (!!l != !!r)
2081 return false;
2082
2083 if (l == r)
2084 return true;
2085
2086 if (l)
2087 return *l == *r;
2088
2089 return true;
2090 }
2091};
2092
2093/// A predicate for deep equality of instances of
2094/// shared_ptr<type_base>
2096{
2097 bool
2098 operator()(const type_base_sptr l, const type_base_sptr r) const
2099 {
2100 if (!!l != !!r)
2101 return false;
2102
2103 if (l.get() == r.get())
2104 return true;
2105
2106 if (l)
2107 return *l == *r;
2108
2109 return true;
2110 }
2111};
2112
2113bool
2114equals(const type_decl&, const type_decl&, change_kind*);
2115
2116/// A basic type declaration that introduces no scope.
2117class type_decl : public virtual decl_base, public virtual type_base
2118{
2119 // Forbidden.
2120 type_decl();
2121
2122public:
2123
2124 /// Facility to hash instance of type_decl
2125 struct hash;
2126
2127 type_decl(const environment& env,
2128 const string& name,
2129 size_t size_in_bits,
2130 size_t alignment_in_bits,
2131 const location& locus,
2132 const string& mangled_name = "",
2133 visibility vis = VISIBILITY_DEFAULT);
2134
2135 virtual hash_t
2136 hash_value() const;
2137
2138 virtual bool
2139 operator==(const type_base&) const;
2140
2141 virtual bool
2142 operator==(const decl_base&) const;
2143
2144 virtual bool
2145 operator==(const type_decl&) const;
2146
2147 virtual bool
2148 operator!=(const type_base&)const;
2149
2150 virtual bool
2151 operator!=(const decl_base&)const;
2152
2153 virtual bool
2154 operator!=(const type_decl&)const;
2155
2156 virtual void
2157 get_qualified_name(interned_string& qualified_name,
2158 bool internal = false) const;
2159
2160 virtual const interned_string&
2161 get_qualified_name(bool internal = false) const;
2162
2163 virtual string
2164 get_pretty_representation(bool internal = false,
2165 bool qualified_name = true) const;
2166
2167 virtual bool
2169
2170 virtual ~type_decl();
2171};// end class type_decl.
2172
2173bool
2175
2176bool
2178
2179bool
2181
2182/// A type that introduces a scope.
2183class scope_type_decl : public scope_decl, public virtual type_base
2184{
2186
2187public:
2188
2189 scope_type_decl(const environment& env, const string& name,
2190 size_t size_in_bits, size_t alignment_in_bits,
2191 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2192
2193 virtual bool
2194 operator==(const decl_base&) const;
2195
2196 virtual bool
2197 operator==(const type_base&) const;
2198
2199 virtual bool
2201
2202 virtual ~scope_type_decl();
2203};
2204
2205/// The abstraction of a namespace declaration
2207{
2208public:
2209
2210 namespace_decl(const environment& env, const string& name,
2211 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2212
2213 virtual string
2214 get_pretty_representation(bool internal = false,
2215 bool qualified_name = true) const;
2216
2217 virtual bool
2218 operator==(const decl_base&) const;
2219
2220 virtual bool
2222
2223 virtual ~namespace_decl();
2224
2226};// end class namespace_decl
2227
2228/// A convenience typedef for vectors of @ref namespace_decl_sptr
2229typedef vector<namespace_decl_sptr> namespaces_type;
2230
2231bool
2233
2234/// The abstraction of a qualified type.
2235class qualified_type_def : public virtual type_base, public virtual decl_base
2236{
2237 class priv;
2238 std::unique_ptr<priv> priv_;
2239
2240 // Forbidden.
2242
2243protected:
2244 string build_name(bool, bool internal = false) const;
2245 virtual void on_canonical_type_set();
2246
2247public:
2248
2249 /// A Hasher for instances of qualified_type_def
2250 struct hash;
2251
2252 /// Bit field values representing the cv qualifiers of the
2253 /// underlying type.
2254 enum CV
2255 {
2256 CV_NONE = 0,
2257 CV_CONST = 1,
2258 CV_VOLATILE = 1 << 1,
2259 CV_RESTRICT = 1 << 2
2260 };
2261
2262 qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2263
2264 qualified_type_def(const environment& env, CV quals, const location& locus);
2265
2266 virtual hash_t
2267 hash_value() const;
2268
2269 virtual size_t
2270 get_size_in_bits() const;
2271
2272 virtual bool
2273 operator==(const decl_base&) const;
2274
2275 virtual bool
2276 operator==(const type_base&) const;
2277
2278 virtual bool
2279 operator==(const qualified_type_def&) const;
2280
2281 CV
2282 get_cv_quals() const;
2283
2284 void
2285 set_cv_quals(CV cv_quals);
2286
2287 string
2289
2290 type_base_sptr
2291 get_underlying_type() const;
2292
2293 void
2294 set_underlying_type(const type_base_sptr&);
2295
2296 virtual void
2297 get_qualified_name(interned_string& qualified_name,
2298 bool internal = false) const;
2299
2300 virtual const interned_string&
2301 get_qualified_name(bool internal = false) const;
2302
2303 virtual bool
2305
2306 virtual ~qualified_type_def();
2307}; // end class qualified_type_def.
2308
2309bool
2310operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2311
2312bool
2313operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2314
2317
2320
2323
2326
2329
2330std::ostream&
2331operator<<(std::ostream&, qualified_type_def::CV);
2332
2333string
2335
2337get_name_of_qualified_type(const type_base_sptr& underlying_type,
2339 bool qualified = true, bool internal = false);
2340
2341qualified_type_def_sptr
2342lookup_qualified_type(const type_base_sptr&,
2344 const translation_unit&);
2345bool
2347
2348/// The abstraction of a pointer type.
2349class pointer_type_def : public virtual type_base, public virtual decl_base
2350{
2351 struct priv;
2352 std::unique_ptr<priv> priv_;
2353
2354 // Forbidden.
2356
2357protected:
2358 virtual void on_canonical_type_set();
2359
2360public:
2361
2362 /// A hasher for instances of pointer_type_def
2363 struct hash;
2364
2365 pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2366 size_t alignment_in_bits, const location& locus);
2367
2368 pointer_type_def(const environment& env, size_t size_in_bits,
2369 size_t alignment_in_bits, const location& locus);
2370
2371 virtual hash_t
2372 hash_value() const;
2373
2374 void
2375 set_pointed_to_type(const type_base_sptr&);
2376
2377 virtual bool
2378 operator==(const decl_base&) const;
2379
2380 virtual bool
2381 operator==(const type_base&) const;
2382
2383 bool
2384 operator==(const pointer_type_def&) const;
2385
2386 const type_base_sptr
2387 get_pointed_to_type() const;
2388
2389 type_base*
2391
2392 virtual void
2393 get_qualified_name(interned_string&, bool internal = false) const;
2394
2395 virtual const interned_string&
2396 get_qualified_name(bool internal = false) const;
2397
2398 virtual bool
2400
2401 virtual ~pointer_type_def();
2402}; // end class pointer_type_def
2403
2404bool
2406
2407bool
2409
2410bool
2412
2413
2414/// Abstracts a reference type.
2415class reference_type_def : public virtual type_base, public virtual decl_base
2416{
2417 struct priv;
2418 std::unique_ptr<priv> priv_;
2419
2420 // Forbidden.
2422
2423protected:
2424 virtual void on_canonical_type_set();
2425
2426public:
2427
2428 /// Hasher for intances of reference_type_def.
2429 struct hash;
2430
2431 reference_type_def(const type_base_sptr pointed_to_type,
2432 bool lvalue, size_t size_in_bits,
2433 size_t alignment_in_bits, const location& locus);
2434
2435 reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2436 size_t alignment_in_bits, const location& locus);
2437
2438 virtual hash_t
2439 hash_value() const;
2440
2441 void
2442 set_pointed_to_type(type_base_sptr& pointed_to_type);
2443
2444 virtual bool
2445 operator==(const decl_base&) const;
2446
2447 virtual bool
2448 operator==(const type_base&) const;
2449
2450 bool
2451 operator==(const reference_type_def&) const;
2452
2453 type_base_sptr
2454 get_pointed_to_type() const;
2455
2456 bool
2457 is_lvalue() const;
2458
2459 virtual void
2460 get_qualified_name(interned_string& qualified_name,
2461 bool internal = false) const;
2462
2463 virtual const interned_string&
2464 get_qualified_name(bool internal = false) const;
2465
2466 virtual string
2467 get_pretty_representation(bool internal = false,
2468 bool qualified_name = true) const;
2469
2470 virtual bool
2472
2473 virtual ~reference_type_def();
2474}; // end class reference_type_def
2475
2476bool
2478
2479bool
2481
2482/// The abstraction of a pointer-to-member type.
2483class ptr_to_mbr_type : public virtual type_base,
2484 public virtual decl_base
2485{
2486 struct priv;
2487 std::unique_ptr<priv> priv_;
2488
2489 // Forbidden
2490 ptr_to_mbr_type() = delete;
2491
2492 public:
2493
2494 /// Hasher for instances of @ref ptr_to_mbr_type;
2495 struct hash;
2496
2497 ptr_to_mbr_type(const environment& env,
2498 const type_base_sptr& member_type,
2499 const type_base_sptr& containing_type,
2500 size_t size_in_bits,
2501 size_t alignment_in_bits,
2502 const location& locus);
2503
2504 virtual const interned_string&
2505 get_name() const;
2506
2507 virtual hash_t
2508 hash_value() const;
2509
2510 const type_base_sptr&
2511 get_member_type() const;
2512
2513 const type_base_sptr&
2514 get_containing_type() const;
2515
2516 bool
2517 operator==(const ptr_to_mbr_type&) const;
2518
2519 virtual bool
2520 operator==(const type_base&) const;
2521
2522 virtual bool
2523 operator==(const decl_base&) const;
2524
2525 virtual void
2526 get_qualified_name(interned_string& qualified_name,
2527 bool internal = false) const;
2528
2529 virtual const interned_string&
2530 get_qualified_name(bool internal = false) const;
2531
2532 virtual bool
2534
2535 virtual ~ptr_to_mbr_type();
2536}; // end class ptr_to_mbr_type
2537
2538bool
2539equals(const ptr_to_mbr_type&,
2540 const ptr_to_mbr_type&,
2541 change_kind*);
2542
2543bool
2545
2546/// The abstraction of an array type.
2547class array_type_def : public virtual type_base, public virtual decl_base
2548{
2549 struct priv;
2550 std::unique_ptr<priv> priv_;
2551
2552 // Forbidden.
2554
2555 void update_size();
2556
2557public:
2558
2559 /// Hasher for intances of array_type_def.
2560 struct hash;
2561
2562 class subrange_type;
2563
2564 /// Convenience typedef for a shared pointer on a @ref
2565 /// function_decl::subrange
2566 typedef shared_ptr<subrange_type> subrange_sptr;
2567
2568 /// Convenience typedef for a vector of @ref subrange_sptr
2569 typedef std::vector<subrange_sptr> subranges_type;
2570
2571 /// Abstraction for an array range type, like in Ada, or just for an
2572 /// array dimension like in C or C++.
2573 class subrange_type : public virtual type_base, public virtual decl_base
2574 {
2575 struct priv;
2576 std::unique_ptr<priv> priv_;
2577
2578 // Forbidden.
2579 subrange_type();
2580 public:
2581
2582 virtual ~subrange_type();
2583 /// This class is to hold the value of the bound of a subrange.
2584 /// The value can be either signed or unsigned, at least when it
2585 /// comes from DWARF. The class keeps the sign information, but
2586 /// allows users to access the value as signed or unsigned as they
2587 /// see fit.
2589 {
2590 public:
2591 enum signedness
2592 {
2593 UNSIGNED_SIGNEDNESS,
2594 SIGNED_SIGNEDNESS
2595 };
2596
2597 private:
2598 signedness s_;
2599
2600 public:
2601 union
2602 {
2603 uint64_t unsigned_;
2604 int64_t signed_;
2605 } v_;
2606 bound_value();
2607 bound_value(uint64_t);
2608 bound_value(int64_t);
2609 enum signedness get_signedness() const;
2610 void set_signedness(enum signedness s);
2611 int64_t get_signed_value() const;
2612 uint64_t get_unsigned_value();
2613 void set_unsigned(uint64_t v);
2614 void set_signed(int64_t v);
2615 bool operator==(const bound_value&) const;
2616 }; //end class bound_value
2617
2618 /// Hasher for an instance of array::subrange
2619 struct hash;
2620
2621 subrange_type(const environment& env,
2622 const string& name,
2623 bound_value lower_bound,
2624 bound_value upper_bound,
2625 const type_base_sptr& underlying_type,
2626 const location& loc,
2627 translation_unit::language l = translation_unit::LANG_C11);
2628
2629 subrange_type(const environment& env,
2630 const string& name,
2631 bound_value lower_bound,
2632 bound_value upper_bound,
2633 const location& loc,
2634 translation_unit::language l = translation_unit::LANG_C11);
2635
2636 subrange_type(const environment& env,
2637 const string& name,
2638 bound_value upper_bound,
2639 const location& loc,
2640 translation_unit::language l = translation_unit::LANG_C11);
2641
2642 virtual hash_t
2643 hash_value() const;
2644
2645 type_base_sptr
2646 get_underlying_type() const;
2647
2648 void
2649 set_underlying_type(const type_base_sptr &);
2650
2651 int64_t
2652 get_upper_bound() const;
2653
2654 int64_t
2655 get_lower_bound() const;
2656
2657 void
2658 set_upper_bound(int64_t ub);
2659
2660 void
2661 set_lower_bound(int64_t lb);
2662
2663 uint64_t
2664 get_length() const;
2665
2666 bool
2667 is_non_finite() const;
2668
2669 void
2670 is_non_finite(bool);
2671
2673 get_language() const;
2674
2675 virtual bool
2676 operator==(const decl_base&) const;
2677
2678 virtual bool
2679 operator==(const type_base&) const;
2680
2681 bool
2682 operator==(const subrange_type& o) const;
2683
2684 bool
2685 operator!=(const decl_base& o) const;
2686
2687 bool
2688 operator!=(const type_base& o) const;
2689
2690 bool
2691 operator!=(const subrange_type& o) const;
2692
2693 string
2694 as_string() const;
2695
2696 static string
2697 vector_as_string(const vector<subrange_sptr>&);
2698
2699 virtual string
2700 get_pretty_representation(bool internal = false,
2701 bool qualified_name = true) const;
2702
2703 virtual bool
2705 }; // end class subrange_type
2706
2707 array_type_def(const type_base_sptr type,
2708 const std::vector<subrange_sptr>& subs,
2709 const location& locus);
2710
2711 array_type_def(const environment& env,
2712 const std::vector<subrange_sptr>& subs,
2713 const location& locus);
2714
2715 virtual hash_t
2716 hash_value() const;
2717
2719 get_language() const;
2720
2721 virtual bool
2722 operator==(const decl_base&) const;
2723
2724 virtual bool
2725 operator==(const type_base&) const;
2726
2727 virtual void
2728 get_qualified_name(interned_string& qualified_name,
2729 bool internal = false) const;
2730
2731 virtual const interned_string&
2732 get_qualified_name(bool internal = false) const;
2733
2734 const type_base_sptr
2735 get_element_type() const;
2736
2737 void
2738 set_element_type(const type_base_sptr& element_type);
2739
2740 virtual void
2741 append_subranges(const std::vector<subrange_sptr>& subs);
2742
2743 virtual int
2744 get_dimension_count() const;
2745
2746 virtual bool
2747 is_non_finite() const;
2748
2749 virtual string
2750 get_pretty_representation(bool internal = false,
2751 bool qualified_name = true) const;
2752
2753 virtual string
2754 get_subrange_representation() const;
2755
2756 virtual bool
2758
2759 const location&
2760 get_location() const;
2761
2762 const std::vector<subrange_sptr>&
2763 get_subranges() const;
2764
2765 virtual ~array_type_def();
2766
2767}; // end class array_type_def
2768
2771
2774
2775bool
2778 change_kind*);
2779
2780bool
2782
2783/// Abstracts a declaration for an enum type.
2784class enum_type_decl : public virtual type_base, public virtual decl_base
2785{
2786 class priv;
2787 std::unique_ptr<priv> priv_;
2788
2789 // Forbidden
2791
2792public:
2793
2794 /// A hasher for an enum_type_decl.
2795 struct hash;
2796
2797 /// Enumerator Datum.
2798 class enumerator;
2799
2800 /// Convenience typedef for a list of @ref enumerator.
2801 typedef std::vector<enumerator> enumerators;
2802
2803 /// Constructor of an enum type declaration.
2804 ///
2805 /// @param name the name of the enum
2806 ///
2807 /// @param locus the locus at which the enum appears in the source
2808 /// code.
2809 ///
2810 /// @param underlying_type the underlying type of the enum
2811 ///
2812 /// @param enms a list of enumerators for this enum.
2813 ///
2814 /// @param mangled_name the mangled name of the enum type.
2815 ///
2816 /// @param vis the visibility of instances of this type.
2817 enum_type_decl(const string& name,
2818 const location& locus,
2819 type_base_sptr underlying_type,
2820 enumerators& enms,
2821 const string& mangled_name = "",
2822 visibility vis = VISIBILITY_DEFAULT);
2823
2824 virtual hash_t
2825 hash_value() const;
2826
2827 type_base_sptr
2828 get_underlying_type() const;
2829
2830 const enumerators&
2831 get_enumerators() const;
2832
2833 const enumerators&
2834 get_sorted_enumerators() const;
2835
2838
2839 bool
2840 find_enumerator_by_value(int64_t value,
2842
2843 bool
2844 find_enumerator_by_name(const string& name,
2846
2847 virtual string
2848 get_pretty_representation(bool internal = false,
2849 bool qualified_name = true) const;
2850
2851 virtual bool
2852 operator==(const decl_base&) const;
2853
2854 virtual bool
2855 operator==(const type_base&) const;
2856
2857 virtual bool
2859
2860 virtual ~enum_type_decl();
2861
2862 friend bool
2864 const enum_type_decl& r,
2865 change_kind* k);
2866}; // end class enum_type_decl
2867
2868bool
2870
2871bool
2873
2874bool
2876 const enum_type_decl& r,
2877 change_kind* k);
2878
2879/// The abstraction of an enumerator
2881{
2882 class priv;
2883 std::unique_ptr<priv> priv_;
2884
2885public:
2886
2887 enumerator();
2888
2889 ~enumerator();
2890
2891 enumerator(const string& name, int64_t value);
2892
2893 enumerator(const enumerator&);
2894
2895 enumerator&
2896 operator=(const enumerator&);
2897
2898 bool
2899 operator==(const enumerator& other) const;
2900
2901 bool
2902 operator!=(const enumerator& other) const;
2903
2904 const string&
2905 get_name() const;
2906
2907 const string&
2908 get_qualified_name(bool internal = false) const;
2909
2910 void
2911 set_name(const string& n);
2912
2913 int64_t
2914 get_value() const;
2915
2916 void
2917 set_value(int64_t v);
2918
2920 get_enum_type() const;
2921
2922 void
2924}; // end class enum_type_def::enumerator
2925
2926bool
2928 const enum_type_decl &enom);
2929
2930bool
2932
2933/// The abstraction of a typedef declaration.
2934class typedef_decl : public virtual type_base, public virtual decl_base
2935{
2936 struct priv;
2937 std::unique_ptr<priv> priv_;
2938
2939 // Forbidden
2940 typedef_decl();
2941
2942public:
2943
2944 /// Hasher for the typedef_decl type.
2945 struct hash;
2946
2947 typedef_decl(const string& name,
2948 const type_base_sptr underlying_type,
2949 const location& locus,
2950 const string& mangled_name = "",
2951 visibility vis = VISIBILITY_DEFAULT);
2952
2953 typedef_decl(const string& name,
2954 const environment& env,
2955 const location& locus,
2956 const string& mangled_name = "",
2957 visibility vis = VISIBILITY_DEFAULT);
2958
2959 virtual hash_t
2960 hash_value() const;
2961
2962 virtual size_t
2963 get_size_in_bits() const;
2964
2965 virtual size_t
2966 get_alignment_in_bits() const;
2967
2968 virtual bool
2969 operator==(const decl_base&) const;
2970
2971 virtual bool
2972 operator==(const type_base&) const;
2973
2974 virtual string
2975 get_pretty_representation(bool internal = false,
2976 bool qualified_name = true) const;
2977
2978 type_base_sptr
2979 get_underlying_type() const;
2980
2981 void
2982 set_underlying_type(const type_base_sptr&);
2983
2984 virtual void
2985 get_qualified_name(interned_string& qualified_name,
2986 bool internal = false) const;
2987
2988 virtual const interned_string&
2989 get_qualified_name(bool internal = false) const;
2990
2991 virtual bool
2993
2994 virtual ~typedef_decl();
2995};// end class typedef_decl
2996
2997/// The abstraction for a data member context relationship. This
2998/// relates a data member to its parent class.
2999///
3000/// The relationship carries properties like the offset of the data
3001/// member, if applicable.
3003{
3004protected:
3005 struct priv;
3006 std::unique_ptr<priv> priv_;
3007
3008public:
3010
3012 bool is_laid_out,
3013 size_t offset_in_bits,
3015 bool is_static);
3016
3018
3019 bool
3020 get_is_laid_out() const;
3021
3022 void
3023 set_is_laid_out(bool f);
3024
3025 size_t
3026 get_offset_in_bits() const;
3027
3028 void
3029 set_offset_in_bits(size_t o);
3030
3031 const var_decl*
3033
3034 void
3036
3037 bool
3038 operator==(const dm_context_rel& o) const;
3039
3040 bool
3041 operator!=(const dm_context_rel& o) const;
3042
3043 virtual ~dm_context_rel();
3044};// end class class_decl::dm_context_rel
3045
3046bool
3047equals(const var_decl&, const var_decl&, change_kind*);
3048
3049bool
3051
3052bool
3054
3055bool
3057 const array_type_def_sptr& r);
3058
3059bool
3061
3062bool
3064 const pointer_type_def_sptr&);
3065
3066/// Abstracts a variable declaration.
3067class var_decl : public virtual decl_base
3068{
3069 struct priv;
3070 std::unique_ptr<priv> priv_;
3071
3072 // Forbidden
3073 var_decl();
3074
3075 virtual void
3076 set_scope(scope_decl*);
3077
3078public:
3079
3080 /// Equality functor to compare pointers to variable_decl.
3081 struct ptr_equal;
3082
3083 var_decl(const string& name,
3084 type_base_sptr type,
3085 const location& locus,
3086 const string& mangled_name,
3087 visibility vis = VISIBILITY_DEFAULT,
3088 binding bind = BINDING_NONE);
3089
3090 virtual bool
3091 operator==(const decl_base&) const;
3092
3093 const type_base_sptr
3094 get_type() const;
3095
3096 void
3097 set_type(type_base_sptr&);
3098
3099 const type_base*
3100 get_naked_type() const;
3101
3102 binding
3103 get_binding() const;
3104
3105 void
3107
3108 void
3109 set_symbol(const elf_symbol_sptr& sym);
3110
3111 const elf_symbol_sptr&
3112 get_symbol() const;
3113
3115 clone() const;
3116
3118 get_id() const;
3119
3120 virtual const interned_string&
3121 get_qualified_name(bool internal = false) const;
3122
3123 virtual string
3124 get_pretty_representation(bool internal = false,
3125 bool qualified_name = true) const;
3126
3127 string
3128 get_anon_dm_reliable_name(bool qualified = true) const;
3129
3130 virtual bool
3132
3133 virtual ~var_decl();
3134
3135 friend void
3137
3138 friend uint64_t
3140
3141 friend uint64_t
3143
3144 friend uint64_t
3146
3147 friend uint64_t
3149
3150 friend void
3152
3153 friend bool
3155
3156 friend bool
3158}; // end class var_decl
3159
3160bool
3162
3163/// Abstraction for a function declaration.
3164class function_decl : public virtual decl_base
3165{
3166 struct priv;
3167 // This priv pointer is not handled by a shared_ptr because
3168 // accessing the data members of the priv struct for this
3169 // function_decl shows up on performance profiles when dealing with
3170 // big binaries with a lot of types; dereferencing the shared_ptr
3171 // involves locking of some sort and that is slower than just
3172 // dereferencing a pointer likere here. There are other types for
3173 // which the priv pointer is managed using shared_ptr just fine,
3174 // because those didn't show up during our performance profiling.
3175 priv* priv_;
3176
3177public:
3178
3179 /// Equality functor to compare pointers to function_decl
3180 struct ptr_equal;
3181
3182 /// Abstraction for the parameter of a function.
3183 class parameter;
3184
3185 /// Convenience typedef for a shared pointer on a @ref
3186 /// function_decl::parameter
3187 typedef shared_ptr<parameter> parameter_sptr;
3188
3189 /// Convenience typedef for a vector of @ref parameter_sptr
3190 typedef std::vector<parameter_sptr> parameters;
3191
3192 function_decl(const string& name,
3194 bool declared_inline,
3195 const location& locus,
3196 const string& mangled_name,
3197 visibility vis,
3198 binding bind);
3199
3200 function_decl(const string& name,
3201 type_base_sptr fn_type,
3202 bool declared_inline,
3203 const location& locus,
3204 const string& mangled_name = "",
3205 visibility vis = VISIBILITY_DEFAULT,
3206 binding bind = BINDING_GLOBAL);
3207
3208 virtual string
3209 get_pretty_representation(bool internal = false,
3210 bool qualified_name = true) const;
3211
3212 string
3213 get_pretty_representation_of_declarator (bool internal = false) const;
3214
3215 const std::vector<parameter_sptr >&
3216 get_parameters() const;
3217
3218 void
3220
3221 void
3222 append_parameters(std::vector<parameter_sptr >& parms);
3223
3224 parameters::const_iterator
3226
3227 const function_type_sptr
3228 get_type() const;
3229
3230 const function_type*
3231 get_naked_type() const;
3232
3233 const type_base_sptr
3234 get_return_type() const;
3235
3236 void
3237 set_type(const function_type_sptr& fn_type);
3238
3239 void
3240 set_symbol(const elf_symbol_sptr& sym);
3241
3242 const elf_symbol_sptr&
3243 get_symbol() const;
3244
3245 bool
3246 is_declared_inline() const;
3247
3248 void
3249 is_declared_inline(bool);
3250
3251 binding
3252 get_binding() const;
3253
3255 clone() const;
3256
3257 virtual bool
3258 operator==(const decl_base& o) const;
3259
3260 /// Return true iff the function takes a variable number of
3261 /// parameters.
3262 ///
3263 /// @return true if the function taks a variable number
3264 /// of parameters.
3265 bool
3266 is_variadic() const;
3267
3269 get_id() const;
3270
3271 virtual bool
3273
3274 virtual ~function_decl();
3275}; // end class function_decl
3276
3277bool
3279
3280bool
3282
3283bool
3285
3286bool
3289 change_kind*);
3290
3291/// A comparison functor to compare pointer to instances of @ref
3292/// type_or_decl_base.
3294{
3295 /// Comparison operator for ABI artifacts.
3296 ///
3297 /// @param f the first ABI artifact to consider for the comparison.
3298 ///
3299 /// @param s the second ABI artifact to consider for the comparison.
3300 ///
3301 /// @return true iff @p f is lexicographically less than than @p s.
3302 bool
3304 const type_or_decl_base *s)
3305 {
3306 function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3307 if (f_fn && s_fn)
3308 return function_decl_is_less_than(*f_fn, *s_fn);
3309
3310 var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3311 if (f_var && s_var)
3312 return get_name(f_var) < get_name(s_var);
3313
3314 string l_repr = get_pretty_representation(f),
3315 r_repr = get_pretty_representation(s);
3316
3317 return l_repr < r_repr;
3318 }
3319
3320 /// Comparison operator for ABI artifacts.
3321 ///
3322 /// @param f the first ABI artifact to consider for the comparison.
3323 ///
3324 /// @param s the second ABI artifact to consider for the comparison.
3325 ///
3326 /// @return true iff @p f is lexicographically less than than @p s.
3327 bool
3329 const type_or_decl_base_sptr& s)
3330 {return operator()(f.get(), s.get());}
3331}; // end struct type_or_decl_base_comp
3332
3333/// Abstraction of a function parameter.
3335{
3336 struct priv;
3337 std::unique_ptr<priv> priv_;
3338
3339public:
3340
3341 parameter(const type_base_sptr type,
3342 unsigned index,
3343 const string& name,
3344 const location& loc,
3345 bool variadic_marker = false);
3346
3347 parameter(const type_base_sptr type,
3348 unsigned index,
3349 const string& name,
3350 const location& loc,
3351 bool variadic_marker,
3352 bool is_artificial);
3353
3354 parameter(const type_base_sptr type,
3355 const string& name,
3356 const location& loc,
3357 bool variadic_marker = false,
3358 bool is_artificial = false);
3359
3360 parameter(const type_base_sptr type,
3361 unsigned index = 0,
3362 bool variadic_marker = false);
3363
3364 virtual ~parameter();
3365
3366 const type_base_sptr
3367 get_type()const;
3368
3370 get_type_name() const;
3371
3372 const string
3374
3376 get_name_id() const;
3377
3378 unsigned
3379 get_index() const;
3380
3381 void
3382 set_index(unsigned i);
3383
3384 bool
3385 get_variadic_marker() const;
3386
3387 bool
3388 operator==(const parameter& o) const;
3389
3390 virtual bool
3391 operator==(const decl_base&) const;
3392
3393 virtual bool
3395
3396 virtual void
3397 get_qualified_name(interned_string& qualified_name,
3398 bool internal = false) const;
3399
3400 virtual string
3401 get_pretty_representation(bool internal = false,
3402 bool qualified_name = true) const;
3403}; // end class function_decl::parameter
3404
3405bool
3408
3411
3414
3415bool
3417
3418/// Abstraction of a function type.
3419class function_type : public virtual type_base
3420{
3421protected:
3422 virtual void on_canonical_type_set();
3423
3424public:
3425 /// Hasher for an instance of function_type
3426 struct hash;
3427
3428 /// Convenience typedef for a shared pointer on a @ref
3429 /// function_decl::parameter
3430 typedef shared_ptr<function_decl::parameter> parameter_sptr;
3431 /// Convenience typedef for a vector of @ref parameter_sptr
3432 typedef std::vector<parameter_sptr> parameters;
3433
3434 struct priv;
3435 std::unique_ptr<priv> priv_;
3436
3437private:
3438 function_type();
3439
3440public:
3441
3442 function_type(type_base_sptr return_type,
3443 const parameters& parms,
3444 size_t size_in_bits,
3445 size_t alignment_in_bits);
3446
3447 function_type(type_base_sptr return_type,
3448 size_t size_in_bits,
3449 size_t alignment_in_bits);
3450
3451 function_type(const environment& env,
3452 size_t size_in_bits,
3453 size_t alignment_in_bits);
3454
3455 virtual hash_t
3456 hash_value() const;
3457
3458 type_base_sptr
3459 get_return_type() const;
3460
3461 void
3462 set_return_type(type_base_sptr t);
3463
3464 const parameters&
3465 get_parameters() const;
3466
3467 const parameter_sptr
3469
3470 void
3471 set_parameters(const parameters &p);
3472
3473 void
3475
3476 bool
3477 is_variadic() const;
3478
3479 parameters::const_iterator
3481
3482 parameters::const_iterator
3483 get_first_parm() const;
3484
3485 const interned_string&
3486 get_cached_name(bool internal = false) const;
3487
3488 virtual bool
3489 operator==(const type_base&) const;
3490
3491 virtual string
3492 get_pretty_representation(bool internal = false,
3493 bool qualified_name = true) const;
3494
3495 virtual bool
3497
3498 virtual ~function_type();
3499
3500 friend bool
3502};//end class function_type
3503
3504/// Abstracts the type of a class member function.
3506{
3507 struct priv;
3508 std::unique_ptr<priv> priv_;
3509
3510 method_type();
3511
3512public:
3513
3514 /// Hasher for intances of method_type
3515 struct hash;
3516
3517 method_type(type_base_sptr return_type,
3518 class_or_union_sptr class_type,
3519 const std::vector<function_decl::parameter_sptr>& parms,
3520 bool is_const,
3521 size_t size_in_bits,
3522 size_t alignment_in_bits);
3523
3524 method_type(type_base_sptr return_type,
3525 type_base_sptr class_type,
3526 const std::vector<function_decl::parameter_sptr>& parms,
3527 bool is_const,
3528 size_t size_in_bits,
3529 size_t alignment_in_bits);
3530
3531 method_type(class_or_union_sptr class_type,
3532 bool is_const,
3533 size_t size_in_bits,
3534 size_t alignment_in_bits);
3535
3536 method_type(const environment& env,
3537 size_t size_in_bits,
3538 size_t alignment_in_bits);
3539
3540 virtual hash_t
3541 hash_value() const;
3542
3543 class_or_union_sptr
3544 get_class_type() const;
3545
3546 void
3547 set_class_type(const class_or_union_sptr& t);
3548
3549 void set_is_const(bool);
3550
3551 bool get_is_const() const;
3552
3553 bool get_is_for_static_method() const;
3554
3555 virtual ~method_type();
3556
3557 virtual string
3558 get_pretty_representation(bool internal = false,
3559 bool qualified_name = true) const;
3560
3561 friend interned_string
3562 get_method_type_name(const method_type& fn_type, bool internal);
3563};// end class method_type.
3564
3565/// The base class of templates.
3566class template_decl : public virtual decl_base
3567{
3568 class priv;
3569 std::unique_ptr<priv> priv_;
3570
3571 template_decl();
3572
3573public:
3574
3575 template_decl(const environment& env,
3576 const string& name,
3577 const location& locus,
3578 visibility vis = VISIBILITY_DEFAULT);
3579
3580 void
3582
3583 const std::list<template_parameter_sptr>&
3585
3586 virtual bool
3587 operator==(const decl_base& o) const;
3588
3589 virtual bool
3590 operator==(const template_decl& o) const;
3591
3592 virtual ~template_decl();
3593};//end class template_decl
3594
3595/// Base class for a template parameter. Client code should use the
3596/// more specialized type_template_parameter,
3597/// non_type_template_parameter and template_template_parameter below.
3599{
3600 class priv;
3601 std::unique_ptr<priv> priv_;
3602
3603 // Forbidden
3605
3606 public:
3607
3608 template_parameter(unsigned index,
3609 template_decl_sptr enclosing_tdecl);
3610
3611 virtual bool
3612 operator==(const template_parameter&) const;
3613
3614 bool
3615 operator!=(const template_parameter&) const;
3616
3617 unsigned
3618 get_index() const;
3619
3620 const template_decl_sptr
3621 get_enclosing_template_decl() const;
3622
3623 virtual ~template_parameter();
3624};//end class template_parameter
3625
3626/// Abstracts a type template parameter.
3627class type_tparameter : public template_parameter, public virtual type_decl
3628{
3629 class priv;
3630 std::unique_ptr<priv> priv_;
3631
3632 // Forbidden
3634
3635public:
3636
3637 type_tparameter(unsigned index,
3638 template_decl_sptr enclosing_tdecl,
3639 const string& name,
3640 const location& locus);
3641
3642 virtual bool
3643 operator==(const type_base&) const;
3644
3645 virtual bool
3646 operator==(const type_decl&) const;
3647
3648 virtual bool
3649 operator==(const decl_base&) const;
3650
3651 virtual bool
3652 operator==(const template_parameter&) const;
3653
3654 virtual bool
3655 operator==(const type_tparameter&) const;
3656
3657 virtual ~type_tparameter();
3658};// end class type_tparameter.
3659
3660/// Abstracts non type template parameters.
3662{
3663 class priv;
3664 std::unique_ptr<priv> priv_;
3665
3666 type_base_wptr type_;
3667
3668 // Forbidden
3670
3671public:
3672
3673 non_type_tparameter(unsigned index,
3674 template_decl_sptr enclosing_tdecl,
3675 const string& name,
3676 type_base_sptr type,
3677 const location& locus);
3678 virtual bool
3679 operator==(const decl_base&) const;
3680
3681 virtual bool
3682 operator==(const template_parameter&) const;
3683
3684 const type_base_sptr
3685 get_type() const;
3686
3687 virtual ~non_type_tparameter();
3688};// end class non_type_tparameter
3689
3690
3692
3693/// Abstracts a template template parameter.
3695{
3696 class priv;
3697 std::unique_ptr<priv> priv_;
3698
3699 // Forbidden
3701
3702public:
3703
3704 template_tparameter(unsigned index,
3705 template_decl_sptr enclosing_tdecl,
3706 const string& name,
3707 const location& locus);
3708
3709 virtual bool
3710 operator==(const type_base&) const;
3711
3712 virtual bool
3713 operator==(const decl_base&) const;
3714
3715 virtual bool
3716 operator==(const template_parameter&) const;
3717
3718 virtual bool
3719 operator==(const template_decl&) const;
3720
3721 virtual ~template_tparameter();
3722};
3723
3724/// This abstracts a composition of types based on template type
3725/// parameters. The result of the composition is a type that can be
3726/// referred to by a template non-type parameter. Instances of this
3727/// type can appear at the same level as template parameters, in the
3728/// scope of a template_decl.
3729class type_composition : public template_parameter, public virtual decl_base
3730{
3731 class priv;
3732 std::unique_ptr<priv> priv_;
3733
3735
3736public:
3737 type_composition(unsigned index,
3738 template_decl_sptr tdecl,
3739 type_base_sptr composed_type);
3740
3741 const type_base_sptr
3742 get_composed_type() const;
3743
3744 void
3745 set_composed_type(type_base_sptr t);
3746
3747 virtual ~type_composition();
3748};
3749
3750/// Abstract a function template declaration.
3752{
3753 class priv;
3754 std::unique_ptr<priv> priv_;
3755
3756 // Forbidden
3758
3759public:
3760
3761 function_tdecl(const environment& env,
3762 const location& locus,
3763 visibility vis = VISIBILITY_DEFAULT,
3764 binding bind = BINDING_NONE);
3765
3767 const location& locus,
3768 visibility vis = VISIBILITY_DEFAULT,
3769 binding bind = BINDING_NONE);
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 function_tdecl&) const;
3779
3780 void
3781 set_pattern(shared_ptr<function_decl> p);
3782
3783 shared_ptr<function_decl>
3784 get_pattern() const;
3785
3786 binding
3787 get_binding() const;
3788
3789 virtual bool
3791
3792 virtual ~function_tdecl();
3793}; // end class function_tdecl.
3794
3795/// Abstract a class template.
3797{
3798 class priv;
3799 std::unique_ptr<priv> priv_;
3800
3801 // Forbidden
3802 class_tdecl();
3803
3804public:
3805
3806 class_tdecl(const environment& env, const location& locus,
3807 visibility vis = VISIBILITY_DEFAULT);
3808
3810 const location& locus,
3811 visibility vis = VISIBILITY_DEFAULT);
3812
3813 virtual bool
3814 operator==(const decl_base&) const;
3815
3816 virtual bool
3817 operator==(const template_decl&) const;
3818
3819 virtual bool
3820 operator==(const class_tdecl&) const;
3821
3822 void
3824
3825 shared_ptr<class_decl>
3826 get_pattern() const;
3827
3828 virtual bool
3830
3831 virtual ~class_tdecl();
3832};// end class class_tdecl
3833
3834/// The base class for member types, data members and member
3835/// functions. Its purpose is mainly to carry the access specifier
3836/// (and possibly other properties that might be shared by all class
3837/// members) for the member.
3839{
3840protected:
3841 enum access_specifier access_;
3842 bool is_static_;
3843
3844private:
3845 // Forbidden
3846 member_base();
3847
3848public:
3849 struct hash;
3850
3851 member_base(access_specifier a, bool is_static = false)
3852 : access_(a), is_static_(is_static)
3853 {}
3854
3855 /// Getter for the access specifier of this member.
3856 ///
3857 /// @return the access specifier for this member.
3860 {return access_;}
3861
3862 /// Setter for the access specifier of this member.
3863 ///
3864 /// @param a the new access specifier.
3865 void
3867 {access_ = a;}
3868
3869 /// @return true if the member is static, false otherwise.
3870 bool
3872 {return is_static_;}
3873
3874 /// Set a flag saying if the parameter is static or not.
3875 ///
3876 /// @param f set to true if the member is static, false otherwise.
3877 void
3879 {is_static_ = f;}
3880
3881 virtual bool
3882 operator==(const member_base& o) const;
3883};// end class member_base
3884
3885/// Abstraction of the declaration of a method.
3887{
3888 method_decl();
3889
3890 virtual void
3891 set_scope(scope_decl*);
3892
3893public:
3894
3895 method_decl(const string& name, method_type_sptr type,
3896 bool declared_inline, const location& locus,
3897 const string& mangled_name = "",
3898 visibility vis = VISIBILITY_DEFAULT,
3899 binding bind = BINDING_GLOBAL);
3900
3901 method_decl(const string& name,
3902 function_type_sptr type,
3903 bool declared_inline,
3904 const location& locus,
3905 const string& mangled_name = "",
3906 visibility vis = VISIBILITY_DEFAULT,
3907 binding bind = BINDING_GLOBAL);
3908
3909 method_decl(const string& name, type_base_sptr type,
3910 bool declared_inline, const location& locus,
3911 const string& mangled_name = "",
3912 visibility vis = VISIBILITY_DEFAULT,
3913 binding bind = BINDING_GLOBAL);
3914
3915 virtual void
3916 set_linkage_name(const string&);
3917
3918 /// @return the type of the current instance of the
3919 /// method_decl.
3920 const method_type_sptr
3921 get_type() const;
3922
3923 void
3924 set_type(const method_type_sptr fn_type)
3925 {function_decl::set_type(fn_type);}
3926
3927 friend bool
3929
3930 friend void
3932
3933 friend void
3935
3936 friend bool
3938
3939 friend void
3941
3942 friend void
3944
3945 friend bool
3946 get_member_function_is_static(const function_decl&);
3947
3948 friend void
3949 set_member_function_is_static(const function_decl&, bool);
3950
3951 friend bool
3953
3954 friend void
3956
3957 friend void
3959
3960 friend bool
3962
3963 friend ssize_t
3965
3966 virtual ~method_decl();
3967};// end class method_decl
3968
3969bool
3970operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3971
3972bool
3973operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
3974
3975/// The base type of @ref class_decl and @ref union_decl
3977{
3978public:
3979 struct priv;
3980 priv *priv_;
3981
3982private:
3983 // Forbidden
3985
3986protected:
3987
3988 virtual decl_base_sptr
3989 add_member_decl(const decl_base_sptr&);
3990
3991 decl_base_sptr
3992 insert_member_decl(decl_base_sptr member);
3993
3994 virtual void
3995 remove_member_decl(decl_base_sptr);
3996
3997 void
3999
4000public:
4001 /// Hasher.
4002 struct hash;
4003
4004 /// Convenience typedef
4005 /// @{
4006 typedef vector<type_base_sptr> member_types;
4007 typedef vector<var_decl_sptr> data_members;
4008 typedef vector<method_decl_sptr> member_functions;
4009 typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
4010 typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
4011 typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
4012 /// @}
4013
4014 class_or_union(const environment& env, const string& name,
4015 size_t size_in_bits, size_t align_in_bits,
4016 const location& locus, visibility vis,
4017 member_types& mbrs, data_members& data_mbrs,
4018 member_functions& member_fns);
4019
4020 class_or_union(const environment& env, const string& name,
4021 size_t size_in_bits, size_t align_in_bits,
4022 const location& locus, visibility vis);
4023
4024 class_or_union(const environment& env, const string& name,
4025 bool is_declaration_only = true);
4026
4027 virtual hash_t
4028 hash_value() const;
4029
4030 virtual void
4031 set_size_in_bits(size_t);
4032
4033 virtual size_t
4034 get_size_in_bits() const;
4035
4036 virtual size_t
4037 get_alignment_in_bits() const;
4038
4039 virtual void
4040 set_alignment_in_bits(size_t);
4041
4042 virtual size_t
4044
4045 virtual size_t
4047
4048 virtual size_t
4050
4051 void
4053 bool is_laid_out, bool is_static,
4054 size_t offset_in_bits);
4055
4056 const data_members&
4057 get_data_members() const;
4058
4059 const var_decl_sptr
4060 find_data_member(const string&) const;
4061
4062 const var_decl_sptr
4063 find_data_member(const var_decl_sptr&) const;
4064
4065 const var_decl_sptr
4067
4068 const data_members&
4070
4071 const data_members&
4073
4074 void
4075 add_member_function(method_decl_sptr f,
4077 bool is_static, bool is_ctor,
4078 bool is_dtor, bool is_const);
4079
4080 void
4081 add_member_function(method_decl_sptr f,
4083 bool is_virtual,
4084 size_t vtable_offset,
4085 bool is_static, bool is_ctor,
4086 bool is_dtor, bool is_const);
4087
4088 const member_functions&
4089 get_member_functions() const;
4090
4091 const method_decl*
4092 find_member_function(const string& mangled_name) const;
4093
4095 find_member_function(const string& mangled_name);
4096
4097 method_decl_sptr
4098 find_member_function_sptr(const string& mangled_name);
4099
4100 const method_decl*
4101 find_member_function_from_signature(const string& s) const;
4102
4104 find_member_function_from_signature(const string& s);
4105
4106 void
4107 add_member_function_template(member_function_template_sptr);
4108
4109 const member_function_templates&
4111
4112 void
4113 add_member_class_template(member_class_template_sptr m);
4114
4115 const member_class_templates&
4117
4118 bool
4119 has_no_member() const;
4120
4121 virtual bool
4122 operator==(const decl_base&) const;
4123
4124 virtual bool
4125 operator==(const type_base&) const;
4126
4127 virtual bool
4128 operator==(const class_or_union&) const;
4129
4130 virtual bool
4132
4133 virtual ~class_or_union();
4134
4135 friend method_decl_sptr
4136 copy_member_function(class_or_union_sptr& t,
4137 const method_decl*m);
4138
4139 friend method_decl_sptr
4140 copy_member_function(class_or_union_sptr& t,
4141 const method_decl_sptr& m);
4142
4143 friend void
4144 fixup_virtual_member_function(method_decl_sptr method);
4145
4146 friend void
4147 set_member_is_static(decl_base& d, bool s);
4148
4149 friend bool
4151
4152 friend bool
4153 equals(const class_decl&, const class_decl&, change_kind*);
4154
4155 friend class method_decl;
4156 friend class class_decl;
4157}; // end class class_or_union
4158
4159method_decl_sptr
4160copy_member_function(const class_or_union_sptr& clazz,
4161 const method_decl_sptr& f);
4162
4163method_decl_sptr
4164copy_member_function(const class_or_union_sptr& clazz,
4165 const method_decl* f);
4166
4167bool
4168operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4169
4170bool
4171operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4172
4173/// Abstracts a class declaration.
4175{
4176 // Forbidden
4177 class_decl();
4178
4179protected:
4180
4181 decl_base_sptr
4182 insert_member_decl(decl_base_sptr member);
4183
4184public:
4185 /// Hasher.
4186 struct hash;
4187
4188 /// Forward declarations.
4189 class base_spec;
4190
4191 /// Convenience typedef
4192 /// @{
4193 typedef shared_ptr<base_spec> base_spec_sptr;
4194 typedef vector<base_spec_sptr> base_specs;
4195
4196 /// @}
4197
4198protected:
4199 virtual void
4201
4202private:
4203 struct priv;
4204 // This priv it's not handled by a shared_ptr because accessing the
4205 // data members of the priv struct for this class_decl shows up on
4206 // performance profiles when dealing with big binaries with a lot of
4207 // types; dereferencing the shared_ptr involves locking of some sort
4208 // and that is slower than just dereferencing a pointer likere here.
4209 // There are other types for which the priv pointer is managed using
4210 // shared_ptr just fine, because those didn't show up during our
4211 // performance profiling.
4212 priv * priv_;
4213
4214public:
4215
4216 class_decl(const environment& env, const string& name,
4217 size_t size_in_bits, size_t align_in_bits,
4218 bool is_struct, const location& locus,
4219 visibility vis, base_specs& bases,
4220 member_types& mbrs, data_members& data_mbrs,
4221 member_functions& member_fns);
4222
4223 class_decl(const environment& env, const string& name,
4224 size_t size_in_bits, size_t align_in_bits,
4225 bool is_struct, const location& locus,
4226 visibility vis, base_specs& bases,
4227 member_types& mbrs, data_members& data_mbrs,
4228 member_functions& member_fns, bool is_anonymous);
4229
4230 class_decl(const environment& env, const string& name,
4231 size_t size_in_bits, size_t align_in_bits,
4232 bool is_struct, const location& locus, visibility vis);
4233
4234 class_decl(const environment& env, const string& name,
4235 size_t size_in_bits, size_t align_in_bits,
4236 bool is_struct, const location& locus,
4237 visibility vis, bool is_anonymous);
4238
4239 class_decl(const environment& env, const string& name, bool is_struct,
4240 bool is_declaration_only = true);
4241
4242 virtual hash_t
4243 hash_value() const;
4244
4245 virtual string
4246 get_pretty_representation(bool internal = false,
4247 bool qualified_name = true) const;
4248
4249 void
4250 is_struct(bool f);
4251
4252 bool
4253 is_struct() const;
4254
4255 void
4256 add_base_specifier(shared_ptr<base_spec> b);
4257
4258 const base_specs&
4259 get_base_specifiers() const;
4260
4262 find_base_class(const string& qualified_name) const;
4263
4264 const member_functions&
4265 get_virtual_mem_fns() const;
4266
4269
4270 void
4272
4273 bool
4274 has_no_base_nor_member() const;
4275
4276 bool
4278
4279 bool
4280 has_virtual_bases() const;
4281
4282 bool
4283 has_vtable() const;
4284
4285 ssize_t
4287
4288 virtual bool
4289 operator==(const decl_base&) const;
4290
4291 virtual bool
4292 operator==(const type_base&) const;
4293
4294 virtual bool
4295 operator==(const class_or_union&) const;
4296
4297 virtual bool
4298 operator==(const class_decl&) const;
4299
4300 virtual bool
4302
4303 virtual ~class_decl();
4304
4305 friend void
4306 fixup_virtual_member_function(method_decl_sptr method);
4307
4308 friend void
4309 set_member_is_static(decl_base& d, bool s);
4310
4311 friend bool
4312 equals(const class_decl&, const class_decl&, change_kind*);
4313
4314 friend class method_decl;
4315 friend class class_or_union;
4316};// end class class_decl
4317
4318bool
4319equals(const class_decl&, const class_decl&, change_kind*);
4320
4321method_decl_sptr
4323 const method_decl_sptr& f);
4324
4325method_decl_sptr
4327 const method_decl* f);
4328void
4329fixup_virtual_member_function(method_decl_sptr method);
4330
4333
4335get_member_access_specifier(const decl_base_sptr&);
4336
4337void
4340
4341void
4342set_member_access_specifier(const decl_base_sptr&,
4344
4345std::ostream&
4346operator<<(std::ostream&, access_specifier);
4347
4348bool
4349operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4350
4351bool
4352operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4353
4354bool
4356 const class_decl::base_spec&,
4357 change_kind*);
4358
4359/// Abstraction of a base specifier in a class declaration.
4361 public virtual decl_base
4362{
4363 struct priv;
4364 std::unique_ptr<priv> priv_;
4365
4366 // Forbidden
4367 base_spec();
4368
4369public:
4370
4371 /// Hasher.
4372 struct hash;
4373
4375 long offset_in_bits = -1, bool is_virtual = false);
4376
4377 base_spec(const type_base_sptr& base, access_specifier a,
4378 long offset_in_bits = -1, bool is_virtual = false);
4379
4380 virtual hash_t
4381 hash_value() const;
4382
4383 virtual ~base_spec();
4384
4386 get_base_class() const;
4387
4388 bool
4389 get_is_virtual() const;
4390
4391 long
4392 get_offset_in_bits() const;
4393
4394 virtual bool
4395 operator==(const decl_base&) const;
4396
4397 virtual bool
4398 operator==(const member_base&) const;
4399
4400 virtual bool
4402};// end class class_decl::base_spec
4403
4404bool
4407
4408bool
4411
4414
4417
4418/// Abstracts a union type declaration.
4420{
4421 // Forbid
4422 union_decl();
4423
4424public:
4425
4426 struct hash;
4427
4428 union_decl(const environment& env, const string& name,
4429 size_t size_in_bits, const location& locus,
4430 visibility vis, member_types& mbrs,
4431 data_members& data_mbrs, member_functions& member_fns);
4432
4433 union_decl(const environment& env, const string& name,
4434 size_t size_in_bits, const location& locus,
4435 visibility vis, member_types& mbrs,
4436 data_members& data_mbrs, member_functions& member_fns,
4437 bool is_anonymous);
4438
4439 union_decl(const environment& env, const string& name,
4440 size_t size_in_bits, const location& locus,
4441 visibility vis);
4442
4443 union_decl(const environment& env, const string& name,
4444 size_t size_in_bits, const location& locus,
4445 visibility vis, bool is_anonymous);
4446
4447 union_decl(const environment& env, const string& name,
4448 bool is_declaration_only = true);
4449
4450 virtual hash_t
4451 hash_value() const;
4452
4453 virtual string
4454 get_pretty_representation(bool internal = false,
4455 bool qualified_name = true) const;
4456
4457 virtual bool
4458 operator==(const decl_base&) const;
4459
4460 virtual bool
4461 operator==(const type_base&) const;
4462
4463 virtual bool
4464 operator==(const class_or_union&) const;
4465
4466 virtual bool
4467 operator==(const union_decl&) const;
4468
4469 virtual bool
4471
4472 virtual ~union_decl();
4473}; // union_decl
4474
4475bool
4476equals(const union_decl&, const union_decl&, change_kind*);
4477
4478method_decl_sptr
4479copy_member_function(const union_decl_sptr& union_type,
4480 const method_decl_sptr& f);
4481
4482method_decl_sptr
4483copy_member_function(const union_decl_sptr& union_type,
4484 const method_decl* f);
4485
4486bool
4487operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4488
4489bool
4490operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4491
4492/// Abstraction of a member function context relationship. This
4493/// relates a member function to its parent class.
4495{
4496protected:
4497 bool is_virtual_;
4498 ssize_t vtable_offset_in_bits_;
4499 bool is_constructor_;
4500 bool is_destructor_;
4501 bool is_const_;
4502
4503public:
4505 : context_rel(),
4506 is_virtual_(false),
4507 vtable_offset_in_bits_(-1),
4508 is_constructor_(false),
4509 is_destructor_(false),
4510 is_const_(false)
4511 {}
4512
4514 : context_rel(s),
4515 is_virtual_(false),
4516 vtable_offset_in_bits_(-1),
4517 is_constructor_(false),
4518 is_destructor_(false),
4519 is_const_(false)
4520 {}
4521
4523 bool is_constructor,
4524 bool is_destructor,
4525 bool is_const,
4526 bool is_virtual,
4527 size_t vtable_offset_in_bits,
4528 access_specifier access,
4529 bool is_static)
4530 : context_rel(s, access, is_static),
4531 is_virtual_(is_virtual),
4532 vtable_offset_in_bits_(vtable_offset_in_bits),
4533 is_constructor_(is_constructor),
4534 is_destructor_(is_destructor),
4535 is_const_(is_const)
4536 {}
4537
4538 bool
4539 is_virtual() const
4540 {return is_virtual_;}
4541
4542 void
4543 is_virtual(bool is_virtual)
4544 {is_virtual_ = is_virtual;}
4545
4546 /// Getter for the vtable offset property.
4547 ///
4548 /// This is the vtable offset of the member function of this
4549 /// relation.
4550 ///
4551 /// @return the vtable offset property of the relation.
4552 size_t
4554 {return vtable_offset_in_bits_;}
4555
4556 /// Setter for the vtable offset property.
4557 ///
4558 /// This is the vtable offset of the member function of this
4559 /// relation.
4560 ///
4561 /// @partam s the new vtable offset.
4562 void
4564 {vtable_offset_in_bits_ = s;}
4565
4566 /// Getter for the 'is-constructor' property.
4567 ///
4568 /// This tells if the member function of this relation is a
4569 /// constructor.
4570 ///
4571 /// @return the is-constructor property of the relation.
4572 bool
4574 {return is_constructor_;}
4575
4576 /// Setter for the 'is-constructor' property.
4577 ///
4578 /// @param f the new value of the the property. Is true if this is
4579 /// for a constructor, false otherwise.
4580 void
4582 {is_constructor_ = f;}
4583
4584 /// Getter for the 'is-destructor' property.
4585 ///
4586 /// Tells if the member function of this relation is a destructor.
4587 ///
4588 /// @return the is-destructor property of the relation;
4589 bool
4591 {return is_destructor_;}
4592
4593 /// Setter for the 'is-destructor' property.
4594 ///
4595 /// @param f the new value of the property. Is true if this is for
4596 /// a destructor, false otherwise.
4597 void
4599 {is_destructor_ = f;}
4600
4601 /// Getter for the 'is-const' property.
4602 ///
4603 /// Tells if the member function of this relation is a const member
4604 /// function.
4605 ///
4606 /// @return the 'is-const' property of the relation.
4607 bool
4608 is_const() const
4609 {return is_const_;}
4610
4611 /// Setter for the 'is-const' property.
4612 ///
4613 /// @param f the new value of the property. Is true if this is for
4614 /// a const entity, false otherwise.
4615 void
4616 is_const(bool f)
4617 {is_const_ = f;}
4618
4619 virtual ~mem_fn_context_rel();
4620}; // end class mem_fn_context_rel
4621
4624
4627
4628method_decl_sptr
4630
4631const var_decl*
4632lookup_data_member(const type_base* type,
4633 const char* dm_name);
4634
4635const var_decl_sptr
4636lookup_data_member(const type_base_sptr& type,
4637 const var_decl_sptr& dm);
4638
4641 unsigned parm_num);
4642
4643/// Abstract a member function template.
4644class member_function_template : public member_base, public virtual decl_base
4645{
4646 bool is_constructor_;
4647 bool is_const_;
4648 shared_ptr<function_tdecl> fn_tmpl_;
4649
4650 // Forbiden
4652
4653public:
4654 /// Hasher.
4655 struct hash;
4656
4658 access_specifier access, bool is_static,
4659 bool is_constructor, bool is_const)
4660 : type_or_decl_base(f->get_environment()),
4661 decl_base(f->get_environment(), f->get_name(), location()),
4662 member_base(access, is_static), is_constructor_(is_constructor),
4663 is_const_(is_const), fn_tmpl_(f)
4664 {}
4665
4666 bool
4667 is_constructor() const
4668 {return is_constructor_;}
4669
4670 bool
4671 is_const() const
4672 {return is_const_;}
4673
4674 operator const function_tdecl& () const
4675 {return *fn_tmpl_;}
4676
4678 as_function_tdecl() const
4679 {return fn_tmpl_;}
4680
4681 virtual bool
4682 operator==(const member_base& o) const;
4683
4684 virtual bool
4686};// end class member_function_template
4687
4688bool
4689operator==(const member_function_template_sptr& l,
4690 const member_function_template_sptr& r);
4691
4692bool
4693operator!=(const member_function_template_sptr& l,
4694 const member_function_template_sptr& r);
4695
4696/// Abstracts a member class template template
4698 : public member_base,
4699 public virtual decl_base
4700{
4701 shared_ptr<class_tdecl> class_tmpl_;
4702
4703 // Forbidden
4705
4706public:
4707
4708 /// Hasher.
4709 struct hash;
4710
4712 access_specifier access, bool is_static)
4713 : type_or_decl_base(c->get_environment()),
4714 decl_base(c->get_environment(), c->get_name(), location()),
4715 member_base(access, is_static),
4716 class_tmpl_(c)
4717 {}
4718
4719 operator const class_tdecl& () const
4720 { return *class_tmpl_; }
4721
4723 as_class_tdecl() const
4724 {return class_tmpl_;}
4725
4726 virtual bool
4727 operator==(const member_base& o) const;
4728
4729 virtual bool
4730 operator==(const decl_base&) const;
4731
4732 virtual bool
4733 operator==(const member_class_template&) const;
4734
4735 virtual bool
4737};// end class member_class_template
4738
4739bool
4740operator==(const member_class_template_sptr& l,
4741 const member_class_template_sptr& r);
4742
4743bool
4744operator!=(const member_class_template_sptr& l,
4745 const member_class_template_sptr& r);
4746
4747/// A comparison functor for pointers to @ref var_decl.
4749{
4750 /// Return true if the two instances of @ref var_decl are equal.
4751 ///
4752 /// @param l the first variable to compare.
4753 ///
4754 /// @param r the second variable to compare.
4755 ///
4756 /// @return true if @p l equals @p r.
4757 bool
4758 operator()(const var_decl* l, const var_decl* r) const
4759 {
4760 if (l == r)
4761 return true;
4762 if (!!l != !!r)
4763 return false;
4764 return (*l == *r);
4765 }
4766};// end struct var_decl::ptr_equal
4767
4768/// Equality functor for instances of @ref function_decl
4770{
4771 /// Tests if two pointers to @ref function_decl are equal.
4772 ///
4773 /// @param l the first pointer to @ref function_decl to consider in
4774 /// the comparison.
4775 ///
4776 /// @param r the second pointer to @ref function_decl to consider in
4777 /// the comparison.
4778 ///
4779 /// @return true if the two functions @p l and @p r are equal, false
4780 /// otherwise.
4781 bool
4782 operator()(const function_decl* l, const function_decl* r) const
4783 {
4784 if (l == r)
4785 return true;
4786 if (!!l != !!r)
4787 return false;
4788 return (*l == *r);
4789 }
4790};// function_decl::ptr_equal
4791
4792/// The base class for the visitor type hierarchy used for traversing
4793/// a translation unit.
4794///
4795/// Client code willing to get notified for a certain kind of node
4796/// during the IR traversal might want to define a visitor class that
4797/// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4798/// or ir_node_visitor::visit_end() method of its choice, and provide
4799/// and implementation for it. If either
4800/// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4801/// return false, it means the traversal has to stop immediately after
4802/// the methods' return. If the methods return true, it means the
4803/// traversal keeps going.
4804///
4805/// That new visitor class would then be passed to e.g,
4806/// translation_unit::traverse or to the traverse method of any type
4807/// where the traversal is supposed to start from.
4809{
4810 struct priv;
4811 std::unique_ptr<priv> priv_;
4812
4813public:
4814
4816
4817 virtual ~ir_node_visitor();
4818
4824
4825 virtual bool visit_begin(decl_base*);
4826 virtual bool visit_end(decl_base*);
4827
4828 virtual bool visit_begin(scope_decl*);
4829 virtual bool visit_end(scope_decl*);
4830
4831 virtual bool visit_begin(type_base*);
4832 virtual bool visit_end(type_base*);
4833
4834 virtual bool visit_begin(scope_type_decl*);
4835 virtual bool visit_end(scope_type_decl*);
4836
4837 virtual bool visit_begin(type_decl*);
4838 virtual bool visit_end(type_decl*);
4839
4840 virtual bool visit_begin(namespace_decl*);
4841 virtual bool visit_end(namespace_decl*);
4842
4843 virtual bool visit_begin(qualified_type_def*);
4844 virtual bool visit_end(qualified_type_def*);
4845
4846 virtual bool visit_begin(pointer_type_def*);
4847 virtual bool visit_end(pointer_type_def*);
4848
4849 virtual bool visit_begin(reference_type_def*);
4850 virtual bool visit_end(reference_type_def*);
4851
4852 virtual bool visit_begin(ptr_to_mbr_type*);
4853 virtual bool visit_end(ptr_to_mbr_type*);
4854
4855 virtual bool visit_begin(array_type_def*);
4856 virtual bool visit_end(array_type_def*);
4857
4858 virtual bool visit_begin(array_type_def::subrange_type*);
4859 virtual bool visit_end(array_type_def::subrange_type*);
4860
4861 virtual bool visit_begin(enum_type_decl*);
4862 virtual bool visit_end(enum_type_decl*);
4863
4864 virtual bool visit_begin(typedef_decl*);
4865 virtual bool visit_end(typedef_decl*);
4866
4867 virtual bool visit_begin(function_type*);
4868 virtual bool visit_end(function_type*);
4869
4870 virtual bool visit_begin(var_decl*);
4871 virtual bool visit_end(var_decl*);
4872
4873 virtual bool visit_begin(function_decl*);
4874 virtual bool visit_end(function_decl*);
4875
4876 virtual bool visit_begin(function_decl::parameter*);
4877 virtual bool visit_end(function_decl::parameter*);
4878
4879 virtual bool visit_begin(function_tdecl*);
4880 virtual bool visit_end(function_tdecl*);
4881
4882 virtual bool visit_begin(class_tdecl*);
4883 virtual bool visit_end(class_tdecl*);
4884
4885 virtual bool visit_begin(class_or_union *);
4886 virtual bool visit_end(class_or_union *);
4887
4888 virtual bool visit_begin(class_decl*);
4889 virtual bool visit_end(class_decl*);
4890
4891 virtual bool visit_begin(union_decl*);
4892 virtual bool visit_end(union_decl*);
4893
4894 virtual bool visit_begin(class_decl::base_spec*);
4895 virtual bool visit_end(class_decl::base_spec*);
4896
4897 virtual bool visit_begin(member_function_template*);
4898 virtual bool visit_end(member_function_template*);
4899
4900 virtual bool visit_begin(member_class_template*);
4901 virtual bool visit_end(member_class_template*);
4902}; // end struct ir_node_visitor
4903
4904// Debugging facility
4905void
4906fns_to_str(vector<function_decl*>::const_iterator a_begin,
4907 vector<function_decl*>::const_iterator a_end,
4908 vector<function_decl*>::const_iterator b_begin,
4909 vector<function_decl*>::const_iterator b_end,
4910 std::ostream& o);
4911
4912}// end namespace ir
4913} // end namespace abigail
4914#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:2589
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition: abg-ir.cc:19170
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:19138
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:19131
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition: abg-ir.cc:19145
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition: abg-ir.cc:19182
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition: abg-ir.cc:19153
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition: abg-ir.cc:19103
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition: abg-ir.cc:19160
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition: abg-ir.h:2574
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition: abg-ir.cc:19361
bool is_non_finite() const
Test if the length of the subrange type is infinite.
Definition: abg-ir.cc:19388
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition: abg-ir.cc:19354
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:19328
string as_string() const
Return a string representation of the sub range.
Definition: abg-ir.cc:19410
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:19309
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19610
bool operator!=(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:19549
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition: abg-ir.cc:19340
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:19320
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:19505
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition: abg-ir.cc:19347
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:19588
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition: abg-ir.cc:19433
uint64_t get_length() const
Getter of the length of the subrange type.
Definition: abg-ir.cc:19371
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition: abg-ir.cc:19403
The abstraction of an array type.
Definition: abg-ir.h:2548
virtual bool is_non_finite() const
Definition: abg-ir.cc:20027
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:20057
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:19717
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition: abg-ir.cc:19988
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition: abg-ir.cc:20003
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition: abg-ir.h:2566
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:20120
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition: abg-ir.cc:20147
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:19966
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition: abg-ir.h:2569
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:19770
translation_unit::language get_language() const
Get the language of the array.
Definition: abg-ir.cc:19955
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition: abg-ir.cc:20013
Abstraction of a base specifier in a class declaration.
Definition: abg-ir.h:4362
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition: abg-ir.cc:25287
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition: abg-ir.cc:25294
long get_offset_in_bits() const
Getter of the offset of the base.
Definition: abg-ir.cc:25301
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:25276
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:25317
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition: abg-ir.cc:25411
Abstracts a class declaration.
Definition: abg-ir.h:4175
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:25814
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition: abg-ir.cc:25867
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:25153
bool is_struct() const
Test if the class is a struct.
Definition: abg-ir.cc:25091
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:25930
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition: abg-ir.cc:25108
virtual ~class_decl()
Destructor of the class_decl type.
Definition: abg-ir.cc:26444
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:25069
bool has_vtable() const
Test if the current instance has a vtable.
Definition: abg-ir.cc:25895
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition: abg-ir.cc:25909
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition: abg-ir.cc:25876
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26360
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition: abg-ir.h:4193
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition: abg-ir.cc:25098
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition: abg-ir.cc:25134
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition: abg-ir.cc:25158
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition: abg-ir.cc:26028
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition: abg-ir.cc:26208
class_decl_sptr find_base_class(const string &qualified_name) const
Find a base class of a given qualified name for the current class.
Definition: abg-ir.cc:25118
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:26747
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition: abg-ir.cc:25858
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition: abg-ir.h:4194
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:25179
The base type of class_decl and union_decl.
Definition: abg-ir.h:3977
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition: abg-ir.cc:24026
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:24267
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:24192
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition: abg-ir.cc:24295
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:25814
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition: abg-ir.cc:23912
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition: abg-ir.cc:24371
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition: abg-ir.cc:24011
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition: abg-ir.cc:24044
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition: abg-ir.cc:24385
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition: abg-ir.h:4009
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition: abg-ir.h:4008
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition: abg-ir.cc:24151
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:23802
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition: abg-ir.h:4010
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:24093
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:24346
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:24330
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition: abg-ir.cc:23995
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition: abg-ir.cc:24427
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:23900
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:23818
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition: abg-ir.cc:24399
const data_members & get_non_static_data_members() const
Get the non-static data members of this class_or_union.
Definition: abg-ir.cc:24242
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:24304
const data_members & get_static_data_members() const
Get the static data memebers of this class_or_union.
Definition: abg-ir.cc:24250
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:23937
vector< var_decl_sptr > data_members
Convenience typedef.
Definition: abg-ir.h:4007
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition: abg-ir.cc:23891
bool has_no_member() const
Definition: abg-ir.cc:24412
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:24461
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:26747
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition: abg-ir.cc:23963
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition: abg-ir.cc:24378
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition: abg-ir.cc:23979
vector< type_base_sptr > member_types
Convenience typedef.
Definition: abg-ir.h:4006
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition: abg-ir.cc:24062
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:24162
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition: abg-ir.cc:24531
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition: abg-ir.h:4011
Abstract a class template.
Definition: abg-ir.h:3797
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition: abg-ir.cc:28139
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition: abg-ir.cc:28128
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:28188
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:28143
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition: abg-ir.h:1285
bool operator!=(const context_rel &o) const
Inequality operator.
Definition: abg-ir.h:1351
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:1585
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition: abg-ir.cc:16248
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:5005
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition: abg-ir.cc:5220
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current decl.
Definition: abg-ir.cc:4894
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition: abg-ir.cc:4792
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition: abg-ir.cc:4523
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:4585
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:5575
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition: abg-ir.cc:4953
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition: abg-ir.cc:4767
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:4989
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition: abg-ir.cc:4823
void clear_qualified_name()
Clear the qualified name of this decl.
Definition: abg-ir.cc:4516
virtual void set_name(const string &n)
Setter for the name of the decl.
Definition: abg-ir.cc:4655
const location & get_location() const
Get the location of a given declaration.
Definition: abg-ir.cc:4605
binding
ELF binding.
Definition: abg-ir.h:1636
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
Definition: abg-ir.cc:4715
virtual const interned_string & get_name() const
Getter for the name of the current decl.
Definition: abg-ir.cc:4811
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition: abg-ir.cc:5247
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition: abg-ir.cc:4507
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition: abg-ir.cc:4557
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition: abg-ir.cc:4668
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:8450
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:26838
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition: abg-ir.cc:4945
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:4973
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5544
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition: abg-ir.cc:8475
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition: abg-ir.cc:4733
void set_location(const location &l)
Set the location for a given declaration.
Definition: abg-ir.cc:4643
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition: abg-ir.cc:4678
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition: abg-ir.cc:4784
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4550
visibility get_visibility() const
Getter for the visibility of the decl.
Definition: abg-ir.cc:4777
visibility
ELF visibility.
Definition: abg-ir.h:1626
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition: abg-ir.cc:4996
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:5236
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition: abg-ir.cc:4961
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition: abg-ir.cc:4760
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5515
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition: abg-ir.cc:6641
virtual ~decl_base()
Destructor of the decl_base type.
Definition: abg-ir.cc:5224
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:5209
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:4804
bool get_is_anonymous_or_has_anonymous_parent() const
Definition: abg-ir.cc:4701
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition: abg-ir.cc:4690
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:4577
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition: abg-ir.cc:5138
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4536
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:4846
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:5069
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:21468
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition: abg-ir.h:3003
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:3344
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition: abg-ir.cc:3354
The abstraction of the version of an ELF symbol.
Definition: abg-ir.h:1232
version & operator=(const version &o)
Assign a version to the current one.
Definition: abg-ir.cc:3257
bool operator==(const version &o) const
Compares the current version against another one.
Definition: abg-ir.cc:3239
bool is_default() const
Getter for the 'is_default' property of the version.
Definition: abg-ir.cc:3219
const string & str() const
Getter for the version name.
Definition: abg-ir.cc:3205
bool operator!=(const version &o) const
Inequality operator.
Definition: abg-ir.cc:3248
Abstraction of an elf symbol.
Definition: abg-ir.h:961
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition: abg-ir.cc:2342
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:2665
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition: abg-ir.cc:2560
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2176
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition: abg-ir.cc:2397
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2321
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition: abg-ir.cc:2426
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition: abg-ir.cc:2166
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition: abg-ir.cc:2358
binding
The binding of a symbol.
Definition: abg-ir.h:978
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition: abg-ir.cc:2433
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:2686
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2211
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition: abg-ir.cc:2571
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition: abg-ir.cc:2450
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition: abg-ir.cc:2367
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition: abg-ir.cc:2299
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition: abg-ir.cc:2496
void set_size(size_t)
Setter of the size of the symbol.
Definition: abg-ir.cc:2197
const string & get_name() const
Getter for the name of the elf_symbol.
Definition: abg-ir.cc:2159
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2204
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:2752
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition: abg-ir.cc:2290
type
The type of a symbol.
Definition: abg-ir.h:965
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition: abg-ir.cc:2225
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition: abg-ir.cc:2328
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2236
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition: abg-ir.cc:2811
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition: abg-ir.cc:2411
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition: abg-ir.cc:2335
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:2063
visibility
The visibility of the symbol.
Definition: abg-ir.h:987
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition: abg-ir.cc:2218
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition: abg-ir.cc:2529
void set_index(size_t)
Setter for the index.
Definition: abg-ir.cc:2152
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2244
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition: abg-ir.cc:2545
size_t get_index() const
Getter for the index.
Definition: abg-ir.cc:2145
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition: abg-ir.cc:2616
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:2643
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition: abg-ir.cc:2138
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2183
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition: abg-ir.cc:2274
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2313
size_t get_size() const
Getter of the size of the symbol.
Definition: abg-ir.cc:2190
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition: abg-ir.cc:2252
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition: abg-ir.cc:2349
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition: abg-ir.cc:2418
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:2797
The abstraction of an enumerator.
Definition: abg-ir.h:2881
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:20830
bool operator!=(const enumerator &other) const
Inequality operator.
Definition: abg-ir.cc:20890
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition: abg-ir.cc:20932
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition: abg-ir.cc:20954
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition: abg-ir.cc:20899
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition: abg-ir.cc:20961
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:20947
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:20916
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:20940
bool operator==(const enumerator &other) const
Equality operator.
Definition: abg-ir.cc:20877
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:20861
Abstracts a declaration for an enum type.
Definition: abg-ir.h:2785
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:20393
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition: abg-ir.h:2801
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:20220
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition: abg-ir.cc:20381
const enumerators & get_enumerators() const
Definition: abg-ir.cc:20233
bool find_enumerator_by_value(int64_t value, enum_type_decl::enumerator &result)
Find an enumerator by its value.
Definition: abg-ir.cc:20279
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
Definition: abg-ir.cc:20245
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:20359
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition: abg-ir.cc:20228
bool find_enumerator_by_name(const string &name, enum_type_decl::enumerator &result)
Find an enumerator by its name.
Definition: abg-ir.cc:20303
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:20751
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:20334
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition: abg-ir.h:148
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
Definition: abg-ir.cc:3591
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:3658
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:158
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:3738
const vector< type_base_sptr > * get_canonical_types(const char *name) const
Get the vector of canonical types which have a given "string representation".
Definition: abg-ir.cc:3875
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:3468
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:3690
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition: abg-ir.cc:3519
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:3487
const config & get_config() const
Getter of the general configuration object.
Definition: abg-ir.cc:3728
environment()
Default constructor of the environment type.
Definition: abg-ir.cc:3369
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition: abg-ir.cc:3531
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:3898
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:3506
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:3627
virtual ~environment()
Destructor for the environment type.
Definition: abg-ir.cc:3374
bool canonicalization_started() const
Getter of a flag saying if the canonicalization process has started or not.
Definition: abg-ir.cc:3558
interned_string intern(const string &) const
Do intern a string.
Definition: abg-ir.cc:3721
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:28327
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:3764
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition: abg-ir.cc:3382
Abstraction of a function parameter.
Definition: abg-ir.h:3335
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition: abg-ir.cc:23636
interned_string get_type_name() const
Definition: abg-ir.cc:23435
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition: abg-ir.cc:23473
const string get_type_pretty_representation() const
Definition: abg-ir.cc:23454
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition: abg-ir.cc:23612
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:23656
Abstraction for a function declaration.
Definition: abg-ir.h:3165
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3187
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:22836
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition: abg-ir.cc:22907
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:23297
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition: abg-ir.cc:22987
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition: abg-ir.cc:23212
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition: abg-ir.cc:22873
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition: abg-ir.cc:22892
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:22699
const type_base_sptr get_return_type() const
Definition: abg-ir.cc:22968
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition: abg-ir.cc:23000
const std::vector< parameter_sptr > & get_parameters() const
Definition: abg-ir.cc:22973
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition: abg-ir.cc:22980
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition: abg-ir.cc:22929
virtual ~function_decl()
Destructor of the function_decl type.
Definition: abg-ir.cc:23313
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:22945
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition: abg-ir.cc:23198
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3190
bool is_declared_inline() const
Test if the function was declared inline.
Definition: abg-ir.cc:22952
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:22768
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:23228
Abstract a function template declaration.
Definition: abg-ir.h:3752
binding get_binding() const
Get the binding of the function template.
Definition: abg-ir.cc:27976
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition: abg-ir.cc:27958
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition: abg-ir.cc:27969
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:28036
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition: abg-ir.cc:27985
Abstraction of a function type.
Definition: abg-ir.h:3420
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3430
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition: abg-ir.cc:22081
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:21941
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:22360
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition: abg-ir.cc:22048
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:22257
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:21848
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition: abg-ir.cc:22319
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:22033
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition: abg-ir.cc:22010
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition: abg-ir.cc:22277
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:21989
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition: abg-ir.cc:21952
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition: abg-ir.cc:21960
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:22235
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition: abg-ir.cc:21969
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3432
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:22343
This abstracts the global scope of a given translation unit.
Definition: abg-ir.h:1982
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition: abg-ir.h:4809
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:30051
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition: abg-ir.cc:30100
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition: abg-ir.cc:30090
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition: abg-ir.cc:30030
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition: abg-ir.cc:30061
The entry point to manage locations.
Definition: abg-ir.h:449
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:507
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:530
The source location of a token.
Definition: abg-ir.h:307
location()
Default constructor for the location type.
Definition: abg-ir.h:389
bool get_is_artificial() const
Test if the location is artificial.
Definition: abg-ir.h:348
bool operator<(const location &other) const
"Less than" operator of the location type.
Definition: abg-ir.h:421
location & operator=(const location &l)
Assignment operator of the location.
Definition: abg-ir.h:380
bool operator==(const location &other) const
Equality operator of the location type.
Definition: abg-ir.h:411
location(const location &l)
Copy constructor of the location.
Definition: abg-ir.h:370
unsigned get_value() const
Get the value of the location.
Definition: abg-ir.h:395
void set_is_artificial(bool f)
Set the artificial-ness of the location.
Definition: abg-ir.h:364
string expand(void) const
Expand the location into a string.
Definition: abg-ir.cc:472
Abstraction of a member function context relationship. This relates a member function to its parent c...
Definition: abg-ir.h:4495
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition: abg-ir.h:4573
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition: abg-ir.h:4563
bool is_const() const
Getter for the 'is-const' property.
Definition: abg-ir.h:4608
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition: abg-ir.h:4598
void is_const(bool f)
Setter for the 'is-const' property.
Definition: abg-ir.h:4616
size_t vtable_offset() const
Getter for the vtable offset property.
Definition: abg-ir.h:4553
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition: abg-ir.h:4581
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition: abg-ir.h:4590
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition: abg-ir.h:3839
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition: abg-ir.h:3859
bool get_is_static() const
Definition: abg-ir.h:3871
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition: abg-ir.h:3866
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition: abg-ir.h:3878
Abstracts a member class template template.
Definition: abg-ir.h:4700
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition: abg-ir.cc:26607
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26692
Abstract a member function template.
Definition: abg-ir.h:4645
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26586
Abstraction of the declaration of a method.
Definition: abg-ir.h:3887
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition: abg-ir.cc:6538
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition: abg-ir.cc:25558
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition: abg-ir.cc:6425
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition: abg-ir.cc:6578
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition: abg-ir.cc:6395
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition: abg-ir.cc:6482
const method_type_sptr get_type() const
Definition: abg-ir.cc:25585
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:6567
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition: abg-ir.cc:6454
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition: abg-ir.cc:6510
Abstracts the type of a class member function.
Definition: abg-ir.h:3506
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:22561
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:22542
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition: abg-ir.cc:22593
bool get_is_for_static_method() const
Test if the current method type is for a static method or not.
Definition: abg-ir.cc:22608
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:9243
virtual ~method_type()
The destructor of method_type.
Definition: abg-ir.cc:22641
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:22585
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition: abg-ir.cc:22552
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition: abg-ir.cc:22600
The abstraction of a namespace declaration.
Definition: abg-ir.h:2207
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:17369
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17400
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
Definition: abg-ir.cc:17303
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition: abg-ir.cc:17355
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:17341
Abstracts non type template parameters.
Definition: abg-ir.h:3662
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition: abg-ir.cc:27674
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:27679
The abstraction of a pointer type.
Definition: abg-ir.h:2350
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition: abg-ir.cc:18062
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:18188
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:18052
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:17979
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18282
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition: abg-ir.cc:18124
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition: abg-ir.cc:18168
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition: abg-ir.cc:18175
The abstraction of a pointer-to-member type.
Definition: abg-ir.h:2485
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Get the qualified name for the current ptr_to_mbr_type.
Definition: abg-ir.cc:18952
virtual const interned_string & get_name() const
Getter of the name of the current ptr-to-mbr-type.
Definition: abg-ir.cc:18862
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:18875
const type_base_sptr & get_containing_type() const
Getter of the type containing the member pointed-to by the current ptr_to_mbr_type.
Definition: abg-ir.cc:18895
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
Definition: abg-ir.cc:18936
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function for ptr_to_mbr_type.
Definition: abg-ir.cc:19003
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
Definition: abg-ir.cc:18886
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
Definition: abg-ir.cc:19028
The abstraction of a qualified type.
Definition: abg-ir.h:2236
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:17705
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition: abg-ir.cc:17830
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition: abg-ir.cc:17569
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:17557
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:17818
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition: abg-ir.h:2255
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:17495
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition: abg-ir.cc:17809
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17778
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition: abg-ir.cc:17804
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition: abg-ir.cc:17823
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition: abg-ir.cc:17649
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition: abg-ir.cc:17472
Abstracts a reference type.
Definition: abg-ir.h:2416
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:18611
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:18474
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:18376
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18733
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:18484
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition: abg-ir.cc:18553
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:18712
A declaration that introduces a scope.
Definition: abg-ir.h:1853
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition: abg-ir.cc:7921
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition: abg-ir.cc:8130
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition: abg-ir.cc:8088
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition: abg-ir.cc:8105
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition: abg-ir.cc:8475
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition: abg-ir.cc:7939
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition: abg-ir.cc:7974
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition: abg-ir.h:1864
bool is_empty() const
Test if the current scope is empty.
Definition: abg-ir.cc:7988
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:8420
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition: abg-ir.cc:8063
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition: abg-ir.h:1862
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:8198
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition: abg-ir.h:1860
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:8494
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:7857
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:8372
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition: abg-ir.cc:8223
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:8034
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:8074
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7881
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:7845
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition: abg-ir.cc:8149
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:8450
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:8326
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7899
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition: abg-ir.cc:7957
A type that introduces a scope.
Definition: abg-ir.h:2184
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:17262
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition: abg-ir.cc:17224
The base class of templates.
Definition: abg-ir.h:3567
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:27349
virtual ~template_decl()
Destructor.
Definition: abg-ir.cc:27374
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:27341
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:27383
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition: abg-ir.h:3599
virtual ~template_parameter()
Destructor.
Definition: abg-ir.cc:27503
bool operator!=(const template_parameter &) const
Inequality operator.
Definition: abg-ir.cc:27499
Abstracts a template template parameter.
Definition: abg-ir.h:3695
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:27752
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
Definition: abg-ir.h:695
void set_address_size(char)
Setter of the address size in this translation unit.
Definition: abg-ir.cc:1426
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:1341
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:1458
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
Definition: abg-ir.cc:1468
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
Definition: abg-ir.cc:1384
char get_address_size() const
Getter of the address size in this translation unit.
Definition: abg-ir.cc:1419
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:1322
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:15197
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
Definition: abg-ir.cc:1368
void set_language(language l)
Setter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1285
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:1494
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
Definition: abg-ir.cc:1221
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
Definition: abg-ir.cc:1408
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:1442
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:15280
const std::string & get_path() const
Get the path of the current translation unit.
Definition: abg-ir.cc:1298
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:1333
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
Definition: abg-ir.cc:1392
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
Definition: abg-ir.cc:1309
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
Definition: abg-ir.cc:1528
language
The language of the translation unit.
Definition: abg-ir.h:708
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition: abg-ir.h:704
bool operator!=(const translation_unit &) const
Inequality operator.
Definition: abg-ir.cc:1483
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:1264
const environment & get_environment() const
Getter of the environment of the current translation_unit.
Definition: abg-ir.cc:1271
const type_maps & get_types() const
Getter of the types of the current translation_unit.
Definition: abg-ir.cc:1248
language get_language() const
Getter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1278
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:2003
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
Definition: abg-ir.cc:16331
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition: abg-ir.cc:16307
friend type_base_sptr canonicalize(type_base_sptr, bool, bool)
Compute the canonical type of a given type.
Definition: abg-ir.cc:16169
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition: abg-ir.cc:16410
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:16277
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:16436
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:16010
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition: abg-ir.cc:16403
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition: abg-ir.cc:16396
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition: abg-ir.cc:16386
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition: abg-ir.cc:16424
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition: abg-ir.cc:16417
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition: abg-ir.cc:16291
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition: abg-ir.h:3730
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition: abg-ir.cc:27858
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition: abg-ir.cc:27865
A basic type declaration that introduces no scope.
Definition: abg-ir.h:2118
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:17056
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:16896
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17135
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:16994
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:16950
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:17115
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Definition: abg-ir.h:602
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:651
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:754
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:705
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:609
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:623
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:719
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:637
bool empty() const
Test if the type_maps is empty.
Definition: abg-ir.cc:577
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:664
istring_type_base_wptrs_map_type & ptr_to_mbr_types()
Getter for the map that associates the name of a pointer-to-member type to the vector of instances of...
Definition: abg-ir.cc:684
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:1157
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:677
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:595
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:740
The base class of both types and declarations.
Definition: abg-ir.h:1406
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4278
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4091
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition: abg-ir.cc:4080
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition: abg-ir.cc:4238
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition: abg-ir.cc:4245
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:4041
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition: abg-ir.cc:4270
friend hash_t set_or_get_cached_hash_value(const T &type_or_decl)
Set the hash value of an IR node and return it.
Definition: abg-ir-priv.h:414
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:4191
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition: abg-ir.cc:4114
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4103
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition: abg-ir.cc:4303
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition: abg-ir.cc:4134
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition: abg-ir.cc:11100
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:4061
friend hash_t peek_hash_value(const type_or_decl_base &)
Get the hash value associated to an IR node.
Definition: abg-ir.cc:28461
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:4169
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition: abg-ir.cc:10705
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition: abg-ir.cc:4220
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:1418
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition: abg-ir.cc:4202
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:4031
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:4051
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition: abg-ir.cc:10778
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4295
Abstracts a type template parameter.
Definition: abg-ir.h:3628
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:27545
The abstraction of a typedef declaration.
Definition: abg-ir.h:2935
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
Definition: abg-ir.cc:21216
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition: abg-ir.cc:21201
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition: abg-ir.cc:21056
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:21043
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21248
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition: abg-ir.cc:21194
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:21136
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition: abg-ir.cc:21073
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:21177
Abstracts a union type declaration.
Definition: abg-ir.h:4420
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition: abg-ir.cc:27026
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:27143
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition: abg-ir.cc:27083
virtual ~union_decl()
Destructor of the union_decl type.
Definition: abg-ir.cc:27216
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:27050
Abstracts a variable declaration.
Definition: abg-ir.h:3068
binding get_binding() const
Getter of the binding of the variable.
Definition: abg-ir.cc:21362
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition: abg-ir.cc:21344
void set_binding(binding b)
Setter of the binding of the variable.
Definition: abg-ir.cc:21369
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition: abg-ir.cc:6199
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition: abg-ir.cc:21407
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:21658
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:21355
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition: abg-ir.cc:6344
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:21337
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21820
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:21797
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition: abg-ir.cc:6273
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition: abg-ir.cc:21384
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:6167
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:6330
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:21400
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition: abg-ir.cc:21593
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:21688
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:21612
string get_pretty_representation(diff *d)
Get a copy of the pretty representation of a diff node.
real_type::modifiers_type operator~(real_type::modifiers_type l)
Bitwise one's complement operator for real_type::modifiers_type.
Definition: abg-ir.cc:16493
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition: abg-fwd.h:235
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:20393
hash_t peek_hash_value(const type_or_decl_base &artefact)
Get the hash value associated to an IR node.
Definition: abg-ir.cc:28461
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
Definition: abg-fwd.h:221
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:572
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:269
access_specifier
Access specifier for class members.
Definition: abg-ir.h:917
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition: abg-ir.cc:23279
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
Definition: abg-fwd.h:289
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
Definition: abg-corpus.cc:1788
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:25814
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two array types are equals modulo CV qualifiers.
Definition: abg-ir.cc:19850
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:559
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
Definition: abg-ir.cc:1540
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
Definition: abg-fwd.h:128
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:26501
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:12141
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:926
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:564
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1361
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition: abg-ir.h:1365
@ 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:1381
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition: abg-ir.h:1376
@ 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:1370
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:1849
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
Definition: abg-ir.h:127
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
Definition: abg-fwd.h:244
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:9286
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition: abg-ir.h:942
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
Definition: abg-fwd.h:314
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition: abg-fwd.h:193
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:3064
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:30475
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:8686
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5544
abg_compat::optional< uint64_t > hash_t
The abstraction for an 8 bytes hash value.
Definition: abg-ir.h:105
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition: abg-fwd.h:210
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition: abg-fwd.h:167
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:2936
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:21468
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:3448
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
Definition: abg-corpus.cc:1774
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:3145
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition: abg-ir.cc:1808
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:934
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:8494
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:148
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:28651
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition: abg-ir.cc:2867
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:256
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
Definition: abg-corpus.cc:1802
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition: abg-fwd.h:264
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:3097
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:120
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
Definition: abg-fwd.h:136
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:951
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition: abg-ir.h:1275
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:939
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:12594
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition: abg-ir.cc:1824
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10682
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition: abg-ir.cc:5138
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:3122
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition: abg-ir.h:929
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition: abg-fwd.h:226
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
Definition: abg-ir.cc:20474
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:1670
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:28997
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition: abg-ir.cc:11985
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition: abg-ir.cc:1792
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:25647
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5515
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition: abg-fwd.h:175
vector< type_base * > type_base_ptrs_type
Helper typedef for a vector of pointer to type_base.
Definition: abg-ir.h:124
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
Definition: abg-ir.h:99
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
Definition: abg-ir.cc:8766
translation_unit * get_translation_unit(const type_or_decl_base &t)
Return the translation unit a declaration belongs to.
Definition: abg-ir.cc:10461
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:577
vector< namespace_decl_sptr > namespaces_type
A convenience typedef for vectors of namespace_decl_sptr.
Definition: abg-ir.h:2229
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:9071
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
Definition: abg-fwd.h:306
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:8656
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:889
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:28954
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition: abg-fwd.h:161
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:121
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
Definition: abg-ir.cc:1833
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:584
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
Definition: abg-corpus.cc:1816
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:1868
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10653
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:3155
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:947
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:24760
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
Definition: abg-fwd.h:294
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:568
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:5069
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
Definition: abg-ir.cc:151
A functor to hash instances of interned_string.
Hash functor for instances of array_type_def::hash.
Definition: abg-hash.h:187
Hash functor for instances of array_type_def::subrange_type.
Definition: abg-hash.h:177
Functor to hash a canonical type by using its pointer value.
Definition: abg-ir.h:112
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:7783
The hashing functor for class_decl::base_spec.
Definition: abg-hash.h:260
Hasher for the class_decl type.
Definition: abg-hash.h:270
Hasher for the class_or_union type.
Definition: abg-hash.h:250
Hash functor for instances of enum_type_decl.
Definition: abg-hash.h:197
The private data of the environment type.
Definition: abg-ir-priv.h:539
Equality functor for instances of function_decl.
Definition: abg-ir.h:4770
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition: abg-ir.h:4782
The hashing functor for function_type.
Definition: abg-hash.h:217
The type of the private data of the function_type type.
Definition: abg-ir-priv.h:1801
The base of an entity of the intermediate representation that is to be traversed.
Definition: abg-ir.h:470
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:30013
The hashing functor for member_base.
Definition: abg-hash.h:243
Hashing functor for the method_type type.
Definition: abg-hash.h:230
The base class for the visitor type hierarchy used for traversing a hierarchy of nodes.
Definition: abg-traverse.h:28
Hash functor for instances of pointer_type_def.
Definition: abg-hash.h:144
Hash functor for instances of ptr_to_mbr_type.
Definition: abg-hash.h:164
Hash functor for instances of qualified_type_def.
Definition: abg-hash.h:134
Hash functor for instances of reference_type_def.
Definition: abg-hash.h:154
A comparison functor to compare translation units based on their absolute paths.
Definition: abg-ir.h:872
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:881
Private type to hold private members of translation_unit.
Definition: abg-ir-priv.h:151
Hash functor for instances of type_base.
Definition: abg-hash.h:111
Definition of the private data of type_base.
Definition: abg-ir-priv.h:462
Hash functor for instances of type_decl.
Definition: abg-hash.h:124
The private data of type_or_decl_base.
Definition: abg-ir-priv.h:187
A comparison functor to compare pointer to instances of type_or_decl_base.
Definition: abg-ir.h:3294
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:3328
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition: abg-ir.h:3303
The comparison functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:484
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:518
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:498
The hashing functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:526
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:536
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:551
A predicate for deep equality of instances of type_base*.
Definition: abg-ir.h:2076
A predicate for deep equality of instances of shared_ptr<type_base>
Definition: abg-ir.h:2096
Hash functor for instances of typedef_decl.
Definition: abg-hash.h:207
Hash functor for instances of union_decl type.
Definition: abg-hash.h:280
A comparison functor for pointers to var_decl.
Definition: abg-ir.h:4749
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:4758