libabigail
Loading...
Searching...
No Matches
abg-ir.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// -*- Mode: C++ -*-
3//
4// Copyright (C) 2013-2026 Red Hat, Inc.
5//
6// Author: Dodji Seketeli
7
8/// @file
9///
10/// Types of the main internal representation of libabigail.
11///
12/// This internal representation abstracts the artifacts that make up
13/// an application binary interface.
14
15#ifndef __ABG_IR_H__
16#define __ABG_IR_H__
17
18#include <assert.h>
19#include <stdint.h>
20#include <cstdlib>
21#include <functional>
22#include <set>
23#include <unordered_map>
24#include "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}; // end class enum_type_decl
2862
2863bool
2865
2866bool
2868
2869/// The abstraction of an enumerator
2871{
2872 class priv;
2873 std::unique_ptr<priv> priv_;
2874
2875public:
2876
2877 enumerator();
2878
2879 ~enumerator();
2880
2881 enumerator(const string& name, int64_t value);
2882
2883 enumerator(const enumerator&);
2884
2885 enumerator&
2886 operator=(const enumerator&);
2887
2888 bool
2889 operator==(const enumerator& other) const;
2890
2891 bool
2892 operator!=(const enumerator& other) const;
2893
2894 const string&
2895 get_name() const;
2896
2897 const string&
2898 get_qualified_name(bool internal = false) const;
2899
2900 void
2901 set_name(const string& n);
2902
2903 int64_t
2904 get_value() const;
2905
2906 void
2907 set_value(int64_t v);
2908
2910 get_enum_type() const;
2911
2912 void
2914}; // end class enum_type_def::enumerator
2915
2916bool
2918 const enum_type_decl &enom);
2919
2920bool
2922
2923/// The abstraction of a typedef declaration.
2924class typedef_decl : public virtual type_base, public virtual decl_base
2925{
2926 struct priv;
2927 std::unique_ptr<priv> priv_;
2928
2929 // Forbidden
2930 typedef_decl();
2931
2932public:
2933
2934 /// Hasher for the typedef_decl type.
2935 struct hash;
2936
2937 typedef_decl(const string& name,
2938 const type_base_sptr underlying_type,
2939 const location& locus,
2940 const string& mangled_name = "",
2941 visibility vis = VISIBILITY_DEFAULT);
2942
2943 typedef_decl(const string& name,
2944 const environment& env,
2945 const location& locus,
2946 const string& mangled_name = "",
2947 visibility vis = VISIBILITY_DEFAULT);
2948
2949 virtual hash_t
2950 hash_value() const;
2951
2952 virtual size_t
2953 get_size_in_bits() const;
2954
2955 virtual size_t
2956 get_alignment_in_bits() const;
2957
2958 virtual bool
2959 operator==(const decl_base&) const;
2960
2961 virtual bool
2962 operator==(const type_base&) const;
2963
2964 virtual string
2965 get_pretty_representation(bool internal = false,
2966 bool qualified_name = true) const;
2967
2968 type_base_sptr
2969 get_underlying_type() const;
2970
2971 void
2972 set_underlying_type(const type_base_sptr&);
2973
2974 virtual void
2975 get_qualified_name(interned_string& qualified_name,
2976 bool internal = false) const;
2977
2978 virtual const interned_string&
2979 get_qualified_name(bool internal = false) const;
2980
2981 virtual bool
2983
2984 virtual ~typedef_decl();
2985};// end class typedef_decl
2986
2987/// The abstraction for a data member context relationship. This
2988/// relates a data member to its parent class.
2989///
2990/// The relationship carries properties like the offset of the data
2991/// member, if applicable.
2993{
2994protected:
2995 struct priv;
2996 std::unique_ptr<priv> priv_;
2997
2998public:
3000
3002 bool is_laid_out,
3003 size_t offset_in_bits,
3005 bool is_static);
3006
3008
3009 bool
3010 get_is_laid_out() const;
3011
3012 void
3013 set_is_laid_out(bool f);
3014
3015 size_t
3016 get_offset_in_bits() const;
3017
3018 void
3019 set_offset_in_bits(size_t o);
3020
3021 const var_decl*
3023
3024 void
3026
3027 bool
3028 operator==(const dm_context_rel& o) const;
3029
3030 bool
3031 operator!=(const dm_context_rel& o) const;
3032
3033 virtual ~dm_context_rel();
3034};// end class class_decl::dm_context_rel
3035
3036bool
3037equals(const var_decl&, const var_decl&, change_kind*);
3038
3039bool
3041
3042bool
3044
3045bool
3047 const array_type_def_sptr& r);
3048
3049bool
3051
3052bool
3054 const pointer_type_def_sptr&);
3055
3056/// Abstracts a variable declaration.
3057class var_decl : public virtual decl_base
3058{
3059 struct priv;
3060 std::unique_ptr<priv> priv_;
3061
3062 // Forbidden
3063 var_decl();
3064
3065 virtual void
3066 set_scope(scope_decl*);
3067
3068public:
3069
3070 /// Equality functor to compare pointers to variable_decl.
3071 struct ptr_equal;
3072
3073 var_decl(const string& name,
3074 type_base_sptr type,
3075 const location& locus,
3076 const string& mangled_name,
3077 visibility vis = VISIBILITY_DEFAULT,
3078 binding bind = BINDING_NONE);
3079
3080 virtual bool
3081 operator==(const decl_base&) const;
3082
3083 const type_base_sptr
3084 get_type() const;
3085
3086 void
3087 set_type(type_base_sptr&);
3088
3089 const type_base*
3090 get_naked_type() const;
3091
3092 binding
3093 get_binding() const;
3094
3095 void
3097
3098 void
3099 set_symbol(const elf_symbol_sptr& sym);
3100
3101 const elf_symbol_sptr&
3102 get_symbol() const;
3103
3105 clone() const;
3106
3108 get_id() const;
3109
3110 virtual const interned_string&
3111 get_qualified_name(bool internal = false) const;
3112
3113 virtual string
3114 get_pretty_representation(bool internal = false,
3115 bool qualified_name = true) const;
3116
3117 string
3118 get_anon_dm_reliable_name(bool qualified = true) const;
3119
3120 virtual bool
3122
3123 virtual ~var_decl();
3124
3125 friend void
3127
3128 friend uint64_t
3130
3131 friend uint64_t
3133
3134 friend uint64_t
3136
3137 friend uint64_t
3139
3140 friend void
3142
3143 friend bool
3145
3146 friend bool
3148}; // end class var_decl
3149
3150bool
3152
3153/// Abstraction for a function declaration.
3154class function_decl : public virtual decl_base
3155{
3156 struct priv;
3157 // This priv pointer is not handled by a shared_ptr because
3158 // accessing the data members of the priv struct for this
3159 // function_decl shows up on performance profiles when dealing with
3160 // big binaries with a lot of types; dereferencing the shared_ptr
3161 // involves locking of some sort and that is slower than just
3162 // dereferencing a pointer likere here. There are other types for
3163 // which the priv pointer is managed using shared_ptr just fine,
3164 // because those didn't show up during our performance profiling.
3165 priv* priv_;
3166
3167public:
3168
3169 /// Equality functor to compare pointers to function_decl
3170 struct ptr_equal;
3171
3172 /// Abstraction for the parameter of a function.
3173 class parameter;
3174
3175 /// Convenience typedef for a shared pointer on a @ref
3176 /// function_decl::parameter
3177 typedef shared_ptr<parameter> parameter_sptr;
3178
3179 /// Convenience typedef for a vector of @ref parameter_sptr
3180 typedef std::vector<parameter_sptr> parameters;
3181
3182 function_decl(const string& name,
3184 bool declared_inline,
3185 const location& locus,
3186 const string& mangled_name,
3187 visibility vis,
3188 binding bind);
3189
3190 function_decl(const string& name,
3191 type_base_sptr fn_type,
3192 bool declared_inline,
3193 const location& locus,
3194 const string& mangled_name = "",
3195 visibility vis = VISIBILITY_DEFAULT,
3196 binding bind = BINDING_GLOBAL);
3197
3198 virtual string
3199 get_pretty_representation(bool internal = false,
3200 bool qualified_name = true) const;
3201
3202 string
3203 get_pretty_representation_of_declarator (bool internal = false) const;
3204
3205 const std::vector<parameter_sptr >&
3206 get_parameters() const;
3207
3208 void
3210
3211 void
3212 append_parameters(std::vector<parameter_sptr >& parms);
3213
3214 parameters::const_iterator
3216
3217 const function_type_sptr
3218 get_type() const;
3219
3220 const function_type*
3221 get_naked_type() const;
3222
3223 const type_base_sptr
3224 get_return_type() const;
3225
3226 void
3227 set_type(const function_type_sptr& fn_type);
3228
3229 void
3230 set_symbol(const elf_symbol_sptr& sym);
3231
3232 const elf_symbol_sptr&
3233 get_symbol() const;
3234
3235 bool
3236 is_declared_inline() const;
3237
3238 void
3239 is_declared_inline(bool);
3240
3241 binding
3242 get_binding() const;
3243
3245 clone() const;
3246
3247 virtual bool
3248 operator==(const decl_base& o) const;
3249
3250 /// Return true iff the function takes a variable number of
3251 /// parameters.
3252 ///
3253 /// @return true if the function taks a variable number
3254 /// of parameters.
3255 bool
3256 is_variadic() const;
3257
3259 get_id() const;
3260
3261 virtual bool
3263
3264 virtual ~function_decl();
3265}; // end class function_decl
3266
3267bool
3269
3270bool
3272
3273bool
3275
3276bool
3279 change_kind*);
3280
3281/// A comparison functor to compare pointer to instances of @ref
3282/// type_or_decl_base.
3284{
3285 /// Comparison operator for ABI artifacts.
3286 ///
3287 /// @param f the first ABI artifact to consider for the comparison.
3288 ///
3289 /// @param s the second ABI artifact to consider for the comparison.
3290 ///
3291 /// @return true iff @p f is lexicographically less than than @p s.
3292 bool
3294 const type_or_decl_base *s)
3295 {
3296 function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3297 if (f_fn && s_fn)
3298 return function_decl_is_less_than(*f_fn, *s_fn);
3299
3300 var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3301 if (f_var && s_var)
3302 return get_name(f_var) < get_name(s_var);
3303
3304 string l_repr = get_pretty_representation(f),
3305 r_repr = get_pretty_representation(s);
3306
3307 return l_repr < r_repr;
3308 }
3309
3310 /// Comparison operator for ABI artifacts.
3311 ///
3312 /// @param f the first ABI artifact to consider for the comparison.
3313 ///
3314 /// @param s the second ABI artifact to consider for the comparison.
3315 ///
3316 /// @return true iff @p f is lexicographically less than than @p s.
3317 bool
3319 const type_or_decl_base_sptr& s)
3320 {return operator()(f.get(), s.get());}
3321}; // end struct type_or_decl_base_comp
3322
3323/// Abstraction of a function parameter.
3325{
3326 struct priv;
3327 std::unique_ptr<priv> priv_;
3328
3329public:
3330
3331 parameter(const type_base_sptr type,
3332 unsigned index,
3333 const string& name,
3334 const location& loc,
3335 bool variadic_marker = false);
3336
3337 parameter(const type_base_sptr type,
3338 unsigned index,
3339 const string& name,
3340 const location& loc,
3341 bool variadic_marker,
3342 bool is_artificial);
3343
3344 parameter(const type_base_sptr type,
3345 const string& name,
3346 const location& loc,
3347 bool variadic_marker = false,
3348 bool is_artificial = false);
3349
3350 parameter(const type_base_sptr type,
3351 unsigned index = 0,
3352 bool variadic_marker = false);
3353
3354 virtual ~parameter();
3355
3356 const type_base_sptr
3357 get_type()const;
3358
3360 get_type_name() const;
3361
3362 const string
3364
3366 get_name_id() const;
3367
3368 unsigned
3369 get_index() const;
3370
3371 void
3372 set_index(unsigned i);
3373
3374 bool
3375 get_variadic_marker() const;
3376
3377 bool
3378 operator==(const parameter& o) const;
3379
3380 virtual bool
3381 operator==(const decl_base&) const;
3382
3383 virtual bool
3385
3386 virtual void
3387 get_qualified_name(interned_string& qualified_name,
3388 bool internal = false) const;
3389
3390 virtual string
3391 get_pretty_representation(bool internal = false,
3392 bool qualified_name = true) const;
3393}; // end class function_decl::parameter
3394
3395bool
3398
3401
3404
3405bool
3407
3408/// Abstraction of a function type.
3409class function_type : public virtual type_base
3410{
3411protected:
3412 virtual void on_canonical_type_set();
3413
3414public:
3415 /// Hasher for an instance of function_type
3416 struct hash;
3417
3418 /// Convenience typedef for a shared pointer on a @ref
3419 /// function_decl::parameter
3420 typedef shared_ptr<function_decl::parameter> parameter_sptr;
3421 /// Convenience typedef for a vector of @ref parameter_sptr
3422 typedef std::vector<parameter_sptr> parameters;
3423
3424 struct priv;
3425 std::unique_ptr<priv> priv_;
3426
3427private:
3428 function_type();
3429
3430public:
3431
3432 function_type(type_base_sptr return_type,
3433 const parameters& parms,
3434 size_t size_in_bits,
3435 size_t alignment_in_bits);
3436
3437 function_type(type_base_sptr return_type,
3438 size_t size_in_bits,
3439 size_t alignment_in_bits);
3440
3441 function_type(const environment& env,
3442 size_t size_in_bits,
3443 size_t alignment_in_bits);
3444
3445 virtual hash_t
3446 hash_value() const;
3447
3448 type_base_sptr
3449 get_return_type() const;
3450
3451 void
3452 set_return_type(type_base_sptr t);
3453
3454 const parameters&
3455 get_parameters() const;
3456
3457 const parameter_sptr
3459
3460 void
3461 set_parameters(const parameters &p);
3462
3463 void
3465
3466 bool
3467 is_variadic() const;
3468
3469 parameters::const_iterator
3471
3472 parameters::const_iterator
3473 get_first_parm() const;
3474
3475 const interned_string&
3476 get_cached_name(bool internal = false) const;
3477
3478 virtual bool
3479 operator==(const type_base&) const;
3480
3481 virtual string
3482 get_pretty_representation(bool internal = false,
3483 bool qualified_name = true) const;
3484
3485 virtual bool
3487
3488 virtual ~function_type();
3489
3490 friend bool
3492};//end class function_type
3493
3494/// Abstracts the type of a class member function.
3496{
3497 struct priv;
3498 std::unique_ptr<priv> priv_;
3499
3500 method_type();
3501
3502public:
3503
3504 /// Hasher for intances of method_type
3505 struct hash;
3506
3507 method_type(type_base_sptr return_type,
3508 class_or_union_sptr class_type,
3509 const std::vector<function_decl::parameter_sptr>& parms,
3510 bool is_const,
3511 size_t size_in_bits,
3512 size_t alignment_in_bits);
3513
3514 method_type(type_base_sptr return_type,
3515 type_base_sptr class_type,
3516 const std::vector<function_decl::parameter_sptr>& parms,
3517 bool is_const,
3518 size_t size_in_bits,
3519 size_t alignment_in_bits);
3520
3521 method_type(class_or_union_sptr class_type,
3522 bool is_const,
3523 size_t size_in_bits,
3524 size_t alignment_in_bits);
3525
3526 method_type(const environment& env,
3527 size_t size_in_bits,
3528 size_t alignment_in_bits);
3529
3530 virtual hash_t
3531 hash_value() const;
3532
3533 class_or_union_sptr
3534 get_class_type() const;
3535
3536 void
3537 set_class_type(const class_or_union_sptr& t);
3538
3539 void set_is_const(bool);
3540
3541 bool get_is_const() const;
3542
3543 bool get_is_for_static_method() const;
3544
3545 virtual ~method_type();
3546
3547 virtual string
3548 get_pretty_representation(bool internal = false,
3549 bool qualified_name = true) const;
3550
3551 friend interned_string
3552 get_method_type_name(const method_type& fn_type, bool internal);
3553};// end class method_type.
3554
3555/// The base class of templates.
3556class template_decl : public virtual decl_base
3557{
3558 class priv;
3559 std::unique_ptr<priv> priv_;
3560
3561 template_decl();
3562
3563public:
3564
3565 template_decl(const environment& env,
3566 const string& name,
3567 const location& locus,
3568 visibility vis = VISIBILITY_DEFAULT);
3569
3570 void
3572
3573 const std::list<template_parameter_sptr>&
3575
3576 virtual bool
3577 operator==(const decl_base& o) const;
3578
3579 virtual bool
3580 operator==(const template_decl& o) const;
3581
3582 virtual ~template_decl();
3583};//end class template_decl
3584
3585/// Base class for a template parameter. Client code should use the
3586/// more specialized type_template_parameter,
3587/// non_type_template_parameter and template_template_parameter below.
3589{
3590 class priv;
3591 std::unique_ptr<priv> priv_;
3592
3593 // Forbidden
3595
3596 public:
3597
3598 template_parameter(unsigned index,
3599 template_decl_sptr enclosing_tdecl);
3600
3601 virtual bool
3602 operator==(const template_parameter&) const;
3603
3604 bool
3605 operator!=(const template_parameter&) const;
3606
3607 unsigned
3608 get_index() const;
3609
3610 const template_decl_sptr
3611 get_enclosing_template_decl() const;
3612
3613 virtual ~template_parameter();
3614};//end class template_parameter
3615
3616/// Abstracts a type template parameter.
3617class type_tparameter : public template_parameter, public virtual type_decl
3618{
3619 class priv;
3620 std::unique_ptr<priv> priv_;
3621
3622 // Forbidden
3624
3625public:
3626
3627 type_tparameter(unsigned index,
3628 template_decl_sptr enclosing_tdecl,
3629 const string& name,
3630 const location& locus);
3631
3632 virtual bool
3633 operator==(const type_base&) const;
3634
3635 virtual bool
3636 operator==(const type_decl&) const;
3637
3638 virtual bool
3639 operator==(const decl_base&) const;
3640
3641 virtual bool
3642 operator==(const template_parameter&) const;
3643
3644 virtual bool
3645 operator==(const type_tparameter&) const;
3646
3647 virtual ~type_tparameter();
3648};// end class type_tparameter.
3649
3650/// Abstracts non type template parameters.
3652{
3653 class priv;
3654 std::unique_ptr<priv> priv_;
3655
3656 type_base_wptr type_;
3657
3658 // Forbidden
3660
3661public:
3662
3663 non_type_tparameter(unsigned index,
3664 template_decl_sptr enclosing_tdecl,
3665 const string& name,
3666 type_base_sptr type,
3667 const location& locus);
3668 virtual bool
3669 operator==(const decl_base&) const;
3670
3671 virtual bool
3672 operator==(const template_parameter&) const;
3673
3674 const type_base_sptr
3675 get_type() const;
3676
3677 virtual ~non_type_tparameter();
3678};// end class non_type_tparameter
3679
3680
3682
3683/// Abstracts a template template parameter.
3685{
3686 class priv;
3687 std::unique_ptr<priv> priv_;
3688
3689 // Forbidden
3691
3692public:
3693
3694 template_tparameter(unsigned index,
3695 template_decl_sptr enclosing_tdecl,
3696 const string& name,
3697 const location& locus);
3698
3699 virtual bool
3700 operator==(const type_base&) const;
3701
3702 virtual bool
3703 operator==(const decl_base&) const;
3704
3705 virtual bool
3706 operator==(const template_parameter&) const;
3707
3708 virtual bool
3709 operator==(const template_decl&) const;
3710
3711 virtual ~template_tparameter();
3712};
3713
3714/// This abstracts a composition of types based on template type
3715/// parameters. The result of the composition is a type that can be
3716/// referred to by a template non-type parameter. Instances of this
3717/// type can appear at the same level as template parameters, in the
3718/// scope of a template_decl.
3719class type_composition : public template_parameter, public virtual decl_base
3720{
3721 class priv;
3722 std::unique_ptr<priv> priv_;
3723
3725
3726public:
3727 type_composition(unsigned index,
3728 template_decl_sptr tdecl,
3729 type_base_sptr composed_type);
3730
3731 const type_base_sptr
3732 get_composed_type() const;
3733
3734 void
3735 set_composed_type(type_base_sptr t);
3736
3737 virtual ~type_composition();
3738};
3739
3740/// Abstract a function template declaration.
3742{
3743 class priv;
3744 std::unique_ptr<priv> priv_;
3745
3746 // Forbidden
3748
3749public:
3750
3751 function_tdecl(const environment& env,
3752 const location& locus,
3753 visibility vis = VISIBILITY_DEFAULT,
3754 binding bind = BINDING_NONE);
3755
3757 const location& locus,
3758 visibility vis = VISIBILITY_DEFAULT,
3759 binding bind = BINDING_NONE);
3760
3761 virtual bool
3762 operator==(const decl_base&) const;
3763
3764 virtual bool
3765 operator==(const template_decl&) const;
3766
3767 virtual bool
3768 operator==(const function_tdecl&) const;
3769
3770 void
3771 set_pattern(shared_ptr<function_decl> p);
3772
3773 shared_ptr<function_decl>
3774 get_pattern() const;
3775
3776 binding
3777 get_binding() const;
3778
3779 virtual bool
3781
3782 virtual ~function_tdecl();
3783}; // end class function_tdecl.
3784
3785/// Abstract a class template.
3787{
3788 class priv;
3789 std::unique_ptr<priv> priv_;
3790
3791 // Forbidden
3792 class_tdecl();
3793
3794public:
3795
3796 class_tdecl(const environment& env, const location& locus,
3797 visibility vis = VISIBILITY_DEFAULT);
3798
3800 const location& locus,
3801 visibility vis = VISIBILITY_DEFAULT);
3802
3803 virtual bool
3804 operator==(const decl_base&) const;
3805
3806 virtual bool
3807 operator==(const template_decl&) const;
3808
3809 virtual bool
3810 operator==(const class_tdecl&) const;
3811
3812 void
3814
3815 shared_ptr<class_decl>
3816 get_pattern() const;
3817
3818 virtual bool
3820
3821 virtual ~class_tdecl();
3822};// end class class_tdecl
3823
3824/// The base class for member types, data members and member
3825/// functions. Its purpose is mainly to carry the access specifier
3826/// (and possibly other properties that might be shared by all class
3827/// members) for the member.
3829{
3830protected:
3831 enum access_specifier access_;
3832 bool is_static_;
3833
3834private:
3835 // Forbidden
3836 member_base();
3837
3838public:
3839 struct hash;
3840
3841 member_base(access_specifier a, bool is_static = false)
3842 : access_(a), is_static_(is_static)
3843 {}
3844
3845 /// Getter for the access specifier of this member.
3846 ///
3847 /// @return the access specifier for this member.
3850 {return access_;}
3851
3852 /// Setter for the access specifier of this member.
3853 ///
3854 /// @param a the new access specifier.
3855 void
3858
3859 /// @return true if the member is static, false otherwise.
3860 bool
3862 {return is_static_;}
3863
3864 /// Set a flag saying if the parameter is static or not.
3865 ///
3866 /// @param f set to true if the member is static, false otherwise.
3867 void
3869 {is_static_ = f;}
3870
3871 virtual bool
3872 operator==(const member_base& o) const;
3873};// end class member_base
3874
3875/// Abstraction of the declaration of a method.
3877{
3878 method_decl();
3879
3880 virtual void
3881 set_scope(scope_decl*);
3882
3883public:
3884
3885 method_decl(const string& name, method_type_sptr type,
3886 bool declared_inline, const location& locus,
3887 const string& mangled_name = "",
3888 visibility vis = VISIBILITY_DEFAULT,
3889 binding bind = BINDING_GLOBAL);
3890
3891 method_decl(const string& name,
3892 function_type_sptr type,
3893 bool declared_inline,
3894 const location& locus,
3895 const string& mangled_name = "",
3896 visibility vis = VISIBILITY_DEFAULT,
3897 binding bind = BINDING_GLOBAL);
3898
3899 method_decl(const string& name, type_base_sptr type,
3900 bool declared_inline, const location& locus,
3901 const string& mangled_name = "",
3902 visibility vis = VISIBILITY_DEFAULT,
3903 binding bind = BINDING_GLOBAL);
3904
3905 virtual void
3906 set_linkage_name(const string&);
3907
3908 /// @return the type of the current instance of the
3909 /// method_decl.
3910 const method_type_sptr
3911 get_type() const;
3912
3913 void
3914 set_type(const method_type_sptr fn_type)
3915 {function_decl::set_type(fn_type);}
3916
3917 friend bool
3919
3920 friend void
3922
3923 friend void
3925
3926 friend bool
3928
3929 friend void
3931
3932 friend void
3934
3935 friend bool
3936 get_member_function_is_static(const function_decl&);
3937
3938 friend void
3939 set_member_function_is_static(const function_decl&, bool);
3940
3941 friend bool
3943
3944 friend void
3946
3947 friend void
3949
3950 friend bool
3952
3953 friend ssize_t
3955
3956 virtual ~method_decl();
3957};// end class method_decl
3958
3959bool
3960operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3961
3962bool
3963operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
3964
3965/// The base type of @ref class_decl and @ref union_decl
3967{
3968public:
3969 struct priv;
3970 priv *priv_;
3971
3972private:
3973 // Forbidden
3975
3976protected:
3977
3978 virtual decl_base_sptr
3979 add_member_decl(const decl_base_sptr&);
3980
3981 decl_base_sptr
3982 insert_member_decl(decl_base_sptr member);
3983
3984 virtual void
3985 remove_member_decl(decl_base_sptr);
3986
3987 void
3989
3990public:
3991 /// Hasher.
3992 struct hash;
3993
3994 /// Convenience typedef
3995 /// @{
3996 typedef vector<type_base_sptr> member_types;
3997 typedef vector<var_decl_sptr> data_members;
3998 typedef vector<method_decl_sptr> member_functions;
3999 typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
4000 typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
4001 typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
4002 /// @}
4003
4004 class_or_union(const environment& env, const string& name,
4005 size_t size_in_bits, size_t align_in_bits,
4006 const location& locus, visibility vis,
4007 member_types& mbrs, data_members& data_mbrs,
4008 member_functions& member_fns);
4009
4010 class_or_union(const environment& env, const string& name,
4011 size_t size_in_bits, size_t align_in_bits,
4012 const location& locus, visibility vis);
4013
4014 class_or_union(const environment& env, const string& name,
4015 bool is_declaration_only = true);
4016
4017 virtual hash_t
4018 hash_value() const;
4019
4020 virtual void
4021 set_size_in_bits(size_t);
4022
4023 virtual size_t
4024 get_size_in_bits() const;
4025
4026 virtual size_t
4027 get_alignment_in_bits() const;
4028
4029 virtual void
4030 set_alignment_in_bits(size_t);
4031
4032 virtual size_t
4034
4035 virtual size_t
4037
4038 virtual size_t
4040
4041 void
4043 bool is_laid_out, bool is_static,
4044 size_t offset_in_bits);
4045
4046 const data_members&
4047 get_data_members() const;
4048
4049 const var_decl_sptr
4050 find_data_member(const string&) const;
4051
4052 const var_decl_sptr
4053 find_data_member(const var_decl_sptr&) const;
4054
4055 const var_decl_sptr
4057
4058 const data_members&
4060
4061 const data_members&
4063
4064 void
4065 add_member_function(method_decl_sptr f,
4067 bool is_static, bool is_ctor,
4068 bool is_dtor, bool is_const);
4069
4070 void
4071 add_member_function(method_decl_sptr f,
4073 bool is_virtual,
4074 size_t vtable_offset,
4075 bool is_static, bool is_ctor,
4076 bool is_dtor, bool is_const);
4077
4078 const member_functions&
4079 get_member_functions() const;
4080
4081 const method_decl*
4082 find_member_function(const string& mangled_name) const;
4083
4085 find_member_function(const string& mangled_name);
4086
4087 method_decl_sptr
4088 find_member_function_sptr(const string& mangled_name);
4089
4090 const method_decl*
4091 find_member_function_from_signature(const string& s) const;
4092
4094 find_member_function_from_signature(const string& s);
4095
4096 void
4097 add_member_function_template(member_function_template_sptr);
4098
4099 const member_function_templates&
4101
4102 void
4103 add_member_class_template(member_class_template_sptr m);
4104
4105 const member_class_templates&
4107
4108 bool
4109 has_no_member() const;
4110
4111 virtual bool
4112 operator==(const decl_base&) const;
4113
4114 virtual bool
4115 operator==(const type_base&) const;
4116
4117 virtual bool
4118 operator==(const class_or_union&) const;
4119
4120 virtual bool
4122
4123 virtual ~class_or_union();
4124
4125 friend method_decl_sptr
4126 copy_member_function(class_or_union_sptr t,
4127 const method_decl*m);
4128
4129 friend method_decl_sptr
4130 copy_member_function(class_or_union_sptr t,
4131 const method_decl_sptr& m);
4132
4133 friend var_decl_sptr
4134 copy_member_variable(class_or_union_sptr t,
4135 const var_decl* variable);
4136
4137 friend var_decl_sptr
4138 copy_member_variable(class_or_union_sptr t, const var_decl_sptr& variable);
4139
4140 friend void
4141 fixup_virtual_member_function(method_decl_sptr method);
4142
4143 friend void
4144 set_member_is_static(decl_base& d, bool s);
4145
4146 friend bool
4148
4149 friend bool
4150 equals(const class_decl&, const class_decl&, change_kind*);
4151
4152 friend class method_decl;
4153 friend class class_decl;
4154}; // end class class_or_union
4155
4156bool
4157operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4158
4159bool
4160operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4161
4162/// Abstracts a class declaration.
4164{
4165 // Forbidden
4166 class_decl();
4167
4168protected:
4169
4170 decl_base_sptr
4171 insert_member_decl(decl_base_sptr member);
4172
4173public:
4174 /// Hasher.
4175 struct hash;
4176
4177 /// Forward declarations.
4178 class base_spec;
4179
4180 /// Convenience typedef
4181 /// @{
4182 typedef shared_ptr<base_spec> base_spec_sptr;
4183 typedef vector<base_spec_sptr> base_specs;
4184
4185 /// @}
4186
4187protected:
4188 virtual void
4190
4191private:
4192 struct priv;
4193 // This priv it's not handled by a shared_ptr because accessing the
4194 // data members of the priv struct for this class_decl shows up on
4195 // performance profiles when dealing with big binaries with a lot of
4196 // types; dereferencing the shared_ptr involves locking of some sort
4197 // and that is slower than just dereferencing a pointer likere here.
4198 // There are other types for which the priv pointer is managed using
4199 // shared_ptr just fine, because those didn't show up during our
4200 // performance profiling.
4201 priv * priv_;
4202
4203public:
4204
4205 class_decl(const environment& env, const string& name,
4206 size_t size_in_bits, size_t align_in_bits,
4207 bool is_struct, const location& locus,
4208 visibility vis, base_specs& bases,
4209 member_types& mbrs, data_members& data_mbrs,
4210 member_functions& member_fns);
4211
4212 class_decl(const environment& env, const string& name,
4213 size_t size_in_bits, size_t align_in_bits,
4214 bool is_struct, const location& locus,
4215 visibility vis, base_specs& bases,
4216 member_types& mbrs, data_members& data_mbrs,
4217 member_functions& member_fns, bool is_anonymous);
4218
4219 class_decl(const environment& env, const string& name,
4220 size_t size_in_bits, size_t align_in_bits,
4221 bool is_struct, const location& locus, visibility vis);
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, bool is_anonymous);
4227
4228 class_decl(const environment& env, const string& name, bool is_struct,
4229 bool is_declaration_only = true);
4230
4231 virtual hash_t
4232 hash_value() const;
4233
4234 virtual string
4235 get_pretty_representation(bool internal = false,
4236 bool qualified_name = true) const;
4237
4238 void
4239 is_struct(bool f);
4240
4241 bool
4242 is_struct() const;
4243
4244 void
4245 add_base_specifier(shared_ptr<base_spec> b);
4246
4247 const base_specs&
4248 get_base_specifiers() const;
4249
4251 find_base_class(const string& qualified_name) const;
4252
4253 const member_functions&
4254 get_virtual_mem_fns() const;
4255
4258
4259 void
4261
4262 bool
4263 has_no_base_nor_member() const;
4264
4265 bool
4267
4268 bool
4269 has_virtual_bases() const;
4270
4271 bool
4272 has_vtable() const;
4273
4274 ssize_t
4276
4277 virtual bool
4278 operator==(const decl_base&) const;
4279
4280 virtual bool
4281 operator==(const type_base&) const;
4282
4283 virtual bool
4284 operator==(const class_or_union&) const;
4285
4286 virtual bool
4287 operator==(const class_decl&) const;
4288
4289 virtual bool
4291
4292 virtual ~class_decl();
4293
4294 friend var_decl_sptr
4296
4297 friend void
4298 fixup_virtual_member_function(method_decl_sptr method);
4299
4300 friend void
4301 set_member_is_static(decl_base& d, bool s);
4302
4303 friend bool
4304 equals(const class_decl&, const class_decl&, change_kind*);
4305
4306 friend class method_decl;
4307 friend class class_or_union;
4308};// end class class_decl
4309
4310bool
4311equals(const class_decl&, const class_decl&, change_kind*);
4312
4313method_decl_sptr
4315 const method_decl_sptr& f);
4316
4317method_decl_sptr
4319 const method_decl* f);
4320void
4321fixup_virtual_member_function(method_decl_sptr method);
4322
4325
4327get_member_access_specifier(const decl_base_sptr&);
4328
4329void
4332
4333void
4334set_member_access_specifier(const decl_base_sptr&,
4336
4337std::ostream&
4338operator<<(std::ostream&, access_specifier);
4339
4340bool
4341operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4342
4343bool
4344operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4345
4346bool
4348 const class_decl::base_spec&,
4349 change_kind*);
4350
4351/// Abstraction of a base specifier in a class declaration.
4353 public virtual decl_base
4354{
4355 struct priv;
4356 std::unique_ptr<priv> priv_;
4357
4358 // Forbidden
4359 base_spec();
4360
4361public:
4362
4363 /// Hasher.
4364 struct hash;
4365
4367 long offset_in_bits = -1, bool is_virtual = false);
4368
4369 base_spec(const type_base_sptr& base, access_specifier a,
4370 long offset_in_bits = -1, bool is_virtual = false);
4371
4372 virtual hash_t
4373 hash_value() const;
4374
4375 virtual ~base_spec();
4376
4378 get_base_class() const;
4379
4380 bool
4381 get_is_virtual() const;
4382
4383 long
4384 get_offset_in_bits() const;
4385
4386 virtual bool
4387 operator==(const decl_base&) const;
4388
4389 virtual bool
4390 operator==(const member_base&) const;
4391
4392 virtual bool
4394};// end class class_decl::base_spec
4395
4396bool
4399
4400bool
4403
4406
4409
4410/// Abstracts a union type declaration.
4412{
4413 // Forbid
4414 union_decl();
4415
4416public:
4417
4418 struct hash;
4419
4420 union_decl(const environment& env, const string& name,
4421 size_t size_in_bits, const location& locus,
4422 visibility vis, member_types& mbrs,
4423 data_members& data_mbrs, member_functions& member_fns);
4424
4425 union_decl(const environment& env, const string& name,
4426 size_t size_in_bits, const location& locus,
4427 visibility vis, member_types& mbrs,
4428 data_members& data_mbrs, member_functions& member_fns,
4429 bool is_anonymous);
4430
4431 union_decl(const environment& env, const string& name,
4432 size_t size_in_bits, const location& locus,
4433 visibility vis);
4434
4435 union_decl(const environment& env, const string& name,
4436 size_t size_in_bits, const location& locus,
4437 visibility vis, bool is_anonymous);
4438
4439 union_decl(const environment& env, const string& name,
4440 bool is_declaration_only = true);
4441
4442 virtual hash_t
4443 hash_value() const;
4444
4445 virtual string
4446 get_pretty_representation(bool internal = false,
4447 bool qualified_name = true) const;
4448
4449 virtual bool
4450 operator==(const decl_base&) const;
4451
4452 virtual bool
4453 operator==(const type_base&) const;
4454
4455 virtual bool
4456 operator==(const class_or_union&) const;
4457
4458 virtual bool
4459 operator==(const union_decl&) const;
4460
4461 virtual bool
4463
4464 virtual ~union_decl();
4465}; // union_decl
4466
4467bool
4468equals(const union_decl&, const union_decl&, change_kind*);
4469
4470method_decl_sptr
4471copy_member_function(union_decl_sptr union_type,
4472 const method_decl_sptr& f);
4473
4474method_decl_sptr
4475copy_member_function(union_decl_sptr union_type,
4476 const method_decl* f);
4477
4478bool
4479operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4480
4481bool
4482operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4483
4484/// Abstraction of a member function context relationship. This
4485/// relates a member function to its parent class.
4487{
4488protected:
4489 bool is_virtual_;
4490 ssize_t vtable_offset_in_bits_;
4491 bool is_constructor_;
4492 bool is_destructor_;
4493 bool is_const_;
4494
4495public:
4497 : context_rel(),
4498 is_virtual_(false),
4499 vtable_offset_in_bits_(-1),
4500 is_constructor_(false),
4501 is_destructor_(false),
4502 is_const_(false)
4503 {}
4504
4506 : context_rel(s),
4507 is_virtual_(false),
4508 vtable_offset_in_bits_(-1),
4509 is_constructor_(false),
4510 is_destructor_(false),
4511 is_const_(false)
4512 {}
4513
4515 bool is_constructor,
4516 bool is_destructor,
4517 bool is_const,
4518 bool is_virtual,
4519 size_t vtable_offset_in_bits,
4520 access_specifier access,
4521 bool is_static)
4522 : context_rel(s, access, is_static),
4523 is_virtual_(is_virtual),
4524 vtable_offset_in_bits_(vtable_offset_in_bits),
4525 is_constructor_(is_constructor),
4526 is_destructor_(is_destructor),
4527 is_const_(is_const)
4528 {}
4529
4530 bool
4531 is_virtual() const
4532 {return is_virtual_;}
4533
4534 void
4535 is_virtual(bool is_virtual)
4536 {is_virtual_ = is_virtual;}
4537
4538 /// Getter for the vtable offset property.
4539 ///
4540 /// This is the vtable offset of the member function of this
4541 /// relation.
4542 ///
4543 /// @return the vtable offset property of the relation.
4544 size_t
4546 {return vtable_offset_in_bits_;}
4547
4548 /// Setter for the vtable offset property.
4549 ///
4550 /// This is the vtable offset of the member function of this
4551 /// relation.
4552 ///
4553 /// @partam s the new vtable offset.
4554 void
4556 {vtable_offset_in_bits_ = s;}
4557
4558 /// Getter for the 'is-constructor' property.
4559 ///
4560 /// This tells if the member function of this relation is a
4561 /// constructor.
4562 ///
4563 /// @return the is-constructor property of the relation.
4564 bool
4566 {return is_constructor_;}
4567
4568 /// Setter for the 'is-constructor' property.
4569 ///
4570 /// @param f the new value of the the property. Is true if this is
4571 /// for a constructor, false otherwise.
4572 void
4574 {is_constructor_ = f;}
4575
4576 /// Getter for the 'is-destructor' property.
4577 ///
4578 /// Tells if the member function of this relation is a destructor.
4579 ///
4580 /// @return the is-destructor property of the relation;
4581 bool
4583 {return is_destructor_;}
4584
4585 /// Setter for the 'is-destructor' property.
4586 ///
4587 /// @param f the new value of the property. Is true if this is for
4588 /// a destructor, false otherwise.
4589 void
4591 {is_destructor_ = f;}
4592
4593 /// Getter for the 'is-const' property.
4594 ///
4595 /// Tells if the member function of this relation is a const member
4596 /// function.
4597 ///
4598 /// @return the 'is-const' property of the relation.
4599 bool
4600 is_const() const
4601 {return is_const_;}
4602
4603 /// Setter for the 'is-const' property.
4604 ///
4605 /// @param f the new value of the property. Is true if this is for
4606 /// a const entity, false otherwise.
4607 void
4608 is_const(bool f)
4609 {is_const_ = f;}
4610
4611 virtual ~mem_fn_context_rel();
4612}; // end class mem_fn_context_rel
4613
4616
4619
4620method_decl_sptr
4622
4623const var_decl*
4624lookup_data_member(const type_base* type,
4625 const char* dm_name);
4626
4627const var_decl_sptr
4628lookup_data_member(const type_base_sptr& type,
4629 const var_decl_sptr& dm);
4630
4633 unsigned parm_num);
4634
4635/// Abstract a member function template.
4636class member_function_template : public member_base, public virtual decl_base
4637{
4638 bool is_constructor_;
4639 bool is_const_;
4640 shared_ptr<function_tdecl> fn_tmpl_;
4641
4642 // Forbiden
4644
4645public:
4646 /// Hasher.
4647 struct hash;
4648
4650 access_specifier access, bool is_static,
4651 bool is_constructor, bool is_const)
4652 : type_or_decl_base(f->get_environment()),
4653 decl_base(f->get_environment(), f->get_name(), location()),
4654 member_base(access, is_static), is_constructor_(is_constructor),
4655 is_const_(is_const), fn_tmpl_(f)
4656 {}
4657
4658 bool
4659 is_constructor() const
4660 {return is_constructor_;}
4661
4662 bool
4663 is_const() const
4664 {return is_const_;}
4665
4666 operator const function_tdecl& () const
4667 {return *fn_tmpl_;}
4668
4670 as_function_tdecl() const
4671 {return fn_tmpl_;}
4672
4673 virtual bool
4674 operator==(const member_base& o) const;
4675
4676 virtual bool
4678};// end class member_function_template
4679
4680bool
4681operator==(const member_function_template_sptr& l,
4682 const member_function_template_sptr& r);
4683
4684bool
4685operator!=(const member_function_template_sptr& l,
4686 const member_function_template_sptr& r);
4687
4688/// Abstracts a member class template template
4690 : public member_base,
4691 public virtual decl_base
4692{
4693 shared_ptr<class_tdecl> class_tmpl_;
4694
4695 // Forbidden
4697
4698public:
4699
4700 /// Hasher.
4701 struct hash;
4702
4704 access_specifier access, bool is_static)
4705 : type_or_decl_base(c->get_environment()),
4706 decl_base(c->get_environment(), c->get_name(), location()),
4707 member_base(access, is_static),
4708 class_tmpl_(c)
4709 {}
4710
4711 operator const class_tdecl& () const
4712 { return *class_tmpl_; }
4713
4715 as_class_tdecl() const
4716 {return class_tmpl_;}
4717
4718 virtual bool
4719 operator==(const member_base& o) const;
4720
4721 virtual bool
4722 operator==(const decl_base&) const;
4723
4724 virtual bool
4725 operator==(const member_class_template&) const;
4726
4727 virtual bool
4729};// end class member_class_template
4730
4731bool
4732operator==(const member_class_template_sptr& l,
4733 const member_class_template_sptr& r);
4734
4735bool
4736operator!=(const member_class_template_sptr& l,
4737 const member_class_template_sptr& r);
4738
4739/// A comparison functor for pointers to @ref var_decl.
4741{
4742 /// Return true if the two instances of @ref var_decl are equal.
4743 ///
4744 /// @param l the first variable to compare.
4745 ///
4746 /// @param r the second variable to compare.
4747 ///
4748 /// @return true if @p l equals @p r.
4749 bool
4750 operator()(const var_decl* l, const var_decl* r) const
4751 {
4752 if (l == r)
4753 return true;
4754 if (!!l != !!r)
4755 return false;
4756 return (*l == *r);
4757 }
4758};// end struct var_decl::ptr_equal
4759
4760/// Equality functor for instances of @ref function_decl
4762{
4763 /// Tests if two pointers to @ref function_decl are equal.
4764 ///
4765 /// @param l the first pointer to @ref function_decl to consider in
4766 /// the comparison.
4767 ///
4768 /// @param r the second pointer to @ref function_decl to consider in
4769 /// the comparison.
4770 ///
4771 /// @return true if the two functions @p l and @p r are equal, false
4772 /// otherwise.
4773 bool
4774 operator()(const function_decl* l, const function_decl* r) const
4775 {
4776 if (l == r)
4777 return true;
4778 if (!!l != !!r)
4779 return false;
4780 return (*l == *r);
4781 }
4782};// function_decl::ptr_equal
4783
4784/// The base class for the visitor type hierarchy used for traversing
4785/// a translation unit.
4786///
4787/// Client code willing to get notified for a certain kind of node
4788/// during the IR traversal might want to define a visitor class that
4789/// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4790/// or ir_node_visitor::visit_end() method of its choice, and provide
4791/// and implementation for it. If either
4792/// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4793/// return false, it means the traversal has to stop immediately after
4794/// the methods' return. If the methods return true, it means the
4795/// traversal keeps going.
4796///
4797/// That new visitor class would then be passed to e.g,
4798/// translation_unit::traverse or to the traverse method of any type
4799/// where the traversal is supposed to start from.
4801{
4802 struct priv;
4803 std::unique_ptr<priv> priv_;
4804
4805public:
4806
4808
4809 virtual ~ir_node_visitor();
4810
4816
4817 virtual bool visit_begin(decl_base*);
4818 virtual bool visit_end(decl_base*);
4819
4820 virtual bool visit_begin(scope_decl*);
4821 virtual bool visit_end(scope_decl*);
4822
4823 virtual bool visit_begin(type_base*);
4824 virtual bool visit_end(type_base*);
4825
4826 virtual bool visit_begin(scope_type_decl*);
4827 virtual bool visit_end(scope_type_decl*);
4828
4829 virtual bool visit_begin(type_decl*);
4830 virtual bool visit_end(type_decl*);
4831
4832 virtual bool visit_begin(namespace_decl*);
4833 virtual bool visit_end(namespace_decl*);
4834
4835 virtual bool visit_begin(qualified_type_def*);
4836 virtual bool visit_end(qualified_type_def*);
4837
4838 virtual bool visit_begin(pointer_type_def*);
4839 virtual bool visit_end(pointer_type_def*);
4840
4841 virtual bool visit_begin(reference_type_def*);
4842 virtual bool visit_end(reference_type_def*);
4843
4844 virtual bool visit_begin(ptr_to_mbr_type*);
4845 virtual bool visit_end(ptr_to_mbr_type*);
4846
4847 virtual bool visit_begin(array_type_def*);
4848 virtual bool visit_end(array_type_def*);
4849
4850 virtual bool visit_begin(array_type_def::subrange_type*);
4851 virtual bool visit_end(array_type_def::subrange_type*);
4852
4853 virtual bool visit_begin(enum_type_decl*);
4854 virtual bool visit_end(enum_type_decl*);
4855
4856 virtual bool visit_begin(typedef_decl*);
4857 virtual bool visit_end(typedef_decl*);
4858
4859 virtual bool visit_begin(function_type*);
4860 virtual bool visit_end(function_type*);
4861
4862 virtual bool visit_begin(var_decl*);
4863 virtual bool visit_end(var_decl*);
4864
4865 virtual bool visit_begin(function_decl*);
4866 virtual bool visit_end(function_decl*);
4867
4868 virtual bool visit_begin(function_decl::parameter*);
4869 virtual bool visit_end(function_decl::parameter*);
4870
4871 virtual bool visit_begin(function_tdecl*);
4872 virtual bool visit_end(function_tdecl*);
4873
4874 virtual bool visit_begin(class_tdecl*);
4875 virtual bool visit_end(class_tdecl*);
4876
4877 virtual bool visit_begin(class_or_union *);
4878 virtual bool visit_end(class_or_union *);
4879
4880 virtual bool visit_begin(class_decl*);
4881 virtual bool visit_end(class_decl*);
4882
4883 virtual bool visit_begin(union_decl*);
4884 virtual bool visit_end(union_decl*);
4885
4886 virtual bool visit_begin(class_decl::base_spec*);
4887 virtual bool visit_end(class_decl::base_spec*);
4888
4889 virtual bool visit_begin(member_function_template*);
4890 virtual bool visit_end(member_function_template*);
4891
4892 virtual bool visit_begin(member_class_template*);
4893 virtual bool visit_end(member_class_template*);
4894}; // end struct ir_node_visitor
4895
4896// Debugging facility
4897void
4898fns_to_str(vector<function_decl*>::const_iterator a_begin,
4899 vector<function_decl*>::const_iterator a_end,
4900 vector<function_decl*>::const_iterator b_begin,
4901 vector<function_decl*>::const_iterator b_end,
4902 std::ostream& o);
4903
4904}// end namespace ir
4905} // end namespace abigail
4906#endif // __ABG_IR_H__
Simplified implementation of std::optional just enough to be used as a replacement for our purposes a...
This type abstracts the configuration information of the library.
Definition abg-config.h:18
The abstraction of an interned string.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
Definition abg-ir.h:2589
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition abg-ir.cc:19262
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:19230
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:19223
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition abg-ir.cc:19237
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition abg-ir.cc:19274
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition abg-ir.cc:19245
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition abg-ir.cc:19195
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition abg-ir.cc:19252
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:19453
bool is_non_finite() const
Test if the length of the subrange type is infinite.
Definition abg-ir.cc:19480
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition abg-ir.cc:19446
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:19420
string as_string() const
Return a string representation of the sub range.
Definition abg-ir.cc:19502
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19401
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19702
bool operator!=(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:19641
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition abg-ir.cc:19432
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:19412
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:19597
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition abg-ir.cc:19439
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:19680
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition abg-ir.cc:19525
uint64_t get_length() const
Getter of the length of the subrange type.
Definition abg-ir.cc:19463
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition abg-ir.cc:19495
The abstraction of an array type.
Definition abg-ir.h:2548
virtual bool is_non_finite() const
Definition abg-ir.cc:20119
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:20149
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19809
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition abg-ir.cc:20080
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition abg-ir.cc:20095
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:20212
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition abg-ir.cc:20239
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:20058
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:19862
translation_unit::language get_language() const
Get the language of the array.
Definition abg-ir.cc:20047
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition abg-ir.cc:20105
Abstraction of a base specifier in a class declaration.
Definition abg-ir.h:4354
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition abg-ir.cc:25364
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition abg-ir.cc:25371
long get_offset_in_bits() const
Getter of the offset of the base.
Definition abg-ir.cc:25378
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:25353
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:25394
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition abg-ir.cc:25488
Abstracts a class declaration.
Definition abg-ir.h:4164
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:25891
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition abg-ir.cc:25944
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:25230
bool is_struct() const
Test if the class is a struct.
Definition abg-ir.cc:25168
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:26007
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition abg-ir.cc:25185
virtual ~class_decl()
Destructor of the class_decl type.
Definition abg-ir.cc:26521
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:25146
bool has_vtable() const
Test if the current instance has a vtable.
Definition abg-ir.cc:25972
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition abg-ir.cc:25986
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition abg-ir.cc:25953
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26437
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition abg-ir.h:4182
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition abg-ir.cc:25175
friend var_decl_sptr copy_member_variable(class_decl_sptr t, const var_decl_sptr &variable)
Copy a data member of a class_or_union into a new class_or_union.
Definition abg-ir.cc:24893
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition abg-ir.cc:25211
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition abg-ir.cc:25235
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition abg-ir.cc:26105
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition abg-ir.cc:26285
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:25195
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:26824
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition abg-ir.cc:25935
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition abg-ir.h:4183
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:25256
The base type of class_decl and union_decl.
Definition abg-ir.h:3967
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition abg-ir.cc:24039
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:24280
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:24205
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition abg-ir.cc:24308
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:25891
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition abg-ir.cc:23925
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition abg-ir.cc:24384
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition abg-ir.cc:24024
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition abg-ir.cc:24057
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition abg-ir.cc:24398
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition abg-ir.h:3999
friend method_decl_sptr copy_member_function(class_or_union_sptr t, const method_decl *m)
Copy a method of a class_or_union into a new class_or_union.
Definition abg-ir.cc:24787
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition abg-ir.h:3998
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition abg-ir.cc:24164
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:23815
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition abg-ir.h:4000
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:24106
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:24359
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:24343
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition abg-ir.cc:24008
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition abg-ir.cc:24440
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:23913
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:23831
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition abg-ir.cc:24412
const data_members & get_non_static_data_members() const
Get the non-static data members of this class_or_union.
Definition abg-ir.cc:24255
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:24317
const data_members & get_static_data_members() const
Get the static data memebers of this class_or_union.
Definition abg-ir.cc:24263
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:23950
vector< var_decl_sptr > data_members
Convenience typedef.
Definition abg-ir.h:3997
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition abg-ir.cc:23904
friend var_decl_sptr copy_member_variable(class_or_union_sptr t, const var_decl *variable)
Copy a data member of a class_or_union into a new class_or_union.
Definition abg-ir.cc:24841
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:24474
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:26824
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition abg-ir.cc:23976
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition abg-ir.cc:24391
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition abg-ir.cc:23992
vector< type_base_sptr > member_types
Convenience typedef.
Definition abg-ir.h:3996
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition abg-ir.cc:24075
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:24175
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition abg-ir.cc:24544
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition abg-ir.h:4001
Abstract a class template.
Definition abg-ir.h:3787
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition abg-ir.cc:28216
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition abg-ir.cc:28205
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:28265
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:28220
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:16340
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:5012
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition abg-ir.cc:5227
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current decl.
Definition abg-ir.cc:4901
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition abg-ir.cc:4799
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition abg-ir.cc:4530
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:4592
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:5582
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition abg-ir.cc:4960
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition abg-ir.cc:4774
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:4996
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition abg-ir.cc:4830
void clear_qualified_name()
Clear the qualified name of this decl.
Definition abg-ir.cc:4523
virtual void set_name(const string &n)
Setter for the name of the decl.
Definition abg-ir.cc:4662
const location & get_location() const
Get the location of a given declaration.
Definition abg-ir.cc:4612
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:4722
virtual const interned_string & get_name() const
Getter for the name of the current decl.
Definition abg-ir.cc:4818
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition abg-ir.cc:5254
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition abg-ir.cc:4514
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition abg-ir.cc:4564
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition abg-ir.cc:4675
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:8457
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:26915
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition abg-ir.cc:4952
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:4980
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:5551
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition abg-ir.cc:8482
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition abg-ir.cc:4740
void set_location(const location &l)
Set the location for a given declaration.
Definition abg-ir.cc:4650
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition abg-ir.cc:4685
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition abg-ir.cc:4791
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition abg-ir.cc:4557
visibility get_visibility() const
Getter for the visibility of the decl.
Definition abg-ir.cc:4784
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:5003
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:5243
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition abg-ir.cc:4968
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition abg-ir.cc:4767
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:5522
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition abg-ir.cc:6648
virtual ~decl_base()
Destructor of the decl_base type.
Definition abg-ir.cc:5231
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:5216
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:4811
bool get_is_anonymous_or_has_anonymous_parent() const
Definition abg-ir.cc:4708
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition abg-ir.cc:4697
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:4584
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition abg-ir.cc:5145
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition abg-ir.cc:4543
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:4853
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:5076
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:21481
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition abg-ir.h:2993
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:3351
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition abg-ir.cc:3361
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:3264
bool operator==(const version &o) const
Compares the current version against another one.
Definition abg-ir.cc:3246
bool is_default() const
Getter for the 'is_default' property of the version.
Definition abg-ir.cc:3226
const string & str() const
Getter for the version name.
Definition abg-ir.cc:3212
bool operator!=(const version &o) const
Inequality operator.
Definition abg-ir.cc:3255
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:2871
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition abg-ir.cc:20843
bool operator!=(const enumerator &other) const
Inequality operator.
Definition abg-ir.cc:20903
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition abg-ir.cc:20945
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition abg-ir.cc:20967
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition abg-ir.cc:20912
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition abg-ir.cc:20974
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:20960
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:20929
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:20953
bool operator==(const enumerator &other) const
Equality operator.
Definition abg-ir.cc:20890
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition abg-ir.cc:20874
Abstracts a declaration for an enum type.
Definition abg-ir.h:2785
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:20312
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition abg-ir.cc:20473
const enumerators & get_enumerators() const
Definition abg-ir.cc:20325
bool find_enumerator_by_value(int64_t value, enum_type_decl::enumerator &result)
Find an enumerator by its value.
Definition abg-ir.cc:20371
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
Definition abg-ir.cc:20337
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:20451
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition abg-ir.cc:20320
bool find_enumerator_by_name(const string &name, enum_type_decl::enumerator &result)
Find an enumerator by its name.
Definition abg-ir.cc:20395
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:20764
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:20426
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:3598
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:3665
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:3745
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:3882
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:3475
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:3697
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition abg-ir.cc:3526
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:3494
const config & get_config() const
Getter of the general configuration object.
Definition abg-ir.cc:3735
environment()
Default constructor of the environment type.
Definition abg-ir.cc:3376
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition abg-ir.cc:3538
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:3905
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:3513
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:3634
virtual ~environment()
Destructor for the environment type.
Definition abg-ir.cc:3381
bool canonicalization_started() const
Getter of a flag saying if the canonicalization process has started or not.
Definition abg-ir.cc:3565
interned_string intern(const string &) const
Do intern a string.
Definition abg-ir.cc:3728
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:28404
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:3771
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition abg-ir.cc:3389
Abstraction of a function parameter.
Definition abg-ir.h:3325
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition abg-ir.cc:23649
interned_string get_type_name() const
Definition abg-ir.cc:23448
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition abg-ir.cc:23486
const string get_type_pretty_representation() const
Definition abg-ir.cc:23467
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition abg-ir.cc:23625
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:23669
Abstraction for a function declaration.
Definition abg-ir.h:3155
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3177
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:22849
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition abg-ir.cc:22920
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:23310
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition abg-ir.cc:23000
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition abg-ir.cc:23225
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition abg-ir.cc:22886
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition abg-ir.cc:22905
const type_base_sptr get_return_type() const
Definition abg-ir.cc:22981
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition abg-ir.cc:23013
const std::vector< parameter_sptr > & get_parameters() const
Definition abg-ir.cc:22986
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition abg-ir.cc:22993
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition abg-ir.cc:22942
virtual ~function_decl()
Destructor of the function_decl type.
Definition abg-ir.cc:23326
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:22958
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition abg-ir.cc:23211
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3180
bool is_declared_inline() const
Test if the function was declared inline.
Definition abg-ir.cc:22965
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:22781
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:23241
Abstract a function template declaration.
Definition abg-ir.h:3742
binding get_binding() const
Get the binding of the function template.
Definition abg-ir.cc:28053
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition abg-ir.cc:28035
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition abg-ir.cc:28046
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:28113
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition abg-ir.cc:28062
Abstraction of a function type.
Definition abg-ir.h:3410
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3420
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition abg-ir.cc:22094
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:21954
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:22373
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition abg-ir.cc:22061
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:22270
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:21861
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition abg-ir.cc:22332
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:22046
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition abg-ir.cc:22023
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition abg-ir.cc:22290
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:22002
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition abg-ir.cc:21965
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition abg-ir.cc:21973
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:22248
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition abg-ir.cc:21982
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3422
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:22356
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:4801
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:30119
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition abg-ir.cc:30168
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition abg-ir.cc:30158
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition abg-ir.cc:30098
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition abg-ir.cc:30129
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:4487
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition abg-ir.h:4565
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition abg-ir.h:4555
bool is_const() const
Getter for the 'is-const' property.
Definition abg-ir.h:4600
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition abg-ir.h:4590
void is_const(bool f)
Setter for the 'is-const' property.
Definition abg-ir.h:4608
size_t vtable_offset() const
Getter for the vtable offset property.
Definition abg-ir.h:4545
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition abg-ir.h:4573
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition abg-ir.h:4582
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition abg-ir.h:3829
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition abg-ir.h:3849
bool get_is_static() const
Definition abg-ir.h:3861
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition abg-ir.h:3856
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition abg-ir.h:3868
Abstracts a member class template template.
Definition abg-ir.h:4692
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition abg-ir.cc:26684
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26769
Abstract a member function template.
Definition abg-ir.h:4637
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26663
Abstraction of the declaration of a method.
Definition abg-ir.h:3877
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition abg-ir.cc:6545
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition abg-ir.cc:25635
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition abg-ir.cc:6432
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition abg-ir.cc:6585
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition abg-ir.cc:6402
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition abg-ir.cc:6489
const method_type_sptr get_type() const
Definition abg-ir.cc:25662
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:6574
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition abg-ir.cc:6461
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition abg-ir.cc:6517
Abstracts the type of a class member function.
Definition abg-ir.h:3496
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:22574
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:22555
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition abg-ir.cc:22606
bool get_is_for_static_method() const
Test if the current method type is for a static method or not.
Definition abg-ir.cc:22621
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:9250
virtual ~method_type()
The destructor of method_type.
Definition abg-ir.cc:22654
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:22598
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition abg-ir.cc:22565
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition abg-ir.cc:22613
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:17461
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17492
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition abg-ir.cc:17447
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:17433
Abstracts non type template parameters.
Definition abg-ir.h:3652
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition abg-ir.cc:27751
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:27756
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:18154
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:18280
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18144
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:18071
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:18374
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition abg-ir.cc:18216
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition abg-ir.cc:18260
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition abg-ir.cc:18267
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:19044
virtual const interned_string & get_name() const
Getter of the name of the current ptr-to-mbr-type.
Definition abg-ir.cc:18954
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18967
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:18987
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
Definition abg-ir.cc:19028
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:19095
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
Definition abg-ir.cc:18978
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
Definition abg-ir.cc:19120
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:17797
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition abg-ir.cc:17922
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition abg-ir.cc:17661
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:17649
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:17910
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:17587
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition abg-ir.cc:17901
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17870
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition abg-ir.cc:17896
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition abg-ir.cc:17915
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition abg-ir.cc:17741
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition abg-ir.cc:17564
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:18703
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18566
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:18468
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:18825
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:18576
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition abg-ir.cc:18645
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:18804
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:7928
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition abg-ir.cc:8137
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition abg-ir.cc:8095
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition abg-ir.cc:8112
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition abg-ir.cc:8482
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition abg-ir.cc:7946
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition abg-ir.cc:7981
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:7995
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:8427
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition abg-ir.cc:8070
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:8205
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:8501
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:7864
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:8379
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition abg-ir.cc:8230
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:8041
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:8081
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition abg-ir.cc:7888
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:7852
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition abg-ir.cc:8156
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:8457
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:8333
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition abg-ir.cc:7906
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition abg-ir.cc:7964
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:17354
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition abg-ir.cc:17316
The base class of templates.
Definition abg-ir.h:3557
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:27426
virtual ~template_decl()
Destructor.
Definition abg-ir.cc:27451
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:27418
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:27460
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition abg-ir.h:3589
virtual ~template_parameter()
Destructor.
Definition abg-ir.cc:27580
bool operator!=(const template_parameter &) const
Inequality operator.
Definition abg-ir.cc:27576
Abstracts a template template parameter.
Definition abg-ir.h:3685
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:27829
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:15281
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:15364
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...
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:16423
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition abg-ir.cc:16399
friend type_base_sptr canonicalize(type_base_sptr, bool, bool)
Compute the canonical type of a given type.
Definition abg-ir.cc:16261
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition abg-ir.cc:16502
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:16369
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:16528
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:16094
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition abg-ir.cc:16495
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition abg-ir.cc:16488
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition abg-ir.cc:16478
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition abg-ir.cc:16516
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition abg-ir.cc:16509
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition abg-ir.cc:16383
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition abg-ir.h:3720
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition abg-ir.cc:27935
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition abg-ir.cc:27942
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:17148
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:16988
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17227
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:17086
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:17042
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:17207
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:4285
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:4098
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition abg-ir.cc:4087
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition abg-ir.cc:4245
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition abg-ir.cc:4252
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:4048
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition abg-ir.cc:4277
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.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:4198
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition abg-ir.cc:4121
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:4110
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition abg-ir.cc:4310
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition abg-ir.cc:4141
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition abg-ir.cc:11184
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:4068
friend hash_t peek_hash_value(const type_or_decl_base &)
Get the hash value associated to an IR node.
Definition abg-ir.cc:28538
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:4176
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition abg-ir.cc:10757
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition abg-ir.cc:4227
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:4209
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:4038
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:4058
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition abg-ir.cc:10830
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition abg-ir.cc:4302
Abstracts a type template parameter.
Definition abg-ir.h:3618
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:27622
The abstraction of a typedef declaration.
Definition abg-ir.h:2925
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:21229
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition abg-ir.cc:21214
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition abg-ir.cc:21069
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:21056
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:21261
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition abg-ir.cc:21207
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:21149
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition abg-ir.cc:21086
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:21190
Abstracts a union type declaration.
Definition abg-ir.h:4412
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:27103
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:27220
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition abg-ir.cc:27160
virtual ~union_decl()
Destructor of the union_decl type.
Definition abg-ir.cc:27293
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:27127
Abstracts a variable declaration.
Definition abg-ir.h:3058
binding get_binding() const
Getter of the binding of the variable.
Definition abg-ir.cc:21375
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition abg-ir.cc:21357
void set_binding(binding b)
Setter of the binding of the variable.
Definition abg-ir.cc:21382
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition abg-ir.cc:6206
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition abg-ir.cc:21420
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:21671
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition abg-ir.cc:21368
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition abg-ir.cc:6351
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition abg-ir.cc:21350
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:21833
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:21810
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition abg-ir.cc:6280
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition abg-ir.cc:21397
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:6174
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:6337
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:21413
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition abg-ir.cc:21606
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:21701
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:21625
real_type::modifiers_type operator~(real_type::modifiers_type l)
Bitwise one's complement operator for real_type::modifiers_type.
Definition abg-ir.cc:16585
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
hash_t peek_hash_value(const type_or_decl_base &artefact)
Get the hash value associated to an IR node.
Definition abg-ir.cc:28538
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:23292
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.
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:25891
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:19942
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:26578
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:12225
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:9293
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:3071
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:30543
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:8693
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:5551
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:2943
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:21481
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:3455
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
Definition abg-ir.cc:3152
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
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:28728
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
method_decl_sptr copy_member_function(class_or_union_sptr t, const method_decl_sptr &method)
Copy a method of a class_or_union into a new class_or_union.
Definition abg-ir.cc:24773
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
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:3104
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:12678
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:10734
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition abg-ir.cc:5145
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:3129
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:20487
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:29074
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition abg-ir.cc:12069
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:25724
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:5522
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
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:9078
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:8663
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:29031
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.
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:10705
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:3162
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
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:5076
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:7790
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.
Equality functor for instances of function_decl.
Definition abg-ir.h:4762
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition abg-ir.h:4774
The hashing functor for function_type.
Definition abg-hash.h:217
The type of the private data of the function_type type.
The base of an entity of the intermediate representation that is to be traversed.
Definition abg-ir.h: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:30081
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.
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.
Hash functor for instances of type_base.
Definition abg-hash.h:111
Definition of the private data of type_base.
Hash functor for instances of type_decl.
Definition abg-hash.h:124
The private data of type_or_decl_base.
A comparison functor to compare pointer to instances of type_or_decl_base.
Definition abg-ir.h:3284
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:3318
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition abg-ir.h:3293
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:4741
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:4750