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-2024 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_C,
716 LANG_C_plus_plus_03,
717 LANG_C_plus_plus_11,
718 LANG_C_plus_plus_14,
719 LANG_C_plus_plus,
720 LANG_ObjC,
721 LANG_ObjC_plus_plus,
722 LANG_Fortran77,
723 LANG_Fortran90,
724 LANG_Fortran95,
725 LANG_Ada83,
726 LANG_Ada95,
727 LANG_Pascal83,
728 LANG_Modula2,
729 LANG_Java,
730 LANG_PLI,
731 LANG_UPC,
732 LANG_D,
733 LANG_Python,
734 LANG_Go,
735 LANG_Rust,
736 LANG_Mips_Assembler
737 };
738
739public:
741 const std::string& path,
742 char address_size = 0);
743
744 virtual ~translation_unit();
745
746 const environment&
747 get_environment() const;
748
749 language
750 get_language() const;
751
752 void
753 set_language(language l);
754
755 const std::string&
756 get_path() const;
757
758 void
759 set_path(const string&);
760
761 const std::string&
763
764 void
765 set_compilation_dir_path(const std::string&);
766
767 const std::string&
768 get_absolute_path() const;
769
770 void
772
773 const corpus*
774 get_corpus() const;
775
776 corpus*
777 get_corpus();
778
779 const scope_decl_sptr&
780 get_global_scope() const;
781
784
785 const type_maps&
786 get_types() const;
787
788 type_maps&
789 get_types();
790
791 const vector<function_type_sptr>&
792 get_live_fn_types() const;
793
795 get_loc_mgr();
796
797 const location_manager&
798 get_loc_mgr() const;
799
800 bool
801 is_empty() const;
802
803 char
804 get_address_size() const;
805
806 void
807 set_address_size(char);
808
809 bool
810 is_constructed() const;
811
812 void
813 set_is_constructed(bool);
814
815 bool
816 operator==(const translation_unit&) const;
817
818 bool
819 operator!=(const translation_unit&) const;
820
821 void
823
824 virtual bool
826
827 friend function_type_sptr
828 lookup_function_type_in_translation_unit(const function_type& t,
829 const translation_unit& tu);
830
831 friend function_type_sptr
833 translation_unit& tu);
834
835 friend type_base_sptr
836 synthesize_type_from_translation_unit(const type_base_sptr& type,
837 translation_unit& tu);
838};//end class translation_unit
839
840/// A comparison functor to compare translation units based on their
841/// absolute paths.
843{
844 /// Compare two translations units based on their absolute paths.
845 ///
846 /// @param lhs the first translation unit to consider for the
847 /// comparison.
848 ///
849 /// @param rhs the second translatin unit to consider for the
850 /// comparison.
851 bool
853 const translation_unit_sptr& rhs) const
854 {return lhs->get_absolute_path() < rhs->get_absolute_path();}
855}; // end struct shared_translation_unit_comp
856
857/// Convenience typedef for an ordered set of @ref
858/// translation_unit_sptr.
859typedef std::set<translation_unit_sptr,
861
862string
864
867
868bool
870
871bool
873
874bool
876
877bool
879
880bool
882
883bool
885
886/// Access specifier for class members.
888{
889 no_access,
890 public_access,
891 protected_access,
892 private_access,
893};
894
895class elf_symbol;
896/// A convenience typedef for a shared pointer to elf_symbol.
897typedef shared_ptr<elf_symbol> elf_symbol_sptr;
898
899/// A convenience typedef for a weak pointer to elf_symbol.
900typedef weak_ptr<elf_symbol> elf_symbol_wptr;
901
902/// Convenience typedef for a map which key is a string and which
903/// value if the elf symbol of the same name.
904typedef std::unordered_map<string, elf_symbol_sptr>
906
907/// Convenience typedef for a shared pointer to an
908/// string_elf_symbol_sptr_map_type.
909typedef shared_ptr<string_elf_symbol_sptr_map_type>
911
912/// Convenience typedef for a vector of elf_symbol
913typedef std::vector<elf_symbol_sptr> elf_symbols;
914
915/// Convenience typedef for a map which key is a string and which
916/// value is a vector of elf_symbol.
917typedef std::unordered_map<string, elf_symbols>
919
920/// Convenience typedef for a shared pointer to
921/// string_elf_symbols_map_type.
922typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
923
924/// Abstraction of an elf symbol.
925///
926/// This is useful when a given corpus has been read from an ELF file.
927/// In that case, a given decl might be associated to its underlying
928/// ELF symbol, if that decl is publicly exported in the ELF file. In
929/// that case, comparing decls might involve comparing their
930/// underlying symbols as well.
932{
933public:
934 /// The type of a symbol.
935 enum type
936 {
937 NOTYPE_TYPE = 0,
938 OBJECT_TYPE,
939 FUNC_TYPE,
940 SECTION_TYPE,
941 FILE_TYPE,
942 COMMON_TYPE,
943 TLS_TYPE,
944 GNU_IFUNC_TYPE
945 };
946
947 /// The binding of a symbol.
949 {
950 LOCAL_BINDING = 0,
951 GLOBAL_BINDING,
952 WEAK_BINDING,
953 GNU_UNIQUE_BINDING
954 };
955
956 /// The visibility of the symbol.
958 {
959 DEFAULT_VISIBILITY,
960 PROTECTED_VISIBILITY,
961 HIDDEN_VISIBILITY,
962 INTERNAL_VISIBILITY,
963 };
964
965 /// Inject the elf_symbol::version here.
966 class version;
967
968private:
969 struct priv;
970 std::unique_ptr<priv> priv_;
971
972 elf_symbol();
973
974 elf_symbol(const environment& e,
975 size_t i,
976 size_t s,
977 const string& n,
978 type t,
979 binding b,
980 bool d,
981 bool c,
982 const version& ve,
983 visibility vi,
984 bool is_in_ksymtab = false,
985 const abg_compat::optional<uint32_t>& crc = {},
987 bool is_suppressed = false);
988
989 elf_symbol(const elf_symbol&);
990
991 elf_symbol&
992 operator=(const elf_symbol& s);
993
994public:
995
996 static elf_symbol_sptr
997 create(const environment& e,
998 size_t i,
999 size_t s,
1000 const string& n,
1001 type t,
1002 binding b,
1003 bool d,
1004 bool c,
1005 const version& ve,
1006 visibility vi,
1007 bool is_in_ksymtab = false,
1008 const abg_compat::optional<uint32_t>& crc = {},
1009 const abg_compat::optional<std::string>& ns = {},
1010 bool is_suppressed = false);
1011
1012 const environment&
1013 get_environment() const;
1014
1015 size_t
1016 get_index() const;
1017
1018 void
1019 set_index(size_t);
1020
1021 const string&
1022 get_name() const;
1023
1024 void
1025 set_name(const string& n);
1026
1027 type
1028 get_type() const;
1029
1030 void
1031 set_type(type t);
1032
1033 size_t
1034 get_size() const;
1035
1036 void
1037 set_size(size_t);
1038
1039 binding
1040 get_binding() const;
1041
1042 void
1043 set_binding(binding b);
1044
1045 version&
1046 get_version() const;
1047
1048 void
1049 set_version(const version& v);
1050
1051 void
1052 set_visibility(visibility v);
1053
1054 visibility
1055 get_visibility() const;
1056
1057 bool
1058 is_defined() const;
1059
1060 void
1061 is_defined(bool d);
1062
1063 bool
1064 is_public() const;
1065
1066 bool
1067 is_function() const;
1068
1069 bool
1070 is_variable() const;
1071
1072 bool
1073 is_in_ksymtab() const;
1074
1075 void
1077
1079 get_crc() const;
1080
1081 void
1083
1085 get_namespace() const;
1086
1087 void
1089
1090 bool
1091 is_suppressed() const;
1092
1093 void
1095
1096 const elf_symbol_sptr
1097 get_main_symbol() const;
1098
1101
1102 bool
1103 is_main_symbol() const;
1104
1106 update_main_symbol(const std::string&);
1107
1109 get_next_alias() const;
1110
1111 bool
1112 has_aliases() const;
1113
1114 int
1115 get_number_of_aliases() const;
1116
1117 void
1118 add_alias(const elf_symbol_sptr&);
1119
1120 bool
1121 is_common_symbol() const;
1122
1123 bool
1125
1128
1129 void
1131
1132 const string&
1133 get_id_string() const;
1134
1136 get_alias_from_name(const string& name) const;
1137
1139 get_alias_which_equals(const elf_symbol& other) const;
1140
1142 get_alias_with_default_symbol_version() const;
1143
1144 string
1146 bool include_symbol_itself = true) const;
1147
1148 string
1149 get_aliases_id_string(bool include_symbol_itself = true) const;
1150
1151 static bool
1152 get_name_and_version_from_id(const string& id,
1153 string& name,
1154 string& ver);
1155
1156 bool
1157 operator==(const elf_symbol&) const;
1158
1159 bool
1160 does_alias(const elf_symbol&) const;
1161}; // end class elf_symbol.
1162
1163std::ostream&
1164operator<<(std::ostream& o, elf_symbol::type t);
1165
1166std::ostream&
1167operator<<(std::ostream& o, elf_symbol::binding t);
1168
1169std::ostream&
1170operator<<(std::ostream& o, elf_symbol::visibility t);
1171
1172bool
1174
1175bool
1177
1178bool
1180
1181bool
1183
1184bool
1186
1187bool
1188operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1189
1190bool
1191operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1192
1193bool
1194elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1195
1196void
1197compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1198 const string_elf_symbols_map_type& symtab,
1199 vector<elf_symbol_sptr>& alias_set);
1200
1201/// The abstraction of the version of an ELF symbol.
1203{
1204 struct priv;
1205 std::unique_ptr<priv> priv_;
1206
1207public:
1208 version();
1209
1210 version(const string& v,
1211 bool is_default);
1212
1213 version(const version& v);
1214
1215 ~version();
1216
1217 operator const string&() const;
1218
1219 const string&
1220 str() const;
1221
1222 void
1223 str(const string& s);
1224
1225 bool
1226 is_default() const;
1227
1228 void
1229 is_default(bool f);
1230
1231 bool
1232 is_empty() const;
1233
1234 bool
1235 operator==(const version& o) const;
1236
1237 bool
1238 operator!=(const version& o) const;
1239
1240 version&
1241 operator=(const version& o);
1242};// end class elf_symbol::version
1243
1244class context_rel;
1245/// A convenience typedef for shared pointers to @ref context_rel
1246typedef shared_ptr<context_rel> context_rel_sptr;
1247
1248/// The abstraction of the relationship between an entity and its
1249/// containing scope (its context). That relationship can carry
1250/// properties like access rights (if the parent is a class_decl),
1251/// etc.
1252///
1253/// But importantly, this relationship carries a pointer to the
1254/// actualy parent.
1256{
1257protected:
1258 scope_decl* scope_;
1259 enum access_specifier access_;
1260 bool is_static_;
1261
1262public:
1263 context_rel()
1264 : scope_(0),
1265 access_(no_access),
1266 is_static_(false)
1267 {}
1268
1270 : scope_(s),
1271 access_(no_access),
1272 is_static_(false)
1273 {}
1274
1277 bool f)
1278 : scope_(s),
1279 access_(a),
1280 is_static_(f)
1281 {}
1282
1283 scope_decl*
1284 get_scope() const
1285 {return scope_;}
1286
1288 get_access_specifier() const
1289 {return access_;}
1290
1291 void
1292 set_access_specifier(access_specifier a)
1293 {access_ = a;}
1294
1295 bool
1296 get_is_static() const
1297 {return is_static_;}
1298
1299 void
1300 set_is_static(bool s)
1301 {is_static_ = s;}
1302
1303 void
1304 set_scope(scope_decl* s)
1305 {scope_ = s;}
1306
1307 bool
1308 operator==(const context_rel& o)const
1309 {
1310 return (access_ == o.access_
1311 && is_static_ == o.is_static_);
1312 }
1313
1314 /// Inequality operator.
1315 ///
1316 /// @param o the other instance of @ref context_rel to compare the
1317 /// current instance against.
1318 ///
1319 /// @return true iff the current instance of @ref context_rel is
1320 /// different from @p o.
1321 bool
1322 operator!=(const context_rel& o) const
1323 {return !operator==(o);}
1324
1325 virtual ~context_rel();
1326};// end class context_rel
1327
1328/// A bitfield that gives callers of abigail::ir::equals() some
1329/// insight about how different two internal representation artifacts
1330/// are.
1332{
1333 NO_CHANGE_KIND = 0,
1334
1335 /// This means that a given IR artifact has a local type change.
1337
1338 /// This means that a given IR artifact has a local non-type change.
1339 /// That is a change that is carried by the artifact itself, not by
1340 /// its type.
1342
1343 /// Testing (anding) against this mask means that a given IR artifact has
1344 /// local differences, with respect to the other artifact it was compared
1345 /// against. A local change is a change that is carried by the artifact
1346 /// itself (or its type), rather than by one off its sub-types.
1348
1349 /// This means that a given IR artifact has changes in some of its
1350 /// sub-types, with respect to the other artifact it was compared
1351 /// against.
1353};// end enum change_kind
1354
1357
1360
1363
1366
1367bool
1369 const decl_base& r,
1370 change_kind* k);
1371
1372bool
1373equals(const decl_base&, const decl_base&, change_kind*);
1374
1375/// The base class of both types and declarations.
1377{
1378 struct priv;
1381
1382public:
1383
1384 /// This is a bitmap type which instance is meant to contain the
1385 /// runtime type of a given ABI artifact. Bits of the identifiers
1386 /// of the type of a given artifact as well as the types it inherits
1387 /// from are to be set to 1.
1389 {
1390 ABSTRACT_TYPE_OR_DECL,
1391 ABSTRACT_DECL_BASE = 1,
1392 ABSTRACT_SCOPE_DECL = 1 << 1,
1393 GLOBAL_SCOPE_DECL = 1 << 2,
1394 NAMESPACE_DECL = 1 << 3,
1395 VAR_DECL = 1 << 4,
1396 FUNCTION_DECL = 1 << 5,
1397 FUNCTION_PARAMETER_DECL = 1 << 6,
1398 METHOD_DECL = 1 << 7,
1399 TEMPLATE_DECL = 1 << 8,
1400 ABSTRACT_TYPE_BASE = 1 << 9,
1401 ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1402 BASIC_TYPE = 1 << 11,
1403 SUBRANGE_TYPE = 1 << 12,
1404 QUALIFIED_TYPE = 1 << 13,
1405 POINTER_TYPE = 1 << 14,
1406 REFERENCE_TYPE = 1 << 15,
1407 POINTER_TO_MEMBER_TYPE = 1 << 16,
1408 ARRAY_TYPE = 1 << 17,
1409 ENUM_TYPE = 1 << 18,
1410 TYPEDEF_TYPE = 1 << 19,
1411 CLASS_TYPE = 1 << 20,
1412 UNION_TYPE = 1 << 21,
1413 FUNCTION_TYPE = 1 << 22,
1414 METHOD_TYPE = 1 << 23,
1415 }; // end enum type_or_decl_kind
1416
1418 kind() const;
1419
1420protected:
1421 void
1422 kind(enum type_or_decl_kind);
1423
1424 const void*
1425 runtime_type_instance() const;
1426
1427 void*
1429
1430 void
1431 runtime_type_instance(void*);
1432
1433 const void*
1435
1436 void*
1438
1439 virtual hash_t
1440 hash_value() const;
1441
1442 void
1443 set_hash_value(hash_t) const;
1444
1446 operator=(const type_or_decl_base&);
1447
1448public:
1449 mutable std::unique_ptr<priv> priv_;
1450
1452 enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1453
1454 virtual ~type_or_decl_base();
1455
1456 bool
1457 get_is_artificial() const;
1458
1459 void
1460 set_is_artificial(bool);
1461
1462 const environment&
1463 get_environment() const;
1464
1465 void
1467
1468 location&
1470
1471 bool
1473
1474 const corpus*
1475 get_corpus() const;
1476
1477 corpus*
1478 get_corpus();
1479
1480 void
1482
1483 const translation_unit*
1484 get_translation_unit() const;
1485
1488
1489 virtual bool
1491
1492 virtual string
1493 get_pretty_representation(bool internal = false,
1494 bool qualified_name = true) const = 0;
1495
1499
1503
1507
1511
1512 friend class_decl*
1514
1515 friend type_base*
1516 is_type(const type_or_decl_base*);
1517
1518 friend decl_base*
1519 is_decl(const type_or_decl_base* d);
1520
1521 friend hash_t
1523
1524 template<typename T>
1525 friend hash_t
1526 set_or_get_cached_hash_value(const T& type_or_decl);
1527}; // end class type_or_decl_base
1528
1532
1536
1540
1544
1545bool
1547
1548bool
1550
1551bool
1553
1554/// The base type of all declarations.
1555class decl_base : public virtual type_or_decl_base
1556{
1557 // Forbidden
1558 decl_base();
1559
1560 struct priv;
1561
1562protected:
1563
1564 const interned_string&
1565 peek_qualified_name() const;
1566
1567 void
1569
1570 void
1571 set_qualified_name(const interned_string&) const;
1572
1573 const interned_string&
1575
1576 void
1578
1579public:
1580 // This is public because some internals of the library need to
1581 // update it. But it's opaque to client code anyway, so no big
1582 // deal. Also, it's not handled by a shared_ptr because accessing
1583 // the data members of the priv struct for this decl_base shows up
1584 // on performance profiles when dealing with big binaries with a lot
1585 // of types; dereferencing the shared_ptr involves locking of some
1586 // sort and that is slower than just dereferencing a pointer likere
1587 // here. There are other types for which the priv pointer is
1588 // managed using shared_ptr just fine, because those didn't show up
1589 // during our performance profiling.
1590 priv* priv_;
1591
1592 /// Facility to hash instances of decl_base.
1593 struct hash;
1594
1595 /// ELF visibility
1597 {
1598 VISIBILITY_NONE,
1599 VISIBILITY_DEFAULT,
1600 VISIBILITY_PROTECTED,
1601 VISIBILITY_HIDDEN,
1602 VISIBILITY_INTERNAL
1603 };
1604
1605 /// ELF binding
1607 {
1608 BINDING_NONE,
1609 BINDING_LOCAL,
1610 BINDING_GLOBAL,
1611 BINDING_WEAK
1612 };
1613
1614 virtual void
1616
1617protected:
1618 void
1619 set_context_rel(context_rel *c);
1620 decl_base(const decl_base&);
1621
1622public:
1623 decl_base(const environment& e,
1624 const string& name,
1625 const location& locus,
1626 const string& mangled_name = "",
1627 visibility vis = VISIBILITY_DEFAULT);
1628
1629 decl_base(const environment& e,
1630 const interned_string& name,
1631 const location& locus,
1632 const interned_string& mangled_name = interned_string(),
1633 visibility vis = VISIBILITY_DEFAULT);
1634
1635 decl_base(const environment&, const location&);
1636
1637 const context_rel*
1638 get_context_rel() const;
1639
1642
1643 const interned_string&
1644 get_cached_pretty_representation(bool internal = false) const;
1645
1646 virtual bool
1647 operator==(const decl_base&) const;
1648
1649 virtual bool
1650 operator!=(const decl_base&) const;
1651
1652 virtual bool
1654
1655 virtual ~decl_base();
1656
1657 virtual string
1658 get_pretty_representation(bool internal = false,
1659 bool qualified_name = true) const;
1660
1661 virtual void
1662 get_qualified_name(interned_string& qualified_name,
1663 bool internal = false) const;
1664
1665 virtual const interned_string&
1666 get_qualified_name(bool internal = false) const;
1667
1668 virtual const interned_string&
1669 get_scoped_name() const;
1670
1671 bool
1673
1674 void
1676
1677 const location&
1678 get_location() const;
1679
1680 void
1681 set_location(const location& l);
1682
1683 virtual const interned_string&
1684 get_name() const;
1685
1686 const interned_string&
1688
1689 virtual void
1690 set_name(const string& n);
1691
1692 bool
1693 get_is_anonymous() const;
1694
1695 void
1696 set_is_anonymous(bool);
1697
1698 bool
1700
1701 bool
1703
1705 get_naming_typedef() const;
1706
1707 void
1709
1710 const interned_string&
1711 get_linkage_name() const;
1712
1713 virtual void
1714 set_linkage_name(const string& m);
1715
1716 scope_decl*
1717 get_scope() const;
1718
1719 visibility
1720 get_visibility() const;
1721
1722 void
1723 set_visibility(visibility v);
1724
1725 const decl_base_sptr
1727
1728 void
1729 set_earlier_declaration(const decl_base_sptr&);
1730
1731 const decl_base_sptr
1733
1734 void
1735 set_definition_of_declaration(const decl_base_sptr&);
1736
1737 const decl_base*
1739
1740 bool
1742
1743 void
1745
1746 friend bool
1747 equals(const decl_base&, const decl_base&, change_kind*);
1748
1749 friend bool
1750 equals(const var_decl&, const var_decl&, change_kind*);
1751
1752 friend bool
1754
1755 friend bool
1757 const decl_base& r,
1758 change_kind* k);
1759
1760 friend decl_base_sptr
1761 add_decl_to_scope(decl_base_sptr decl, scope_decl* scpe);
1762
1763 friend void
1764 remove_decl_from_scope(decl_base_sptr);
1765
1766 friend decl_base_sptr
1767 insert_decl_into_scope(decl_base_sptr,
1768 vector<shared_ptr<decl_base> >::iterator,
1769 scope_decl*);
1770
1771 friend enum access_specifier
1773
1774 friend enum access_specifier
1775 get_member_access_specifier(const decl_base_sptr& d);
1776
1777 friend void
1780
1781 friend bool
1783
1784 friend bool
1785 get_member_is_static(const decl_base_sptr& d);
1786
1787 friend void
1788 set_member_is_static(const decl_base_sptr& d, bool s);
1789
1790 friend void
1791 set_member_is_static(decl_base& d, bool s);
1792
1793 friend bool
1795
1796 friend class class_or_union;
1797 friend class class_decl;
1798 friend class scope_decl;
1799};// end class decl_base
1800
1801bool
1802operator==(const decl_base_sptr&, const decl_base_sptr&);
1803
1804bool
1805operator!=(const decl_base_sptr&, const decl_base_sptr&);
1806
1807bool
1808operator==(const type_base_sptr&, const type_base_sptr&);
1809
1810bool
1811operator!=(const type_base_sptr&, const type_base_sptr&);
1812
1813std::ostream&
1814operator<<(std::ostream&, decl_base::visibility);
1815
1816std::ostream&
1817operator<<(std::ostream&, decl_base::binding);
1818
1819bool
1820equals(const scope_decl&, const scope_decl&, change_kind*);
1821
1822/// A declaration that introduces a scope.
1823class scope_decl : public virtual decl_base
1824{
1825 struct priv;
1826 std::unique_ptr<priv> priv_;
1827
1828public:
1829
1830 /// Convenience typedef for a vector of @ref decl_base_sptr.
1831 typedef std::vector<decl_base_sptr > declarations;
1832 /// Convenience typedef for a vector of @ref function_type_sptr.
1833 typedef std::vector<function_type_sptr > function_types;
1834 /// Convenience typedef for a vector of @ref scope_decl_sptr.
1835 typedef std::vector<scope_decl_sptr> scopes;
1836
1837 scope_decl();
1838
1839protected:
1840 virtual decl_base_sptr
1841 add_member_decl(const decl_base_sptr& member);
1842
1843 decl_base_sptr
1844 insert_member_decl(decl_base_sptr member, declarations::iterator before);
1845
1846 virtual void
1847 remove_member_decl(decl_base_sptr member);
1848
1849public:
1850
1851 scope_decl(const environment& env,
1852 const string& name, const location& locus,
1853 visibility vis = VISIBILITY_DEFAULT);
1854
1855 scope_decl(const environment& env, location& l);
1856
1857 virtual bool
1858 operator==(const decl_base&) const;
1859
1861 get_canonical_types() const;
1862
1865
1868
1869 const declarations&
1870 get_member_decls() const;
1871
1874
1875 const declarations&
1877
1878 virtual size_t
1880
1881 virtual size_t
1883
1884 virtual size_t
1886
1887 scopes&
1889
1890 const scopes&
1891 get_member_scopes() const;
1892
1893 bool
1894 is_empty() const;
1895
1896 bool
1897 find_iterator_for_member(const decl_base*, declarations::iterator&);
1898
1899 bool
1900 find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1901
1902 void
1903 insert_member_type(type_base_sptr t,
1904 declarations::iterator before);
1905
1906 void
1907 add_member_type(type_base_sptr t);
1908
1909 type_base_sptr
1910 add_member_type(type_base_sptr t, access_specifier a);
1911
1912 void
1913 remove_member_type(type_base_sptr t);
1914
1916 get_member_types() const;
1917
1920
1921 type_base_sptr
1922 find_member_type(const string& name) const;
1923
1924 virtual bool
1926
1927 virtual ~scope_decl();
1928
1929 friend decl_base_sptr
1930 add_decl_to_scope(decl_base_sptr decl, scope_decl* scope);
1931
1932 friend decl_base_sptr
1933 insert_decl_into_scope(decl_base_sptr decl,
1934 scope_decl::declarations::iterator before,
1935 scope_decl* scope);
1936
1937 friend void
1938 remove_decl_from_scope(decl_base_sptr decl);
1939};//end class scope_decl
1940
1941bool
1943
1944bool
1946
1947/// This abstracts the global scope of a given translation unit.
1948///
1949/// Only one instance of this class must be present in a given
1950/// translation_unit. That instance is implicitely created the first
1951/// time translatin_unit::get_global_scope is invoked.
1953{
1954 translation_unit* translation_unit_;
1955
1957
1958public:
1959
1960 friend class translation_unit;
1961
1963 get_translation_unit() const
1964 {return translation_unit_;}
1965
1966 virtual ~global_scope();
1967};
1968
1969bool
1970equals(const type_base&, const type_base&, change_kind*);
1971
1972/// An abstraction helper for type declarations
1973class type_base : public virtual type_or_decl_base
1974{
1975 struct priv;
1976
1977public:
1978 // This priv pointer is not handled by a shared_ptr because
1979 // accessing the data members of the priv struct for this type_base
1980 // shows up on performance profiles when dealing with big binaries
1981 // with a lot of types; dereferencing the shared_ptr involves
1982 // locking of some sort and that is slower than just dereferencing a
1983 // pointer likere here. There are other types for which the priv
1984 // pointer is managed using shared_ptr just fine, because those
1985 // didn't show up during our performance profiling.
1986 priv* priv_;
1987
1988private:
1989 // Forbid this.
1990 type_base();
1991
1992 static type_base_sptr
1993 get_canonical_type_for(type_base_sptr);
1994
1995protected:
1996 virtual void
1998
1999public:
2000
2001 struct hash;
2002
2003 type_base(const environment& e, size_t s, size_t a);
2004
2005 virtual hash_t
2006 hash_value() const;
2007
2008 friend type_base_sptr canonicalize(type_base_sptr, bool, bool);
2009
2010 type_base_sptr
2011 get_canonical_type() const;
2012
2013 type_base*
2015
2016 const interned_string&
2017 get_cached_pretty_representation(bool internal = false) const;
2018
2019 virtual bool
2020 operator==(const type_base&) const;
2021
2022 virtual bool
2023 operator!=(const type_base&) const;
2024
2025 virtual bool
2027
2028 virtual ~type_base();
2029
2030 virtual void
2031 set_size_in_bits(size_t);
2032
2033 virtual size_t
2034 get_size_in_bits() const;
2035
2036 virtual void
2037 set_alignment_in_bits(size_t);
2038
2039 virtual size_t
2040 get_alignment_in_bits() const;
2041};//end class type_base
2042
2043
2044/// A predicate for deep equality of instances of
2045/// type_base*
2047{
2048 bool
2049 operator()(const type_base* l, const type_base* r) const
2050 {
2051 if (!!l != !!r)
2052 return false;
2053
2054 if (l == r)
2055 return true;
2056
2057 if (l)
2058 return *l == *r;
2059
2060 return true;
2061 }
2062};
2063
2064/// A predicate for deep equality of instances of
2065/// shared_ptr<type_base>
2067{
2068 bool
2069 operator()(const type_base_sptr l, const type_base_sptr r) const
2070 {
2071 if (!!l != !!r)
2072 return false;
2073
2074 if (l.get() == r.get())
2075 return true;
2076
2077 if (l)
2078 return *l == *r;
2079
2080 return true;
2081 }
2082};
2083
2084bool
2085equals(const type_decl&, const type_decl&, change_kind*);
2086
2087/// A basic type declaration that introduces no scope.
2088class type_decl : public virtual decl_base, public virtual type_base
2089{
2090 // Forbidden.
2091 type_decl();
2092
2093public:
2094
2095 /// Facility to hash instance of type_decl
2096 struct hash;
2097
2098 type_decl(const environment& env,
2099 const string& name,
2100 size_t size_in_bits,
2101 size_t alignment_in_bits,
2102 const location& locus,
2103 const string& mangled_name = "",
2104 visibility vis = VISIBILITY_DEFAULT);
2105
2106 virtual hash_t
2107 hash_value() const;
2108
2109 virtual bool
2110 operator==(const type_base&) const;
2111
2112 virtual bool
2113 operator==(const decl_base&) const;
2114
2115 virtual bool
2116 operator==(const type_decl&) const;
2117
2118 virtual bool
2119 operator!=(const type_base&)const;
2120
2121 virtual bool
2122 operator!=(const decl_base&)const;
2123
2124 virtual bool
2125 operator!=(const type_decl&)const;
2126
2127 virtual void
2128 get_qualified_name(interned_string& qualified_name,
2129 bool internal = false) const;
2130
2131 virtual const interned_string&
2132 get_qualified_name(bool internal = false) const;
2133
2134 virtual string
2135 get_pretty_representation(bool internal = false,
2136 bool qualified_name = true) const;
2137
2138 virtual bool
2140
2141 virtual ~type_decl();
2142};// end class type_decl.
2143
2144bool
2146
2147bool
2149
2150bool
2152
2153/// A type that introduces a scope.
2154class scope_type_decl : public scope_decl, public virtual type_base
2155{
2157
2158public:
2159
2160 scope_type_decl(const environment& env, const string& name,
2161 size_t size_in_bits, size_t alignment_in_bits,
2162 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2163
2164 virtual bool
2165 operator==(const decl_base&) const;
2166
2167 virtual bool
2168 operator==(const type_base&) const;
2169
2170 virtual bool
2172
2173 virtual ~scope_type_decl();
2174};
2175
2176/// The abstraction of a namespace declaration
2178{
2179public:
2180
2181 namespace_decl(const environment& env, const string& name,
2182 const location& locus, visibility vis = VISIBILITY_DEFAULT);
2183
2184 virtual string
2185 get_pretty_representation(bool internal = false,
2186 bool qualified_name = true) const;
2187
2188 virtual bool
2189 operator==(const decl_base&) const;
2190
2191 virtual bool
2193
2194 virtual ~namespace_decl();
2195
2197};// end class namespace_decl
2198
2199/// A convenience typedef for vectors of @ref namespace_decl_sptr
2200typedef vector<namespace_decl_sptr> namespaces_type;
2201
2202bool
2204
2205/// The abstraction of a qualified type.
2206class qualified_type_def : public virtual type_base, public virtual decl_base
2207{
2208 class priv;
2209 std::unique_ptr<priv> priv_;
2210
2211 // Forbidden.
2213
2214protected:
2215 string build_name(bool, bool internal = false) const;
2216 virtual void on_canonical_type_set();
2217
2218public:
2219
2220 /// A Hasher for instances of qualified_type_def
2221 struct hash;
2222
2223 /// Bit field values representing the cv qualifiers of the
2224 /// underlying type.
2225 enum CV
2226 {
2227 CV_NONE = 0,
2228 CV_CONST = 1,
2229 CV_VOLATILE = 1 << 1,
2230 CV_RESTRICT = 1 << 2
2231 };
2232
2233 qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2234
2235 qualified_type_def(const environment& env, CV quals, const location& locus);
2236
2237 virtual hash_t
2238 hash_value() const;
2239
2240 virtual size_t
2241 get_size_in_bits() const;
2242
2243 virtual bool
2244 operator==(const decl_base&) const;
2245
2246 virtual bool
2247 operator==(const type_base&) const;
2248
2249 virtual bool
2250 operator==(const qualified_type_def&) const;
2251
2252 CV
2253 get_cv_quals() const;
2254
2255 void
2256 set_cv_quals(CV cv_quals);
2257
2258 string
2260
2261 type_base_sptr
2262 get_underlying_type() const;
2263
2264 void
2265 set_underlying_type(const type_base_sptr&);
2266
2267 virtual void
2268 get_qualified_name(interned_string& qualified_name,
2269 bool internal = false) const;
2270
2271 virtual const interned_string&
2272 get_qualified_name(bool internal = false) const;
2273
2274 virtual bool
2276
2277 virtual ~qualified_type_def();
2278}; // end class qualified_type_def.
2279
2280bool
2281operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2282
2283bool
2284operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2285
2288
2291
2294
2297
2300
2301std::ostream&
2302operator<<(std::ostream&, qualified_type_def::CV);
2303
2304string
2306
2308get_name_of_qualified_type(const type_base_sptr& underlying_type,
2310 bool qualified = true, bool internal = false);
2311
2312qualified_type_def_sptr
2313lookup_qualified_type(const type_base_sptr&,
2315 const translation_unit&);
2316bool
2318
2319/// The abstraction of a pointer type.
2320class pointer_type_def : public virtual type_base, public virtual decl_base
2321{
2322 struct priv;
2323 std::unique_ptr<priv> priv_;
2324
2325 // Forbidden.
2327
2328protected:
2329 virtual void on_canonical_type_set();
2330
2331public:
2332
2333 /// A hasher for instances of pointer_type_def
2334 struct hash;
2335
2336 pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2337 size_t alignment_in_bits, const location& locus);
2338
2339 pointer_type_def(const environment& env, size_t size_in_bits,
2340 size_t alignment_in_bits, const location& locus);
2341
2342 virtual hash_t
2343 hash_value() const;
2344
2345 void
2346 set_pointed_to_type(const type_base_sptr&);
2347
2348 virtual bool
2349 operator==(const decl_base&) const;
2350
2351 virtual bool
2352 operator==(const type_base&) const;
2353
2354 bool
2355 operator==(const pointer_type_def&) const;
2356
2357 const type_base_sptr
2358 get_pointed_to_type() const;
2359
2360 type_base*
2362
2363 virtual void
2364 get_qualified_name(interned_string&, bool internal = false) const;
2365
2366 virtual const interned_string&
2367 get_qualified_name(bool internal = false) const;
2368
2369 virtual bool
2371
2372 virtual ~pointer_type_def();
2373}; // end class pointer_type_def
2374
2375bool
2377
2378bool
2380
2381bool
2383
2384
2385/// Abstracts a reference type.
2386class reference_type_def : public virtual type_base, public virtual decl_base
2387{
2388 struct priv;
2389 std::unique_ptr<priv> priv_;
2390
2391 // Forbidden.
2393
2394protected:
2395 virtual void on_canonical_type_set();
2396
2397public:
2398
2399 /// Hasher for intances of reference_type_def.
2400 struct hash;
2401
2402 reference_type_def(const type_base_sptr pointed_to_type,
2403 bool lvalue, size_t size_in_bits,
2404 size_t alignment_in_bits, const location& locus);
2405
2406 reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2407 size_t alignment_in_bits, const location& locus);
2408
2409 virtual hash_t
2410 hash_value() const;
2411
2412 void
2413 set_pointed_to_type(type_base_sptr& pointed_to_type);
2414
2415 virtual bool
2416 operator==(const decl_base&) const;
2417
2418 virtual bool
2419 operator==(const type_base&) const;
2420
2421 bool
2422 operator==(const reference_type_def&) const;
2423
2424 type_base_sptr
2425 get_pointed_to_type() const;
2426
2427 bool
2428 is_lvalue() const;
2429
2430 virtual void
2431 get_qualified_name(interned_string& qualified_name,
2432 bool internal = false) const;
2433
2434 virtual const interned_string&
2435 get_qualified_name(bool internal = false) const;
2436
2437 virtual string
2438 get_pretty_representation(bool internal = false,
2439 bool qualified_name = true) const;
2440
2441 virtual bool
2443
2444 virtual ~reference_type_def();
2445}; // end class reference_type_def
2446
2447bool
2449
2450bool
2452
2453/// The abstraction of a pointer-to-member type.
2454class ptr_to_mbr_type : public virtual type_base,
2455 public virtual decl_base
2456{
2457 struct priv;
2458 std::unique_ptr<priv> priv_;
2459
2460 // Forbidden
2461 ptr_to_mbr_type() = delete;
2462
2463 public:
2464
2465 /// Hasher for instances of @ref ptr_to_mbr_type;
2466 struct hash;
2467
2468 ptr_to_mbr_type(const environment& env,
2469 const type_base_sptr& member_type,
2470 const type_base_sptr& containing_type,
2471 size_t size_in_bits,
2472 size_t alignment_in_bits,
2473 const location& locus);
2474
2475 virtual const interned_string&
2476 get_name() const;
2477
2478 virtual hash_t
2479 hash_value() const;
2480
2481 const type_base_sptr&
2482 get_member_type() const;
2483
2484 const type_base_sptr&
2485 get_containing_type() const;
2486
2487 bool
2488 operator==(const ptr_to_mbr_type&) const;
2489
2490 virtual bool
2491 operator==(const type_base&) const;
2492
2493 virtual bool
2494 operator==(const decl_base&) const;
2495
2496 virtual void
2497 get_qualified_name(interned_string& qualified_name,
2498 bool internal = false) const;
2499
2500 virtual const interned_string&
2501 get_qualified_name(bool internal = false) const;
2502
2503 virtual bool
2505
2506 virtual ~ptr_to_mbr_type();
2507}; // end class ptr_to_mbr_type
2508
2509bool
2510equals(const ptr_to_mbr_type&,
2511 const ptr_to_mbr_type&,
2512 change_kind*);
2513
2514bool
2516
2517/// The abstraction of an array type.
2518class array_type_def : public virtual type_base, public virtual decl_base
2519{
2520 struct priv;
2521 std::unique_ptr<priv> priv_;
2522
2523 // Forbidden.
2525
2526 void update_size();
2527
2528public:
2529
2530 /// Hasher for intances of array_type_def.
2531 struct hash;
2532
2533 class subrange_type;
2534
2535 /// Convenience typedef for a shared pointer on a @ref
2536 /// function_decl::subrange
2537 typedef shared_ptr<subrange_type> subrange_sptr;
2538
2539 /// Convenience typedef for a vector of @ref subrange_sptr
2540 typedef std::vector<subrange_sptr> subranges_type;
2541
2542 /// Abstraction for an array range type, like in Ada, or just for an
2543 /// array dimension like in C or C++.
2544 class subrange_type : public virtual type_base, public virtual decl_base
2545 {
2546 struct priv;
2547 std::unique_ptr<priv> priv_;
2548
2549 // Forbidden.
2550 subrange_type();
2551 public:
2552
2553 virtual ~subrange_type();
2554 /// This class is to hold the value of the bound of a subrange.
2555 /// The value can be either signed or unsigned, at least when it
2556 /// comes from DWARF. The class keeps the sign information, but
2557 /// allows users to access the value as signed or unsigned as they
2558 /// see fit.
2560 {
2561 public:
2562 enum signedness
2563 {
2564 UNSIGNED_SIGNEDNESS,
2565 SIGNED_SIGNEDNESS
2566 };
2567
2568 private:
2569 signedness s_;
2570
2571 public:
2572 union
2573 {
2574 uint64_t unsigned_;
2575 int64_t signed_;
2576 } v_;
2577 bound_value();
2578 bound_value(uint64_t);
2579 bound_value(int64_t);
2580 enum signedness get_signedness() const;
2581 void set_signedness(enum signedness s);
2582 int64_t get_signed_value() const;
2583 uint64_t get_unsigned_value();
2584 void set_unsigned(uint64_t v);
2585 void set_signed(int64_t v);
2586 bool operator==(const bound_value&) const;
2587 }; //end class bound_value
2588
2589 /// Hasher for an instance of array::subrange
2590 struct hash;
2591
2592 subrange_type(const environment& env,
2593 const string& name,
2594 bound_value lower_bound,
2595 bound_value upper_bound,
2596 const type_base_sptr& underlying_type,
2597 const location& loc,
2598 translation_unit::language l = translation_unit::LANG_C11);
2599
2600 subrange_type(const environment& env,
2601 const string& name,
2602 bound_value lower_bound,
2603 bound_value upper_bound,
2604 const location& loc,
2605 translation_unit::language l = translation_unit::LANG_C11);
2606
2607 subrange_type(const environment& env,
2608 const string& name,
2609 bound_value upper_bound,
2610 const location& loc,
2611 translation_unit::language l = translation_unit::LANG_C11);
2612
2613 virtual hash_t
2614 hash_value() const;
2615
2616 type_base_sptr
2617 get_underlying_type() const;
2618
2619 void
2620 set_underlying_type(const type_base_sptr &);
2621
2622 int64_t
2623 get_upper_bound() const;
2624
2625 int64_t
2626 get_lower_bound() const;
2627
2628 void
2629 set_upper_bound(int64_t ub);
2630
2631 void
2632 set_lower_bound(int64_t lb);
2633
2634 uint64_t
2635 get_length() const;
2636
2637 bool
2638 is_non_finite() const;
2639
2640 void
2641 is_non_finite(bool);
2642
2644 get_language() const;
2645
2646 virtual bool
2647 operator==(const decl_base&) const;
2648
2649 virtual bool
2650 operator==(const type_base&) const;
2651
2652 bool
2653 operator==(const subrange_type& o) const;
2654
2655 bool
2656 operator!=(const decl_base& o) const;
2657
2658 bool
2659 operator!=(const type_base& o) const;
2660
2661 bool
2662 operator!=(const subrange_type& o) const;
2663
2664 string
2665 as_string() const;
2666
2667 static string
2668 vector_as_string(const vector<subrange_sptr>&);
2669
2670 virtual string
2671 get_pretty_representation(bool internal = false,
2672 bool qualified_name = true) const;
2673
2674 virtual bool
2676 }; // end class subrange_type
2677
2678 array_type_def(const type_base_sptr type,
2679 const std::vector<subrange_sptr>& subs,
2680 const location& locus);
2681
2682 array_type_def(const environment& env,
2683 const std::vector<subrange_sptr>& subs,
2684 const location& locus);
2685
2686 virtual hash_t
2687 hash_value() const;
2688
2690 get_language() const;
2691
2692 virtual bool
2693 operator==(const decl_base&) const;
2694
2695 virtual bool
2696 operator==(const type_base&) const;
2697
2698 virtual void
2699 get_qualified_name(interned_string& qualified_name,
2700 bool internal = false) const;
2701
2702 virtual const interned_string&
2703 get_qualified_name(bool internal = false) const;
2704
2705 const type_base_sptr
2706 get_element_type() const;
2707
2708 void
2709 set_element_type(const type_base_sptr& element_type);
2710
2711 virtual void
2712 append_subranges(const std::vector<subrange_sptr>& subs);
2713
2714 virtual int
2715 get_dimension_count() const;
2716
2717 virtual bool
2718 is_non_finite() const;
2719
2720 virtual string
2721 get_pretty_representation(bool internal = false,
2722 bool qualified_name = true) const;
2723
2724 virtual string
2725 get_subrange_representation() const;
2726
2727 virtual bool
2729
2730 const location&
2731 get_location() const;
2732
2733 const std::vector<subrange_sptr>&
2734 get_subranges() const;
2735
2736 virtual ~array_type_def();
2737
2738}; // end class array_type_def
2739
2742
2745
2746bool
2749 change_kind*);
2750
2751bool
2753
2754/// Abstracts a declaration for an enum type.
2755class enum_type_decl : public virtual type_base, public virtual decl_base
2756{
2757 class priv;
2758 std::unique_ptr<priv> priv_;
2759
2760 // Forbidden
2762
2763public:
2764
2765 /// A hasher for an enum_type_decl.
2766 struct hash;
2767
2768 /// Enumerator Datum.
2769 class enumerator;
2770
2771 /// Convenience typedef for a list of @ref enumerator.
2772 typedef std::vector<enumerator> enumerators;
2773
2774 /// Constructor of an enum type declaration.
2775 ///
2776 /// @param name the name of the enum
2777 ///
2778 /// @param locus the locus at which the enum appears in the source
2779 /// code.
2780 ///
2781 /// @param underlying_type the underlying type of the enum
2782 ///
2783 /// @param enms a list of enumerators for this enum.
2784 ///
2785 /// @param mangled_name the mangled name of the enum type.
2786 ///
2787 /// @param vis the visibility of instances of this type.
2788 enum_type_decl(const string& name,
2789 const location& locus,
2790 type_base_sptr underlying_type,
2791 enumerators& enms,
2792 const string& mangled_name = "",
2793 visibility vis = VISIBILITY_DEFAULT);
2794
2795 virtual hash_t
2796 hash_value() const;
2797
2798 type_base_sptr
2799 get_underlying_type() const;
2800
2801 const enumerators&
2802 get_enumerators() const;
2803
2804 const enumerators&
2805 get_sorted_enumerators() const;
2806
2809
2810 virtual string
2811 get_pretty_representation(bool internal = false,
2812 bool qualified_name = true) const;
2813
2814 virtual bool
2815 operator==(const decl_base&) const;
2816
2817 virtual bool
2818 operator==(const type_base&) const;
2819
2820 virtual bool
2822
2823 virtual ~enum_type_decl();
2824
2825 friend bool
2827 const enum_type_decl& r,
2828 change_kind* k);
2829}; // end class enum_type_decl
2830
2831bool
2833
2834bool
2836
2837bool
2839 const enum_type_decl& r,
2840 change_kind* k);
2841
2842/// The abstraction of an enumerator
2844{
2845 class priv;
2846 std::unique_ptr<priv> priv_;
2847
2848public:
2849
2850 enumerator();
2851
2852 ~enumerator();
2853
2854 enumerator(const string& name, int64_t value);
2855
2856 enumerator(const enumerator&);
2857
2858 enumerator&
2859 operator=(const enumerator&);
2860
2861 bool
2862 operator==(const enumerator& other) const;
2863
2864 bool
2865 operator!=(const enumerator& other) const;
2866
2867 const string&
2868 get_name() const;
2869
2870 const string&
2871 get_qualified_name(bool internal = false) const;
2872
2873 void
2874 set_name(const string& n);
2875
2876 int64_t
2877 get_value() const;
2878
2879 void
2880 set_value(int64_t v);
2881
2883 get_enum_type() const;
2884
2885 void
2887}; // end class enum_type_def::enumerator
2888
2889bool
2891 const enum_type_decl &enom);
2892
2893bool
2895
2896/// The abstraction of a typedef declaration.
2897class typedef_decl : public virtual type_base, public virtual decl_base
2898{
2899 struct priv;
2900 std::unique_ptr<priv> priv_;
2901
2902 // Forbidden
2903 typedef_decl();
2904
2905public:
2906
2907 /// Hasher for the typedef_decl type.
2908 struct hash;
2909
2910 typedef_decl(const string& name,
2911 const type_base_sptr underlying_type,
2912 const location& locus,
2913 const string& mangled_name = "",
2914 visibility vis = VISIBILITY_DEFAULT);
2915
2916 typedef_decl(const string& name,
2917 const environment& env,
2918 const location& locus,
2919 const string& mangled_name = "",
2920 visibility vis = VISIBILITY_DEFAULT);
2921
2922 virtual hash_t
2923 hash_value() const;
2924
2925 virtual size_t
2926 get_size_in_bits() const;
2927
2928 virtual size_t
2929 get_alignment_in_bits() const;
2930
2931 virtual bool
2932 operator==(const decl_base&) const;
2933
2934 virtual bool
2935 operator==(const type_base&) const;
2936
2937 virtual string
2938 get_pretty_representation(bool internal = false,
2939 bool qualified_name = true) const;
2940
2941 type_base_sptr
2942 get_underlying_type() const;
2943
2944 void
2945 set_underlying_type(const type_base_sptr&);
2946
2947 virtual void
2948 get_qualified_name(interned_string& qualified_name,
2949 bool internal = false) const;
2950
2951 virtual const interned_string&
2952 get_qualified_name(bool internal = false) const;
2953
2954 virtual bool
2956
2957 virtual ~typedef_decl();
2958};// end class typedef_decl
2959
2960/// The abstraction for a data member context relationship. This
2961/// relates a data member to its parent class.
2962///
2963/// The relationship carries properties like the offset of the data
2964/// member, if applicable.
2966{
2967protected:
2968 struct priv;
2969 std::unique_ptr<priv> priv_;
2970
2971public:
2973
2975 bool is_laid_out,
2976 size_t offset_in_bits,
2978 bool is_static);
2979
2981
2982 bool
2983 get_is_laid_out() const;
2984
2985 void
2986 set_is_laid_out(bool f);
2987
2988 size_t
2989 get_offset_in_bits() const;
2990
2991 void
2992 set_offset_in_bits(size_t o);
2993
2994 const var_decl*
2996
2997 void
2999
3000 bool
3001 operator==(const dm_context_rel& o) const;
3002
3003 bool
3004 operator!=(const dm_context_rel& o) const;
3005
3006 virtual ~dm_context_rel();
3007};// end class class_decl::dm_context_rel
3008
3009bool
3010equals(const var_decl&, const var_decl&, change_kind*);
3011
3012bool
3014
3015bool
3017
3018/// Abstracts a variable declaration.
3019class var_decl : public virtual decl_base
3020{
3021 struct priv;
3022 std::unique_ptr<priv> priv_;
3023
3024 // Forbidden
3025 var_decl();
3026
3027 virtual void
3028 set_scope(scope_decl*);
3029
3030public:
3031
3032 /// Equality functor to compare pointers to variable_decl.
3033 struct ptr_equal;
3034
3035 var_decl(const string& name,
3036 type_base_sptr type,
3037 const location& locus,
3038 const string& mangled_name,
3039 visibility vis = VISIBILITY_DEFAULT,
3040 binding bind = BINDING_NONE);
3041
3042 virtual bool
3043 operator==(const decl_base&) const;
3044
3045 const type_base_sptr
3046 get_type() const;
3047
3048 void
3049 set_type(type_base_sptr&);
3050
3051 const type_base*
3052 get_naked_type() const;
3053
3054 binding
3055 get_binding() const;
3056
3057 void
3059
3060 void
3061 set_symbol(const elf_symbol_sptr& sym);
3062
3063 const elf_symbol_sptr&
3064 get_symbol() const;
3065
3067 clone() const;
3068
3070 get_id() const;
3071
3072 virtual const interned_string&
3073 get_qualified_name(bool internal = false) const;
3074
3075 virtual string
3076 get_pretty_representation(bool internal = false,
3077 bool qualified_name = true) const;
3078
3079 string
3080 get_anon_dm_reliable_name(bool qualified = true) const;
3081
3082 virtual bool
3084
3085 virtual ~var_decl();
3086
3087 friend void
3089
3090 friend uint64_t
3092
3093 friend uint64_t
3095
3096 friend uint64_t
3098
3099 friend uint64_t
3101
3102 friend void
3104
3105 friend bool
3107
3108 friend bool
3110}; // end class var_decl
3111
3112bool
3114
3115/// Abstraction for a function declaration.
3116class function_decl : public virtual decl_base
3117{
3118 struct priv;
3119 // This priv pointer is not handled by a shared_ptr because
3120 // accessing the data members of the priv struct for this
3121 // function_decl shows up on performance profiles when dealing with
3122 // big binaries with a lot of types; dereferencing the shared_ptr
3123 // involves locking of some sort and that is slower than just
3124 // dereferencing a pointer likere here. There are other types for
3125 // which the priv pointer is managed using shared_ptr just fine,
3126 // because those didn't show up during our performance profiling.
3127 priv* priv_;
3128
3129public:
3130
3131 /// Equality functor to compare pointers to function_decl
3132 struct ptr_equal;
3133
3134 /// Abstraction for the parameter of a function.
3135 class parameter;
3136
3137 /// Convenience typedef for a shared pointer on a @ref
3138 /// function_decl::parameter
3139 typedef shared_ptr<parameter> parameter_sptr;
3140
3141 /// Convenience typedef for a vector of @ref parameter_sptr
3142 typedef std::vector<parameter_sptr> parameters;
3143
3144 function_decl(const string& name,
3146 bool declared_inline,
3147 const location& locus,
3148 const string& mangled_name,
3149 visibility vis,
3150 binding bind);
3151
3152 function_decl(const string& name,
3153 type_base_sptr fn_type,
3154 bool declared_inline,
3155 const location& locus,
3156 const string& mangled_name = "",
3157 visibility vis = VISIBILITY_DEFAULT,
3158 binding bind = BINDING_GLOBAL);
3159
3160 virtual string
3161 get_pretty_representation(bool internal = false,
3162 bool qualified_name = true) const;
3163
3164 string
3165 get_pretty_representation_of_declarator (bool internal = false) const;
3166
3167 const std::vector<parameter_sptr >&
3168 get_parameters() const;
3169
3170 void
3172
3173 void
3174 append_parameters(std::vector<parameter_sptr >& parms);
3175
3176 parameters::const_iterator
3178
3179 const function_type_sptr
3180 get_type() const;
3181
3182 const function_type*
3183 get_naked_type() const;
3184
3185 const type_base_sptr
3186 get_return_type() const;
3187
3188 void
3189 set_type(const function_type_sptr& fn_type);
3190
3191 void
3192 set_symbol(const elf_symbol_sptr& sym);
3193
3194 const elf_symbol_sptr&
3195 get_symbol() const;
3196
3197 bool
3198 is_declared_inline() const;
3199
3200 void
3201 is_declared_inline(bool);
3202
3203 binding
3204 get_binding() const;
3205
3207 clone() const;
3208
3209 virtual bool
3210 operator==(const decl_base& o) const;
3211
3212 /// Return true iff the function takes a variable number of
3213 /// parameters.
3214 ///
3215 /// @return true if the function taks a variable number
3216 /// of parameters.
3217 bool
3218 is_variadic() const;
3219
3221 get_id() const;
3222
3223 virtual bool
3225
3226 virtual ~function_decl();
3227}; // end class function_decl
3228
3229bool
3231
3232bool
3234
3235bool
3237
3238bool
3241 change_kind*);
3242
3243/// A comparison functor to compare pointer to instances of @ref
3244/// type_or_decl_base.
3246{
3247 /// Comparison operator for ABI artifacts.
3248 ///
3249 /// @param f the first ABI artifact to consider for the comparison.
3250 ///
3251 /// @param s the second ABI artifact to consider for the comparison.
3252 ///
3253 /// @return true iff @p f is lexicographically less than than @p s.
3254 bool
3256 const type_or_decl_base *s)
3257 {
3258 function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3259 if (f_fn && s_fn)
3260 return function_decl_is_less_than(*f_fn, *s_fn);
3261
3262 var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3263 if (f_var && s_var)
3264 return get_name(f_var) < get_name(s_var);
3265
3266 string l_repr = get_pretty_representation(f),
3267 r_repr = get_pretty_representation(s);
3268
3269 return l_repr < r_repr;
3270 }
3271
3272 /// Comparison operator for ABI artifacts.
3273 ///
3274 /// @param f the first ABI artifact to consider for the comparison.
3275 ///
3276 /// @param s the second ABI artifact to consider for the comparison.
3277 ///
3278 /// @return true iff @p f is lexicographically less than than @p s.
3279 bool
3281 const type_or_decl_base_sptr& s)
3282 {return operator()(f.get(), s.get());}
3283}; // end struct type_or_decl_base_comp
3284
3285/// Abstraction of a function parameter.
3287{
3288 struct priv;
3289 std::unique_ptr<priv> priv_;
3290
3291public:
3292
3293 parameter(const type_base_sptr type,
3294 unsigned index,
3295 const string& name,
3296 const location& loc,
3297 bool variadic_marker = false);
3298
3299 parameter(const type_base_sptr type,
3300 unsigned index,
3301 const string& name,
3302 const location& loc,
3303 bool variadic_marker,
3304 bool is_artificial);
3305
3306 parameter(const type_base_sptr type,
3307 const string& name,
3308 const location& loc,
3309 bool variadic_marker = false,
3310 bool is_artificial = false);
3311
3312 parameter(const type_base_sptr type,
3313 unsigned index = 0,
3314 bool variadic_marker = false);
3315
3316 virtual ~parameter();
3317
3318 const type_base_sptr
3319 get_type()const;
3320
3322 get_type_name() const;
3323
3324 const string
3326
3328 get_name_id() const;
3329
3330 unsigned
3331 get_index() const;
3332
3333 void
3334 set_index(unsigned i);
3335
3336 bool
3337 get_variadic_marker() const;
3338
3339 bool
3340 operator==(const parameter& o) const;
3341
3342 virtual bool
3343 operator==(const decl_base&) const;
3344
3345 virtual bool
3347
3348 virtual void
3349 get_qualified_name(interned_string& qualified_name,
3350 bool internal = false) const;
3351
3352 virtual string
3353 get_pretty_representation(bool internal = false,
3354 bool qualified_name = true) const;
3355}; // end class function_decl::parameter
3356
3357bool
3360
3363
3366
3367bool
3369
3370/// Abstraction of a function type.
3371class function_type : public virtual type_base
3372{
3373protected:
3374 virtual void on_canonical_type_set();
3375
3376public:
3377 /// Hasher for an instance of function_type
3378 struct hash;
3379
3380 /// Convenience typedef for a shared pointer on a @ref
3381 /// function_decl::parameter
3382 typedef shared_ptr<function_decl::parameter> parameter_sptr;
3383 /// Convenience typedef for a vector of @ref parameter_sptr
3384 typedef std::vector<parameter_sptr> parameters;
3385
3386 struct priv;
3387 std::unique_ptr<priv> priv_;
3388
3389private:
3390 function_type();
3391
3392public:
3393
3394 function_type(type_base_sptr return_type,
3395 const parameters& parms,
3396 size_t size_in_bits,
3397 size_t alignment_in_bits);
3398
3399 function_type(type_base_sptr return_type,
3400 size_t size_in_bits,
3401 size_t alignment_in_bits);
3402
3403 function_type(const environment& env,
3404 size_t size_in_bits,
3405 size_t alignment_in_bits);
3406
3407 virtual hash_t
3408 hash_value() const;
3409
3410 type_base_sptr
3411 get_return_type() const;
3412
3413 void
3414 set_return_type(type_base_sptr t);
3415
3416 const parameters&
3417 get_parameters() const;
3418
3419 const parameter_sptr
3421
3422 void
3423 set_parameters(const parameters &p);
3424
3425 void
3427
3428 bool
3429 is_variadic() const;
3430
3431 parameters::const_iterator
3433
3434 parameters::const_iterator
3435 get_first_parm() const;
3436
3437 const interned_string&
3438 get_cached_name(bool internal = false) const;
3439
3440 virtual bool
3441 operator==(const type_base&) const;
3442
3443 virtual string
3444 get_pretty_representation(bool internal = false,
3445 bool qualified_name = true) const;
3446
3447 virtual bool
3449
3450 virtual ~function_type();
3451
3452 friend bool
3454};//end class function_type
3455
3456/// Abstracts the type of a class member function.
3458{
3459 struct priv;
3460 std::unique_ptr<priv> priv_;
3461
3462 method_type();
3463
3464public:
3465
3466 /// Hasher for intances of method_type
3467 struct hash;
3468
3469 method_type(type_base_sptr return_type,
3470 class_or_union_sptr class_type,
3471 const std::vector<function_decl::parameter_sptr>& parms,
3472 bool is_const,
3473 size_t size_in_bits,
3474 size_t alignment_in_bits);
3475
3476 method_type(type_base_sptr return_type,
3477 type_base_sptr class_type,
3478 const std::vector<function_decl::parameter_sptr>& parms,
3479 bool is_const,
3480 size_t size_in_bits,
3481 size_t alignment_in_bits);
3482
3483 method_type(class_or_union_sptr class_type,
3484 bool is_const,
3485 size_t size_in_bits,
3486 size_t alignment_in_bits);
3487
3488 method_type(const environment& env,
3489 size_t size_in_bits,
3490 size_t alignment_in_bits);
3491
3492 virtual hash_t
3493 hash_value() const;
3494
3495 class_or_union_sptr
3496 get_class_type() const;
3497
3498 void
3499 set_class_type(const class_or_union_sptr& t);
3500
3501 void set_is_const(bool);
3502
3503 bool get_is_const() const;
3504
3505 bool get_is_for_static_method() const;
3506
3507 virtual ~method_type();
3508
3509 virtual string
3510 get_pretty_representation(bool internal = false,
3511 bool qualified_name = true) const;
3512
3513 friend interned_string
3514 get_method_type_name(const method_type& fn_type, bool internal);
3515};// end class method_type.
3516
3517/// The base class of templates.
3518class template_decl : public virtual decl_base
3519{
3520 class priv;
3521 std::unique_ptr<priv> priv_;
3522
3523 template_decl();
3524
3525public:
3526
3527 template_decl(const environment& env,
3528 const string& name,
3529 const location& locus,
3530 visibility vis = VISIBILITY_DEFAULT);
3531
3532 void
3534
3535 const std::list<template_parameter_sptr>&
3537
3538 virtual bool
3539 operator==(const decl_base& o) const;
3540
3541 virtual bool
3542 operator==(const template_decl& o) const;
3543
3544 virtual ~template_decl();
3545};//end class template_decl
3546
3547/// Base class for a template parameter. Client code should use the
3548/// more specialized type_template_parameter,
3549/// non_type_template_parameter and template_template_parameter below.
3551{
3552 class priv;
3553 std::unique_ptr<priv> priv_;
3554
3555 // Forbidden
3557
3558 public:
3559
3560 template_parameter(unsigned index,
3561 template_decl_sptr enclosing_tdecl);
3562
3563 virtual bool
3564 operator==(const template_parameter&) const;
3565
3566 bool
3567 operator!=(const template_parameter&) const;
3568
3569 unsigned
3570 get_index() const;
3571
3572 const template_decl_sptr
3573 get_enclosing_template_decl() const;
3574
3575 virtual ~template_parameter();
3576};//end class template_parameter
3577
3578/// Abstracts a type template parameter.
3579class type_tparameter : public template_parameter, public virtual type_decl
3580{
3581 class priv;
3582 std::unique_ptr<priv> priv_;
3583
3584 // Forbidden
3586
3587public:
3588
3589 type_tparameter(unsigned index,
3590 template_decl_sptr enclosing_tdecl,
3591 const string& name,
3592 const location& locus);
3593
3594 virtual bool
3595 operator==(const type_base&) const;
3596
3597 virtual bool
3598 operator==(const type_decl&) const;
3599
3600 virtual bool
3601 operator==(const decl_base&) const;
3602
3603 virtual bool
3604 operator==(const template_parameter&) const;
3605
3606 virtual bool
3607 operator==(const type_tparameter&) const;
3608
3609 virtual ~type_tparameter();
3610};// end class type_tparameter.
3611
3612/// Abstracts non type template parameters.
3614{
3615 class priv;
3616 std::unique_ptr<priv> priv_;
3617
3618 type_base_wptr type_;
3619
3620 // Forbidden
3622
3623public:
3624
3625 non_type_tparameter(unsigned index,
3626 template_decl_sptr enclosing_tdecl,
3627 const string& name,
3628 type_base_sptr type,
3629 const location& locus);
3630 virtual bool
3631 operator==(const decl_base&) const;
3632
3633 virtual bool
3634 operator==(const template_parameter&) const;
3635
3636 const type_base_sptr
3637 get_type() const;
3638
3639 virtual ~non_type_tparameter();
3640};// end class non_type_tparameter
3641
3642
3644
3645/// Abstracts a template template parameter.
3647{
3648 class priv;
3649 std::unique_ptr<priv> priv_;
3650
3651 // Forbidden
3653
3654public:
3655
3656 template_tparameter(unsigned index,
3657 template_decl_sptr enclosing_tdecl,
3658 const string& name,
3659 const location& locus);
3660
3661 virtual bool
3662 operator==(const type_base&) const;
3663
3664 virtual bool
3665 operator==(const decl_base&) const;
3666
3667 virtual bool
3668 operator==(const template_parameter&) const;
3669
3670 virtual bool
3671 operator==(const template_decl&) const;
3672
3673 virtual ~template_tparameter();
3674};
3675
3676/// This abstracts a composition of types based on template type
3677/// parameters. The result of the composition is a type that can be
3678/// referred to by a template non-type parameter. Instances of this
3679/// type can appear at the same level as template parameters, in the
3680/// scope of a template_decl.
3681class type_composition : public template_parameter, public virtual decl_base
3682{
3683 class priv;
3684 std::unique_ptr<priv> priv_;
3685
3687
3688public:
3689 type_composition(unsigned index,
3690 template_decl_sptr tdecl,
3691 type_base_sptr composed_type);
3692
3693 const type_base_sptr
3694 get_composed_type() const;
3695
3696 void
3697 set_composed_type(type_base_sptr t);
3698
3699 virtual ~type_composition();
3700};
3701
3702/// Abstract a function template declaration.
3704{
3705 class priv;
3706 std::unique_ptr<priv> priv_;
3707
3708 // Forbidden
3710
3711public:
3712
3713 function_tdecl(const environment& env,
3714 const location& locus,
3715 visibility vis = VISIBILITY_DEFAULT,
3716 binding bind = BINDING_NONE);
3717
3719 const location& locus,
3720 visibility vis = VISIBILITY_DEFAULT,
3721 binding bind = BINDING_NONE);
3722
3723 virtual bool
3724 operator==(const decl_base&) const;
3725
3726 virtual bool
3727 operator==(const template_decl&) const;
3728
3729 virtual bool
3730 operator==(const function_tdecl&) const;
3731
3732 void
3733 set_pattern(shared_ptr<function_decl> p);
3734
3735 shared_ptr<function_decl>
3736 get_pattern() const;
3737
3738 binding
3739 get_binding() const;
3740
3741 virtual bool
3743
3744 virtual ~function_tdecl();
3745}; // end class function_tdecl.
3746
3747/// Abstract a class template.
3749{
3750 class priv;
3751 std::unique_ptr<priv> priv_;
3752
3753 // Forbidden
3754 class_tdecl();
3755
3756public:
3757
3758 class_tdecl(const environment& env, const location& locus,
3759 visibility vis = VISIBILITY_DEFAULT);
3760
3762 const location& locus,
3763 visibility vis = VISIBILITY_DEFAULT);
3764
3765 virtual bool
3766 operator==(const decl_base&) const;
3767
3768 virtual bool
3769 operator==(const template_decl&) const;
3770
3771 virtual bool
3772 operator==(const class_tdecl&) const;
3773
3774 void
3776
3777 shared_ptr<class_decl>
3778 get_pattern() const;
3779
3780 virtual bool
3782
3783 virtual ~class_tdecl();
3784};// end class class_tdecl
3785
3786/// The base class for member types, data members and member
3787/// functions. Its purpose is mainly to carry the access specifier
3788/// (and possibly other properties that might be shared by all class
3789/// members) for the member.
3791{
3792protected:
3793 enum access_specifier access_;
3794 bool is_static_;
3795
3796private:
3797 // Forbidden
3798 member_base();
3799
3800public:
3801 struct hash;
3802
3803 member_base(access_specifier a, bool is_static = false)
3804 : access_(a), is_static_(is_static)
3805 {}
3806
3807 /// Getter for the access specifier of this member.
3808 ///
3809 /// @return the access specifier for this member.
3812 {return access_;}
3813
3814 /// Setter for the access specifier of this member.
3815 ///
3816 /// @param a the new access specifier.
3817 void
3820
3821 /// @return true if the member is static, false otherwise.
3822 bool
3824 {return is_static_;}
3825
3826 /// Set a flag saying if the parameter is static or not.
3827 ///
3828 /// @param f set to true if the member is static, false otherwise.
3829 void
3831 {is_static_ = f;}
3832
3833 virtual bool
3834 operator==(const member_base& o) const;
3835};// end class member_base
3836
3837/// Abstraction of the declaration of a method.
3839{
3840 method_decl();
3841
3842 virtual void
3843 set_scope(scope_decl*);
3844
3845public:
3846
3847 method_decl(const string& name, method_type_sptr type,
3848 bool declared_inline, const location& locus,
3849 const string& mangled_name = "",
3850 visibility vis = VISIBILITY_DEFAULT,
3851 binding bind = BINDING_GLOBAL);
3852
3853 method_decl(const string& name,
3854 function_type_sptr type,
3855 bool declared_inline,
3856 const location& locus,
3857 const string& mangled_name = "",
3858 visibility vis = VISIBILITY_DEFAULT,
3859 binding bind = BINDING_GLOBAL);
3860
3861 method_decl(const string& name, type_base_sptr type,
3862 bool declared_inline, const location& locus,
3863 const string& mangled_name = "",
3864 visibility vis = VISIBILITY_DEFAULT,
3865 binding bind = BINDING_GLOBAL);
3866
3867 virtual void
3868 set_linkage_name(const string&);
3869
3870 /// @return the type of the current instance of the
3871 /// method_decl.
3872 const method_type_sptr
3873 get_type() const;
3874
3875 void
3876 set_type(const method_type_sptr fn_type)
3877 {function_decl::set_type(fn_type);}
3878
3879 friend bool
3881
3882 friend void
3884
3885 friend void
3887
3888 friend bool
3890
3891 friend void
3893
3894 friend void
3896
3897 friend bool
3898 get_member_function_is_static(const function_decl&);
3899
3900 friend void
3901 set_member_function_is_static(const function_decl&, bool);
3902
3903 friend bool
3905
3906 friend void
3908
3909 friend void
3911
3912 friend bool
3914
3915 friend ssize_t
3917
3918 virtual ~method_decl();
3919};// end class method_decl
3920
3921bool
3922operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3923
3924bool
3925operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
3926
3927/// The base type of @ref class_decl and @ref union_decl
3929{
3930public:
3931 struct priv;
3932 priv *priv_;
3933
3934private:
3935 // Forbidden
3937
3938protected:
3939
3940 virtual decl_base_sptr
3941 add_member_decl(const decl_base_sptr&);
3942
3943 decl_base_sptr
3944 insert_member_decl(decl_base_sptr member);
3945
3946 virtual void
3947 remove_member_decl(decl_base_sptr);
3948
3949 void
3951
3952public:
3953 /// Hasher.
3954 struct hash;
3955
3956 /// Convenience typedef
3957 /// @{
3958 typedef vector<type_base_sptr> member_types;
3959 typedef vector<var_decl_sptr> data_members;
3960 typedef vector<method_decl_sptr> member_functions;
3961 typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
3962 typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
3963 typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
3964 /// @}
3965
3966 class_or_union(const environment& env, const string& name,
3967 size_t size_in_bits, size_t align_in_bits,
3968 const location& locus, visibility vis,
3969 member_types& mbrs, data_members& data_mbrs,
3970 member_functions& member_fns);
3971
3972 class_or_union(const environment& env, const string& name,
3973 size_t size_in_bits, size_t align_in_bits,
3974 const location& locus, visibility vis);
3975
3976 class_or_union(const environment& env, const string& name,
3977 bool is_declaration_only = true);
3978
3979 virtual hash_t
3980 hash_value() const;
3981
3982 virtual void
3983 set_size_in_bits(size_t);
3984
3985 virtual size_t
3986 get_size_in_bits() const;
3987
3988 virtual size_t
3989 get_alignment_in_bits() const;
3990
3991 virtual void
3992 set_alignment_in_bits(size_t);
3993
3994 virtual size_t
3996
3997 virtual size_t
3999
4000 virtual size_t
4002
4003 void
4005 bool is_laid_out, bool is_static,
4006 size_t offset_in_bits);
4007
4008 const data_members&
4009 get_data_members() const;
4010
4011 const var_decl_sptr
4012 find_data_member(const string&) const;
4013
4014 const var_decl_sptr
4015 find_data_member(const var_decl_sptr&) const;
4016
4017 const var_decl_sptr
4019
4020 const data_members&
4022
4023 const data_members&
4025
4026 void
4027 add_member_function(method_decl_sptr f,
4029 bool is_static, bool is_ctor,
4030 bool is_dtor, bool is_const);
4031
4032 void
4033 add_member_function(method_decl_sptr f,
4035 bool is_virtual,
4036 size_t vtable_offset,
4037 bool is_static, bool is_ctor,
4038 bool is_dtor, bool is_const);
4039
4040 const member_functions&
4041 get_member_functions() const;
4042
4043 const method_decl*
4044 find_member_function(const string& mangled_name) const;
4045
4047 find_member_function(const string& mangled_name);
4048
4049 method_decl_sptr
4050 find_member_function_sptr(const string& mangled_name);
4051
4052 const method_decl*
4053 find_member_function_from_signature(const string& s) const;
4054
4056 find_member_function_from_signature(const string& s);
4057
4058 void
4059 add_member_function_template(member_function_template_sptr);
4060
4061 const member_function_templates&
4063
4064 void
4065 add_member_class_template(member_class_template_sptr m);
4066
4067 const member_class_templates&
4069
4070 bool
4071 has_no_member() const;
4072
4073 virtual bool
4074 operator==(const decl_base&) const;
4075
4076 virtual bool
4077 operator==(const type_base&) const;
4078
4079 virtual bool
4080 operator==(const class_or_union&) const;
4081
4082 virtual bool
4084
4085 virtual ~class_or_union();
4086
4087 friend method_decl_sptr
4088 copy_member_function(class_or_union_sptr& t,
4089 const method_decl*m);
4090
4091 friend method_decl_sptr
4092 copy_member_function(class_or_union_sptr& t,
4093 const method_decl_sptr& m);
4094
4095 friend void
4096 fixup_virtual_member_function(method_decl_sptr method);
4097
4098 friend void
4099 set_member_is_static(decl_base& d, bool s);
4100
4101 friend bool
4103
4104 friend bool
4105 equals(const class_decl&, const class_decl&, change_kind*);
4106
4107 friend class method_decl;
4108 friend class class_decl;
4109}; // end class class_or_union
4110
4111method_decl_sptr
4112copy_member_function(const class_or_union_sptr& clazz,
4113 const method_decl_sptr& f);
4114
4115method_decl_sptr
4116copy_member_function(const class_or_union_sptr& clazz,
4117 const method_decl* f);
4118
4119bool
4120operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4121
4122bool
4123operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4124
4125/// Abstracts a class declaration.
4127{
4128 // Forbidden
4129 class_decl();
4130
4131protected:
4132
4133 decl_base_sptr
4134 insert_member_decl(decl_base_sptr member);
4135
4136public:
4137 /// Hasher.
4138 struct hash;
4139
4140 /// Forward declarations.
4141 class base_spec;
4142
4143 /// Convenience typedef
4144 /// @{
4145 typedef shared_ptr<base_spec> base_spec_sptr;
4146 typedef vector<base_spec_sptr> base_specs;
4147
4148 /// @}
4149
4150protected:
4151 virtual void
4153
4154private:
4155 struct priv;
4156 // This priv it's not handled by a shared_ptr because accessing the
4157 // data members of the priv struct for this class_decl shows up on
4158 // performance profiles when dealing with big binaries with a lot of
4159 // types; dereferencing the shared_ptr involves locking of some sort
4160 // and that is slower than just dereferencing a pointer likere here.
4161 // There are other types for which the priv pointer is managed using
4162 // shared_ptr just fine, because those didn't show up during our
4163 // performance profiling.
4164 priv * priv_;
4165
4166public:
4167
4168 class_decl(const environment& env, const string& name,
4169 size_t size_in_bits, size_t align_in_bits,
4170 bool is_struct, const location& locus,
4171 visibility vis, base_specs& bases,
4172 member_types& mbrs, data_members& data_mbrs,
4173 member_functions& member_fns);
4174
4175 class_decl(const environment& env, const string& name,
4176 size_t size_in_bits, size_t align_in_bits,
4177 bool is_struct, const location& locus,
4178 visibility vis, base_specs& bases,
4179 member_types& mbrs, data_members& data_mbrs,
4180 member_functions& member_fns, bool is_anonymous);
4181
4182 class_decl(const environment& env, const string& name,
4183 size_t size_in_bits, size_t align_in_bits,
4184 bool is_struct, const location& locus, visibility vis);
4185
4186 class_decl(const environment& env, const string& name,
4187 size_t size_in_bits, size_t align_in_bits,
4188 bool is_struct, const location& locus,
4189 visibility vis, bool is_anonymous);
4190
4191 class_decl(const environment& env, const string& name, bool is_struct,
4192 bool is_declaration_only = true);
4193
4194 virtual hash_t
4195 hash_value() const;
4196
4197 virtual string
4198 get_pretty_representation(bool internal = false,
4199 bool qualified_name = true) const;
4200
4201 void
4202 is_struct(bool f);
4203
4204 bool
4205 is_struct() const;
4206
4207 void
4208 add_base_specifier(shared_ptr<base_spec> b);
4209
4210 const base_specs&
4211 get_base_specifiers() const;
4212
4214 find_base_class(const string& qualified_name) const;
4215
4216 const member_functions&
4217 get_virtual_mem_fns() const;
4218
4221
4222 void
4224
4225 bool
4226 has_no_base_nor_member() const;
4227
4228 bool
4230
4231 bool
4232 has_virtual_bases() const;
4233
4234 bool
4235 has_vtable() const;
4236
4237 ssize_t
4239
4240 virtual bool
4241 operator==(const decl_base&) const;
4242
4243 virtual bool
4244 operator==(const type_base&) const;
4245
4246 virtual bool
4247 operator==(const class_or_union&) const;
4248
4249 virtual bool
4250 operator==(const class_decl&) const;
4251
4252 virtual bool
4254
4255 virtual ~class_decl();
4256
4257 friend void
4258 fixup_virtual_member_function(method_decl_sptr method);
4259
4260 friend void
4261 set_member_is_static(decl_base& d, bool s);
4262
4263 friend bool
4264 equals(const class_decl&, const class_decl&, change_kind*);
4265
4266 friend class method_decl;
4267 friend class class_or_union;
4268};// end class class_decl
4269
4270bool
4271equals(const class_decl&, const class_decl&, change_kind*);
4272
4273method_decl_sptr
4275 const method_decl_sptr& f);
4276
4277method_decl_sptr
4279 const method_decl* f);
4280void
4281fixup_virtual_member_function(method_decl_sptr method);
4282
4285
4287get_member_access_specifier(const decl_base_sptr&);
4288
4289void
4292
4293void
4294set_member_access_specifier(const decl_base_sptr&,
4296
4297std::ostream&
4298operator<<(std::ostream&, access_specifier);
4299
4300bool
4301operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4302
4303bool
4304operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4305
4306bool
4308 const class_decl::base_spec&,
4309 change_kind*);
4310
4311/// Abstraction of a base specifier in a class declaration.
4313 public virtual decl_base
4314{
4315 struct priv;
4316 std::unique_ptr<priv> priv_;
4317
4318 // Forbidden
4319 base_spec();
4320
4321public:
4322
4323 /// Hasher.
4324 struct hash;
4325
4327 long offset_in_bits = -1, bool is_virtual = false);
4328
4329 base_spec(const type_base_sptr& base, access_specifier a,
4330 long offset_in_bits = -1, bool is_virtual = false);
4331
4332 virtual hash_t
4333 hash_value() const;
4334
4335 virtual ~base_spec();
4336
4338 get_base_class() const;
4339
4340 bool
4341 get_is_virtual() const;
4342
4343 long
4344 get_offset_in_bits() const;
4345
4346 virtual bool
4347 operator==(const decl_base&) const;
4348
4349 virtual bool
4350 operator==(const member_base&) const;
4351
4352 virtual bool
4354};// end class class_decl::base_spec
4355
4356bool
4359
4360bool
4363
4366
4369
4370/// Abstracts a union type declaration.
4372{
4373 // Forbid
4374 union_decl();
4375
4376public:
4377
4378 struct hash;
4379
4380 union_decl(const environment& env, const string& name,
4381 size_t size_in_bits, const location& locus,
4382 visibility vis, member_types& mbrs,
4383 data_members& data_mbrs, member_functions& member_fns);
4384
4385 union_decl(const environment& env, const string& name,
4386 size_t size_in_bits, const location& locus,
4387 visibility vis, member_types& mbrs,
4388 data_members& data_mbrs, member_functions& member_fns,
4389 bool is_anonymous);
4390
4391 union_decl(const environment& env, const string& name,
4392 size_t size_in_bits, const location& locus,
4393 visibility vis);
4394
4395 union_decl(const environment& env, const string& name,
4396 size_t size_in_bits, const location& locus,
4397 visibility vis, bool is_anonymous);
4398
4399 union_decl(const environment& env, const string& name,
4400 bool is_declaration_only = true);
4401
4402 virtual hash_t
4403 hash_value() const;
4404
4405 virtual string
4406 get_pretty_representation(bool internal = false,
4407 bool qualified_name = true) const;
4408
4409 virtual bool
4410 operator==(const decl_base&) const;
4411
4412 virtual bool
4413 operator==(const type_base&) const;
4414
4415 virtual bool
4416 operator==(const class_or_union&) const;
4417
4418 virtual bool
4419 operator==(const union_decl&) const;
4420
4421 virtual bool
4423
4424 virtual ~union_decl();
4425}; // union_decl
4426
4427bool
4428equals(const union_decl&, const union_decl&, change_kind*);
4429
4430method_decl_sptr
4431copy_member_function(const union_decl_sptr& union_type,
4432 const method_decl_sptr& f);
4433
4434method_decl_sptr
4435copy_member_function(const union_decl_sptr& union_type,
4436 const method_decl* f);
4437
4438bool
4439operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4440
4441bool
4442operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4443
4444/// Abstraction of a member function context relationship. This
4445/// relates a member function to its parent class.
4447{
4448protected:
4449 bool is_virtual_;
4450 ssize_t vtable_offset_in_bits_;
4451 bool is_constructor_;
4452 bool is_destructor_;
4453 bool is_const_;
4454
4455public:
4457 : context_rel(),
4458 is_virtual_(false),
4459 vtable_offset_in_bits_(-1),
4460 is_constructor_(false),
4461 is_destructor_(false),
4462 is_const_(false)
4463 {}
4464
4466 : context_rel(s),
4467 is_virtual_(false),
4468 vtable_offset_in_bits_(-1),
4469 is_constructor_(false),
4470 is_destructor_(false),
4471 is_const_(false)
4472 {}
4473
4475 bool is_constructor,
4476 bool is_destructor,
4477 bool is_const,
4478 bool is_virtual,
4479 size_t vtable_offset_in_bits,
4480 access_specifier access,
4481 bool is_static)
4482 : context_rel(s, access, is_static),
4483 is_virtual_(is_virtual),
4484 vtable_offset_in_bits_(vtable_offset_in_bits),
4485 is_constructor_(is_constructor),
4486 is_destructor_(is_destructor),
4487 is_const_(is_const)
4488 {}
4489
4490 bool
4491 is_virtual() const
4492 {return is_virtual_;}
4493
4494 void
4495 is_virtual(bool is_virtual)
4496 {is_virtual_ = is_virtual;}
4497
4498 /// Getter for the vtable offset property.
4499 ///
4500 /// This is the vtable offset of the member function of this
4501 /// relation.
4502 ///
4503 /// @return the vtable offset property of the relation.
4504 size_t
4506 {return vtable_offset_in_bits_;}
4507
4508 /// Setter for the vtable offset property.
4509 ///
4510 /// This is the vtable offset of the member function of this
4511 /// relation.
4512 ///
4513 /// @partam s the new vtable offset.
4514 void
4516 {vtable_offset_in_bits_ = s;}
4517
4518 /// Getter for the 'is-constructor' property.
4519 ///
4520 /// This tells if the member function of this relation is a
4521 /// constructor.
4522 ///
4523 /// @return the is-constructor property of the relation.
4524 bool
4526 {return is_constructor_;}
4527
4528 /// Setter for the 'is-constructor' property.
4529 ///
4530 /// @param f the new value of the the property. Is true if this is
4531 /// for a constructor, false otherwise.
4532 void
4534 {is_constructor_ = f;}
4535
4536 /// Getter for the 'is-destructor' property.
4537 ///
4538 /// Tells if the member function of this relation is a destructor.
4539 ///
4540 /// @return the is-destructor property of the relation;
4541 bool
4543 {return is_destructor_;}
4544
4545 /// Setter for the 'is-destructor' property.
4546 ///
4547 /// @param f the new value of the property. Is true if this is for
4548 /// a destructor, false otherwise.
4549 void
4551 {is_destructor_ = f;}
4552
4553 /// Getter for the 'is-const' property.
4554 ///
4555 /// Tells if the member function of this relation is a const member
4556 /// function.
4557 ///
4558 /// @return the 'is-const' property of the relation.
4559 bool
4560 is_const() const
4561 {return is_const_;}
4562
4563 /// Setter for the 'is-const' property.
4564 ///
4565 /// @param f the new value of the property. Is true if this is for
4566 /// a const entity, false otherwise.
4567 void
4568 is_const(bool f)
4569 {is_const_ = f;}
4570
4571 virtual ~mem_fn_context_rel();
4572}; // end class mem_fn_context_rel
4573
4576
4579
4580method_decl_sptr
4582
4583const var_decl*
4584lookup_data_member(const type_base* type,
4585 const char* dm_name);
4586
4587const var_decl_sptr
4588lookup_data_member(const type_base_sptr& type,
4589 const var_decl_sptr& dm);
4590
4593 unsigned parm_num);
4594
4595/// Abstract a member function template.
4596class member_function_template : public member_base, public virtual decl_base
4597{
4598 bool is_constructor_;
4599 bool is_const_;
4600 shared_ptr<function_tdecl> fn_tmpl_;
4601
4602 // Forbiden
4604
4605public:
4606 /// Hasher.
4607 struct hash;
4608
4610 access_specifier access, bool is_static,
4611 bool is_constructor, bool is_const)
4612 : type_or_decl_base(f->get_environment()),
4613 decl_base(f->get_environment(), f->get_name(), location()),
4614 member_base(access, is_static), is_constructor_(is_constructor),
4615 is_const_(is_const), fn_tmpl_(f)
4616 {}
4617
4618 bool
4619 is_constructor() const
4620 {return is_constructor_;}
4621
4622 bool
4623 is_const() const
4624 {return is_const_;}
4625
4626 operator const function_tdecl& () const
4627 {return *fn_tmpl_;}
4628
4630 as_function_tdecl() const
4631 {return fn_tmpl_;}
4632
4633 virtual bool
4634 operator==(const member_base& o) const;
4635
4636 virtual bool
4638};// end class member_function_template
4639
4640bool
4641operator==(const member_function_template_sptr& l,
4642 const member_function_template_sptr& r);
4643
4644bool
4645operator!=(const member_function_template_sptr& l,
4646 const member_function_template_sptr& r);
4647
4648/// Abstracts a member class template template
4650 : public member_base,
4651 public virtual decl_base
4652{
4653 shared_ptr<class_tdecl> class_tmpl_;
4654
4655 // Forbidden
4657
4658public:
4659
4660 /// Hasher.
4661 struct hash;
4662
4664 access_specifier access, bool is_static)
4665 : type_or_decl_base(c->get_environment()),
4666 decl_base(c->get_environment(), c->get_name(), location()),
4667 member_base(access, is_static),
4668 class_tmpl_(c)
4669 {}
4670
4671 operator const class_tdecl& () const
4672 { return *class_tmpl_; }
4673
4675 as_class_tdecl() const
4676 {return class_tmpl_;}
4677
4678 virtual bool
4679 operator==(const member_base& o) const;
4680
4681 virtual bool
4682 operator==(const decl_base&) const;
4683
4684 virtual bool
4685 operator==(const member_class_template&) const;
4686
4687 virtual bool
4689};// end class member_class_template
4690
4691bool
4692operator==(const member_class_template_sptr& l,
4693 const member_class_template_sptr& r);
4694
4695bool
4696operator!=(const member_class_template_sptr& l,
4697 const member_class_template_sptr& r);
4698
4699/// A comparison functor for pointers to @ref var_decl.
4701{
4702 /// Return true if the two instances of @ref var_decl are equal.
4703 ///
4704 /// @param l the first variable to compare.
4705 ///
4706 /// @param r the second variable to compare.
4707 ///
4708 /// @return true if @p l equals @p r.
4709 bool
4710 operator()(const var_decl* l, const var_decl* r) const
4711 {
4712 if (l == r)
4713 return true;
4714 if (!!l != !!r)
4715 return false;
4716 return (*l == *r);
4717 }
4718};// end struct var_decl::ptr_equal
4719
4720/// Equality functor for instances of @ref function_decl
4722{
4723 /// Tests if two pointers to @ref function_decl are equal.
4724 ///
4725 /// @param l the first pointer to @ref function_decl to consider in
4726 /// the comparison.
4727 ///
4728 /// @param r the second pointer to @ref function_decl to consider in
4729 /// the comparison.
4730 ///
4731 /// @return true if the two functions @p l and @p r are equal, false
4732 /// otherwise.
4733 bool
4734 operator()(const function_decl* l, const function_decl* r) const
4735 {
4736 if (l == r)
4737 return true;
4738 if (!!l != !!r)
4739 return false;
4740 return (*l == *r);
4741 }
4742};// function_decl::ptr_equal
4743
4744/// The base class for the visitor type hierarchy used for traversing
4745/// a translation unit.
4746///
4747/// Client code willing to get notified for a certain kind of node
4748/// during the IR traversal might want to define a visitor class that
4749/// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4750/// or ir_node_visitor::visit_end() method of its choice, and provide
4751/// and implementation for it. If either
4752/// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4753/// return false, it means the traversal has to stop immediately after
4754/// the methods' return. If the methods return true, it means the
4755/// traversal keeps going.
4756///
4757/// That new visitor class would then be passed to e.g,
4758/// translation_unit::traverse or to the traverse method of any type
4759/// where the traversal is supposed to start from.
4761{
4762 struct priv;
4763 std::unique_ptr<priv> priv_;
4764
4765public:
4766
4768
4769 virtual ~ir_node_visitor();
4770
4776
4777 virtual bool visit_begin(decl_base*);
4778 virtual bool visit_end(decl_base*);
4779
4780 virtual bool visit_begin(scope_decl*);
4781 virtual bool visit_end(scope_decl*);
4782
4783 virtual bool visit_begin(type_base*);
4784 virtual bool visit_end(type_base*);
4785
4786 virtual bool visit_begin(scope_type_decl*);
4787 virtual bool visit_end(scope_type_decl*);
4788
4789 virtual bool visit_begin(type_decl*);
4790 virtual bool visit_end(type_decl*);
4791
4792 virtual bool visit_begin(namespace_decl*);
4793 virtual bool visit_end(namespace_decl*);
4794
4795 virtual bool visit_begin(qualified_type_def*);
4796 virtual bool visit_end(qualified_type_def*);
4797
4798 virtual bool visit_begin(pointer_type_def*);
4799 virtual bool visit_end(pointer_type_def*);
4800
4801 virtual bool visit_begin(reference_type_def*);
4802 virtual bool visit_end(reference_type_def*);
4803
4804 virtual bool visit_begin(ptr_to_mbr_type*);
4805 virtual bool visit_end(ptr_to_mbr_type*);
4806
4807 virtual bool visit_begin(array_type_def*);
4808 virtual bool visit_end(array_type_def*);
4809
4810 virtual bool visit_begin(array_type_def::subrange_type*);
4811 virtual bool visit_end(array_type_def::subrange_type*);
4812
4813 virtual bool visit_begin(enum_type_decl*);
4814 virtual bool visit_end(enum_type_decl*);
4815
4816 virtual bool visit_begin(typedef_decl*);
4817 virtual bool visit_end(typedef_decl*);
4818
4819 virtual bool visit_begin(function_type*);
4820 virtual bool visit_end(function_type*);
4821
4822 virtual bool visit_begin(var_decl*);
4823 virtual bool visit_end(var_decl*);
4824
4825 virtual bool visit_begin(function_decl*);
4826 virtual bool visit_end(function_decl*);
4827
4828 virtual bool visit_begin(function_decl::parameter*);
4829 virtual bool visit_end(function_decl::parameter*);
4830
4831 virtual bool visit_begin(function_tdecl*);
4832 virtual bool visit_end(function_tdecl*);
4833
4834 virtual bool visit_begin(class_tdecl*);
4835 virtual bool visit_end(class_tdecl*);
4836
4837 virtual bool visit_begin(class_or_union *);
4838 virtual bool visit_end(class_or_union *);
4839
4840 virtual bool visit_begin(class_decl*);
4841 virtual bool visit_end(class_decl*);
4842
4843 virtual bool visit_begin(union_decl*);
4844 virtual bool visit_end(union_decl*);
4845
4846 virtual bool visit_begin(class_decl::base_spec*);
4847 virtual bool visit_end(class_decl::base_spec*);
4848
4849 virtual bool visit_begin(member_function_template*);
4850 virtual bool visit_end(member_function_template*);
4851
4852 virtual bool visit_begin(member_class_template*);
4853 virtual bool visit_end(member_class_template*);
4854}; // end struct ir_node_visitor
4855
4856// Debugging facility
4857void
4858fns_to_str(vector<function_decl*>::const_iterator a_begin,
4859 vector<function_decl*>::const_iterator a_end,
4860 vector<function_decl*>::const_iterator b_begin,
4861 vector<function_decl*>::const_iterator b_end,
4862 std::ostream& o);
4863
4864}// end namespace ir
4865} // end namespace abigail
4866#endif // __ABG_IR_H__
Simplified implementation of std::optional just enough to be used as a replacement for our purposes a...
This type abstracts the configuration information of the library.
Definition abg-config.h:18
The abstraction of an interned string.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
Definition abg-ir.h:2560
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition abg-ir.cc:18870
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:18838
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition abg-ir.cc:18831
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition abg-ir.cc:18845
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition abg-ir.cc:18882
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition abg-ir.cc:18853
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition abg-ir.cc:18803
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition abg-ir.cc:18860
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition abg-ir.h:2545
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition abg-ir.cc:19061
bool is_non_finite() const
Test if the length of the subrange type is infinite.
Definition abg-ir.cc:19088
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition abg-ir.cc:19054
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:19028
string as_string() const
Return a string representation of the sub range.
Definition abg-ir.cc:19110
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19009
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19310
bool operator!=(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:19249
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition abg-ir.cc:19040
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:19020
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:19205
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition abg-ir.cc:19047
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:19288
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition abg-ir.cc:19133
uint64_t get_length() const
Getter of the length of the subrange type.
Definition abg-ir.cc:19071
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition abg-ir.cc:19103
The abstraction of an array type.
Definition abg-ir.h:2519
virtual bool is_non_finite() const
Definition abg-ir.cc:19661
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:19691
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition abg-ir.h:2540
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19417
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition abg-ir.cc:19622
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition abg-ir.cc:19637
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19754
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition abg-ir.h:2537
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition abg-ir.cc:19781
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:19600
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:19470
translation_unit::language get_language() const
Get the language of the array.
Definition abg-ir.cc:19589
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition abg-ir.cc:19647
Abstraction of a base specifier in a class declaration.
Definition abg-ir.h:4314
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition abg-ir.cc:24875
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition abg-ir.cc:24882
long get_offset_in_bits() const
Getter of the offset of the base.
Definition abg-ir.cc:24889
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:24864
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:24905
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition abg-ir.cc:24999
Abstracts a class declaration.
Definition abg-ir.h:4127
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition abg-ir.h:4145
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:25402
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition abg-ir.cc:25616
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition abg-ir.cc:25455
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:24741
bool is_struct() const
Test if the class is a struct.
Definition abg-ir.cc:24679
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:25518
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition abg-ir.cc:24696
virtual ~class_decl()
Destructor of the class_decl type.
Definition abg-ir.cc:26032
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:24657
bool has_vtable() const
Test if the current instance has a vtable.
Definition abg-ir.cc:25483
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition abg-ir.cc:25497
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition abg-ir.cc:25464
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition abg-ir.h:4146
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:25948
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition abg-ir.cc:24686
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition abg-ir.cc:24722
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition abg-ir.cc:24746
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition abg-ir.cc:25796
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:24706
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:26335
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition abg-ir.cc:25446
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:24767
The base type of class_decl and union_decl.
Definition abg-ir.h:3929
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition abg-ir.cc:24119
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition abg-ir.cc:23614
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition abg-ir.h:3961
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:23855
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:23780
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition abg-ir.cc:23883
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition abg-ir.h:3963
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:25402
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition abg-ir.cc:23500
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition abg-ir.cc:23959
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition abg-ir.cc:23599
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition abg-ir.cc:23632
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition abg-ir.cc:23973
vector< type_base_sptr > member_types
Convenience typedef.
Definition abg-ir.h:3958
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition abg-ir.h:3960
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition abg-ir.cc:23739
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:23390
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:23681
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:23934
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:23918
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition abg-ir.cc:23583
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition abg-ir.cc:24015
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:23488
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:23406
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition abg-ir.cc:23987
const data_members & get_non_static_data_members() const
Get the non-static data members of this class_or_union.
Definition abg-ir.cc:23830
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:23892
const data_members & get_static_data_members() const
Get the static data memebers of this class_or_union.
Definition abg-ir.cc:23838
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:23525
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition abg-ir.cc:23479
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:24049
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition abg-ir.cc:26335
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition abg-ir.cc:23551
vector< var_decl_sptr > data_members
Convenience typedef.
Definition abg-ir.h:3959
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition abg-ir.cc:23966
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition abg-ir.cc:23567
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition abg-ir.cc:23650
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:23750
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition abg-ir.h:3962
Abstract a class template.
Definition abg-ir.h:3749
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition abg-ir.cc:27727
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition abg-ir.cc:27716
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:27776
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:27731
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition abg-ir.h:1256
bool operator!=(const context_rel &o) const
Inequality operator.
Definition abg-ir.h:1322
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:1556
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition abg-ir.cc:15948
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:4860
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition abg-ir.cc:5075
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current decl.
Definition abg-ir.cc:4749
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition abg-ir.cc:4647
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition abg-ir.cc:4378
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:4440
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:5430
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition abg-ir.cc:4808
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition abg-ir.cc:4622
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:4844
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition abg-ir.cc:4678
void clear_qualified_name()
Clear the qualified name of this decl.
Definition abg-ir.cc:4371
virtual void set_name(const string &n)
Setter for the name of the decl.
Definition abg-ir.cc:4510
const location & get_location() const
Get the location of a given declaration.
Definition abg-ir.cc:4460
binding
ELF binding.
Definition abg-ir.h:1607
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
Definition abg-ir.cc:4570
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition abg-ir.cc:8330
virtual const interned_string & get_name() const
Getter for the name of the current decl.
Definition abg-ir.cc:4666
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition abg-ir.cc:5102
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition abg-ir.cc:4362
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition abg-ir.cc:4412
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition abg-ir.cc:4523
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:8305
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:26426
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition abg-ir.cc:4800
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:4828
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:5399
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:21054
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition abg-ir.cc:4588
void set_location(const location &l)
Set the location for a given declaration.
Definition abg-ir.cc:4498
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition abg-ir.cc:4533
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition abg-ir.cc:4639
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition abg-ir.cc:4405
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition abg-ir.cc:4993
visibility get_visibility() const
Getter for the visibility of the decl.
Definition abg-ir.cc:4632
visibility
ELF visibility.
Definition abg-ir.h:1597
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition abg-ir.cc:4851
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:5091
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition abg-ir.cc:4816
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition abg-ir.cc:4615
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:5370
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition abg-ir.cc:6496
virtual ~decl_base()
Destructor of the decl_base type.
Definition abg-ir.cc:5079
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:5064
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:4659
bool get_is_anonymous_or_has_anonymous_parent() const
Definition abg-ir.cc:4556
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition abg-ir.cc:4545
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:4432
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition abg-ir.cc:4391
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:4701
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:4924
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition abg-ir.h:2966
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:3199
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition abg-ir.cc:3209
The abstraction of the version of an ELF symbol.
Definition abg-ir.h:1203
version & operator=(const version &o)
Assign a version to the current one.
Definition abg-ir.cc:3112
bool operator==(const version &o) const
Compares the current version against another one.
Definition abg-ir.cc:3094
bool is_default() const
Getter for the 'is_default' property of the version.
Definition abg-ir.cc:3074
const string & str() const
Getter for the version name.
Definition abg-ir.cc:3060
bool operator!=(const version &o) const
Inequality operator.
Definition abg-ir.cc:3103
Abstraction of an elf symbol.
Definition abg-ir.h:932
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition abg-ir.cc:2197
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:2520
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition abg-ir.cc:2415
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition abg-ir.cc:2031
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition abg-ir.cc:2252
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition abg-ir.cc:2176
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition abg-ir.cc:2281
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition abg-ir.cc:2021
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition abg-ir.cc:2213
binding
The binding of a symbol.
Definition abg-ir.h:949
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition abg-ir.cc:2288
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:2541
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition abg-ir.cc:2066
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition abg-ir.cc:2426
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition abg-ir.cc:2305
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition abg-ir.cc:2222
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition abg-ir.cc:2154
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition abg-ir.cc:2351
void set_size(size_t)
Setter of the size of the symbol.
Definition abg-ir.cc:2052
const string & get_name() const
Getter for the name of the elf_symbol.
Definition abg-ir.cc:2014
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition abg-ir.cc:2059
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:2607
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition abg-ir.cc:2145
type
The type of a symbol.
Definition abg-ir.h:936
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition abg-ir.cc:2080
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition abg-ir.cc:2183
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition abg-ir.cc:2091
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition abg-ir.cc:2666
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition abg-ir.cc:2266
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition abg-ir.cc:2190
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:1937
visibility
The visibility of the symbol.
Definition abg-ir.h:958
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition abg-ir.cc:2073
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition abg-ir.cc:2384
void set_index(size_t)
Setter for the index.
Definition abg-ir.cc:2007
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition abg-ir.cc:2099
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition abg-ir.cc:2400
size_t get_index() const
Getter for the index.
Definition abg-ir.cc:2000
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition abg-ir.cc:2471
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:2498
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition abg-ir.cc:1993
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition abg-ir.cc:2038
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition abg-ir.cc:2129
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition abg-ir.cc:2168
size_t get_size() const
Getter of the size of the symbol.
Definition abg-ir.cc:2045
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition abg-ir.cc:2107
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition abg-ir.cc:2204
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition abg-ir.cc:2273
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:2652
The abstraction of an enumerator.
Definition abg-ir.h:2844
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition abg-ir.cc:20416
bool operator!=(const enumerator &other) const
Inequality operator.
Definition abg-ir.cc:20476
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition abg-ir.cc:20518
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition abg-ir.cc:20540
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition abg-ir.cc:20485
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition abg-ir.cc:20547
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:20533
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:20502
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition abg-ir.cc:20526
bool operator==(const enumerator &other) const
Equality operator.
Definition abg-ir.cc:20463
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition abg-ir.cc:20447
Abstracts a declaration for an enum type.
Definition abg-ir.h:2756
friend bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
Definition abg-ir.cc:19979
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition abg-ir.h:2772
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:19854
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition abg-ir.cc:19967
const enumerators & get_enumerators() const
Definition abg-ir.cc:19867
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
Definition abg-ir.cc:19879
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:19945
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition abg-ir.cc:19862
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:20337
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:19920
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:3446
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:3513
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:3593
const vector< type_base_sptr > * get_canonical_types(const char *name) const
Get the vector of canonical types which have a given "stringrepresentation".
Definition abg-ir.cc:3730
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:3323
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:3545
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition abg-ir.cc:3374
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:3342
const config & get_config() const
Getter of the general configuration object.
Definition abg-ir.cc:3583
environment()
Default constructor of the environment type.
Definition abg-ir.cc:3224
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition abg-ir.cc:3386
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "stringrepresentation".
Definition abg-ir.cc:3753
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:3361
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:3482
virtual ~environment()
Destructor for the environment type.
Definition abg-ir.cc:3229
bool canonicalization_started() const
Getter of a flag saying if the canonicalization process has started or not.
Definition abg-ir.cc:3413
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:27915
interned_string intern(const string &) const
Do intern a string.
Definition abg-ir.cc:3576
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 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:3619
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition abg-ir.cc:3237
Abstraction of a function parameter.
Definition abg-ir.h:3287
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition abg-ir.cc:23224
interned_string get_type_name() const
Definition abg-ir.cc:23023
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition abg-ir.cc:23061
const string get_type_pretty_representation() const
Definition abg-ir.cc:23042
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition abg-ir.cc:23200
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:23244
Abstraction for a function declaration.
Definition abg-ir.h:3117
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3139
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:22424
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition abg-ir.cc:22495
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3142
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:22885
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition abg-ir.cc:22575
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition abg-ir.cc:22800
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition abg-ir.cc:22461
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition abg-ir.cc:22480
function_decl(const string &name, function_type_sptr function_type, bool declared_inline, const location &locus, const string &mangled_name, visibility vis, binding bind)
Constructor of the function_decl.
Definition abg-ir.cc:22287
const type_base_sptr get_return_type() const
Definition abg-ir.cc:22556
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition abg-ir.cc:22588
const std::vector< parameter_sptr > & get_parameters() const
Definition abg-ir.cc:22561
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition abg-ir.cc:22568
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition abg-ir.cc:22517
virtual ~function_decl()
Destructor of the function_decl type.
Definition abg-ir.cc:22901
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:22533
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition abg-ir.cc:22786
bool is_declared_inline() const
Test if the function was declared inline.
Definition abg-ir.cc:22540
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:22356
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:22816
Abstract a function template declaration.
Definition abg-ir.h:3704
binding get_binding() const
Get the binding of the function template.
Definition abg-ir.cc:27564
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition abg-ir.cc:27546
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition abg-ir.cc:27557
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:27624
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition abg-ir.cc:27573
Abstraction of a function type.
Definition abg-ir.h:3372
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition abg-ir.h:3384
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:21529
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:21948
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition abg-ir.h:3382
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition abg-ir.cc:21636
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:21845
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:21436
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition abg-ir.cc:21907
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:21621
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition abg-ir.cc:21598
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition abg-ir.cc:21865
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:21577
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition abg-ir.cc:21540
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition abg-ir.cc:21548
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition abg-ir.cc:21823
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition abg-ir.cc:21557
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition abg-ir.cc:21669
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:21931
This abstracts the global scope of a given translation unit.
Definition abg-ir.h:1953
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition abg-ir.h:4761
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:29520
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition abg-ir.cc:29569
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition abg-ir.cc:29559
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition abg-ir.cc:29499
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition abg-ir.cc:29530
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:4447
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition abg-ir.h:4525
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition abg-ir.h:4515
bool is_const() const
Getter for the 'is-const' property.
Definition abg-ir.h:4560
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition abg-ir.h:4550
void is_const(bool f)
Setter for the 'is-const' property.
Definition abg-ir.h:4568
size_t vtable_offset() const
Getter for the vtable offset property.
Definition abg-ir.h:4505
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition abg-ir.h:4533
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition abg-ir.h:4542
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition abg-ir.h:3791
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition abg-ir.h:3811
bool get_is_static() const
Definition abg-ir.h:3823
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition abg-ir.h:3818
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition abg-ir.h:3830
Abstracts a member class template template.
Definition abg-ir.h:4652
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition abg-ir.cc:26195
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26280
Abstract a member function template.
Definition abg-ir.h:4597
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26174
Abstraction of the declaration of a method.
Definition abg-ir.h:3839
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition abg-ir.cc:6309
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition abg-ir.cc:6433
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition abg-ir.cc:25146
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition abg-ir.cc:6337
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition abg-ir.cc:6393
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:6422
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition abg-ir.cc:6365
const method_type_sptr get_type() const
Definition abg-ir.cc:25173
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition abg-ir.cc:6250
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition abg-ir.cc:6280
Abstracts the type of a class member function.
Definition abg-ir.h:3458
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:22149
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:9092
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:22130
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition abg-ir.cc:22181
bool get_is_for_static_method() const
Test if the current method type is for a static method or not.
Definition abg-ir.cc:22196
virtual ~method_type()
The destructor of method_type.
Definition abg-ir.cc:22229
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:22173
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition abg-ir.cc:22140
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition abg-ir.cc:22188
The abstraction of a namespace declaration.
Definition abg-ir.h:2178
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:17069
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17100
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
Definition abg-ir.cc:17003
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition abg-ir.cc:17055
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:17041
Abstracts non type template parameters.
Definition abg-ir.h:3614
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition abg-ir.cc:27262
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition abg-ir.cc:27267
The abstraction of a pointer type.
Definition abg-ir.h:2321
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition abg-ir.cc:17762
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:17888
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:17752
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:17679
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17982
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition abg-ir.cc:17824
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition abg-ir.cc:17868
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition abg-ir.cc:17875
The abstraction of a pointer-to-member type.
Definition abg-ir.h:2456
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:18652
virtual const interned_string & get_name() const
Getter of the name of the current ptr-to-mbr-type.
Definition abg-ir.cc:18562
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18575
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:18595
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
Definition abg-ir.cc:18636
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:18703
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
Definition abg-ir.cc:18586
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
Definition abg-ir.cc:18728
The abstraction of a qualified type.
Definition abg-ir.h:2207
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:17405
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition abg-ir.cc:17530
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition abg-ir.cc:17269
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:17257
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:17518
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition abg-ir.h:2226
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:17195
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition abg-ir.cc:17509
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:17478
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition abg-ir.cc:17504
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition abg-ir.cc:17523
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition abg-ir.cc:17349
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition abg-ir.cc:17172
Abstracts a reference type.
Definition abg-ir.h:2387
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the reference_type_def.
Definition abg-ir.cc:18311
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:18174
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition abg-ir.cc:18076
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:18433
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:18184
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition abg-ir.cc:18253
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:18412
A declaration that introduces a scope.
Definition abg-ir.h:1824
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition abg-ir.cc:7776
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition abg-ir.cc:7985
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition abg-ir.cc:7943
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition abg-ir.h:1835
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition abg-ir.cc:7960
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition abg-ir.cc:8330
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition abg-ir.cc:7794
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition abg-ir.cc:7829
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition abg-ir.h:1831
bool is_empty() const
Test if the current scope is empty.
Definition abg-ir.cc:7843
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:8275
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition abg-ir.cc:7918
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:8053
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:8349
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:7712
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:8227
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition abg-ir.cc:8078
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:7889
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:7929
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition abg-ir.cc:7736
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:7700
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition abg-ir.cc:8004
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:8305
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:8181
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition abg-ir.cc:7754
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition abg-ir.cc:7812
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition abg-ir.h:1833
A type that introduces a scope.
Definition abg-ir.h:2155
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:16962
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition abg-ir.cc:16924
The base class of templates.
Definition abg-ir.h:3519
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:26937
virtual ~template_decl()
Destructor.
Definition abg-ir.cc:26962
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:26929
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition abg-ir.cc:26971
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition abg-ir.h:3551
virtual ~template_parameter()
Destructor.
Definition abg-ir.cc:27091
bool operator!=(const template_parameter &) const
Inequality operator.
Definition abg-ir.cc:27087
Abstracts a template template parameter.
Definition abg-ir.h:3647
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:27340
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
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition abg-ir.h:704
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:14897
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:14980
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
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:1974
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
Definition abg-ir.cc:16031
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition abg-ir.cc:16007
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition abg-ir.cc:16110
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:15977
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:16136
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:15710
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition abg-ir.cc:16103
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition abg-ir.cc:16096
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition abg-ir.cc:16086
friend type_base_sptr canonicalize(type_base_sptr, bool, bool)
Compute the canonical type of a given type.
Definition abg-ir.cc:15869
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition abg-ir.cc:16124
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition abg-ir.cc:16117
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition abg-ir.cc:15991
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition abg-ir.h:3682
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition abg-ir.cc:27446
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition abg-ir.cc:27453
A basic type declaration that introduces no scope.
Definition abg-ir.h:2089
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:16756
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:16596
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:16835
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:16694
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition abg-ir.cc:16650
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:16815
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:1377
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition abg-ir.cc:4133
friend hash_t peek_hash_value(const type_or_decl_base &)
Get the hash value associated to an IR node.
Definition abg-ir.cc:28049
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:3906
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:3946
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition abg-ir.cc:3935
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition abg-ir.cc:4093
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition abg-ir.cc:4100
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:3896
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition abg-ir.cc:4125
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.
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition abg-ir.cc:10800
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:4046
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition abg-ir.cc:3969
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:3916
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition abg-ir.cc:3958
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition abg-ir.cc:4158
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition abg-ir.cc:3989
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:4024
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition abg-ir.cc:10405
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:3886
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition abg-ir.cc:4075
type_or_decl_kind
This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact....
Definition abg-ir.h:1389
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition abg-ir.cc:4057
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition abg-ir.cc:10478
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition abg-ir.cc:4150
Abstracts a type template parameter.
Definition abg-ir.h:3580
virtual bool operator==(const type_base &) const
Equality operator.
Definition abg-ir.cc:27133
The abstraction of a typedef declaration.
Definition abg-ir.h:2898
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:20802
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition abg-ir.cc:20787
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition abg-ir.cc:20642
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:20629
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:20834
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition abg-ir.cc:20780
virtual bool operator==(const decl_base &) const
Equality operator.
Definition abg-ir.cc:20722
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition abg-ir.cc:20659
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:20763
Abstracts a union type declaration.
Definition abg-ir.h:4372
virtual hash_t hash_value() const
Return the hash value of the current IR node.
Definition abg-ir.cc:26614
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:26731
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition abg-ir.cc:26671
virtual ~union_decl()
Destructor of the union_decl type.
Definition abg-ir.cc:26804
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:26638
Abstracts a variable declaration.
Definition abg-ir.h:3020
binding get_binding() const
Getter of the binding of the variable.
Definition abg-ir.cc:20948
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition abg-ir.cc:20930
void set_binding(binding b)
Setter of the binding of the variable.
Definition abg-ir.cc:20955
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition abg-ir.cc:6054
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition abg-ir.cc:20993
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:21246
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition abg-ir.cc:20941
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition abg-ir.cc:6199
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition abg-ir.cc:20923
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition abg-ir.cc:21408
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:21385
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition abg-ir.cc:6128
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition abg-ir.cc:20970
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:6022
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:6185
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:20986
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition abg-ir.cc:21181
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:21276
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:21200
real_type::modifiers_type operator~(real_type::modifiers_type l)
Bitwise one's complement operator for real_type::modifiers_type.
Definition abg-ir.cc:16193
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition abg-fwd.h:235
bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
Definition abg-ir.cc:19979
hash_t peek_hash_value(const type_or_decl_base &artefact)
Get the hash value associated to an IR node.
Definition abg-ir.cc:28049
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:888
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition abg-ir.cc:22867
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:25402
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two variables are equals modulo CV qualifiers.
Definition abg-ir.cc:19550
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:26089
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:11841
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition abg-ir.h:897
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:1332
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition abg-ir.h:1336
@ SUBTYPE_CHANGE_KIND
This means that a given IR artifact has changes in some of its sub-types, with respect to the other a...
Definition abg-ir.h:1352
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition abg-ir.h:1347
@ LOCAL_NON_TYPE_CHANGE_KIND
This means that a given IR artifact has a local non-type change. That is a change that is carried by ...
Definition abg-ir.h:1341
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:1723
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
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:9135
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition abg-ir.h:913
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:2919
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:29944
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:8541
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition abg-ir.cc:5399
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:2791
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:21054
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:3303
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:3000
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition abg-ir.cc:1686
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:905
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:28239
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition abg-ir.cc:2722
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition abg-fwd.h:256
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
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:2952
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:922
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition abg-ir.h:1246
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:910
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:12294
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition abg-ir.cc:1700
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition abg-ir.cc:10382
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition abg-ir.cc:4993
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:2977
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition abg-ir.h:900
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:20060
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:1610
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:28560
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition abg-ir.cc:11685
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition abg-ir.cc:1672
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:25235
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition abg-ir.cc:5370
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:2200
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:8920
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:8511
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:860
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:28517
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:1709
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:1742
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition abg-ir.cc:10353
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:3010
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:918
method_decl_sptr copy_member_function(const class_or_union_sptr &t, const method_decl_sptr &method)
Copy a method of a class_or_union into a new class_or_union.
Definition abg-ir.cc:24348
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:4924
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:7638
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:4722
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition abg-ir.h:4734
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:29482
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:843
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:852
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:3246
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:3280
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition abg-ir.h:3255
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:2047
A predicate for deep equality of instances of shared_ptr<type_base>
Definition abg-ir.h:2067
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:4701
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:4710