libabigail
abg-ir.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2023 Red Hat, Inc.
5 //
6 // Author: Dodji Seketeli
7 
8 /// @file
9 ///
10 /// Types of the main internal representation of libabigail.
11 ///
12 /// This internal representation abstracts the artifacts that make up
13 /// an application binary interface.
14 
15 #ifndef __ABG_IR_H__
16 #define __ABG_IR_H__
17 
18 #include <assert.h>
19 #include <stdint.h>
20 #include <cstdlib>
21 #include <functional>
22 #include <set>
23 #include <unordered_map>
24 #include "abg-cxx-compat.h"
25 #include "abg-fwd.h"
26 #include "abg-hash.h"
27 #include "abg-traverse.h"
28 #include "abg-config.h"
29 
30 /// @file
31 ///
32 /// This file contains the declarations of the Internal Representation
33 /// of libabigail.
34 
35 /// @defgroup Memory Memory management
36 /// @{
37 ///
38 /// How objects' lifetime is handled in libabigail.
39 ///
40 /// For memory management and garbage collection of libabigail's IR
41 /// artifacts, we use std::shared_ptr and std::weak_ptr.
42 ///
43 /// When manipulating these IR artifacts, there are a few rules to keep in
44 /// mind.
45 ///
46 /// <b>The declaration for a type is owned by only one scope </b>
47 ///
48 /// This means that for each instance of abigail::type_base (a type) there
49 /// is an instance of abigail::scope_decl that owns a @ref
50 /// abigail::decl_base_sptr (a shared pointer to an abigail::decl_base)
51 /// that points to the declaration of that type. The
52 /// abigail::type_base_sptr is added to the scope using the function
53 /// abigail::add_decl_to_scope().
54 ///
55 /// There is a kind of type that is usually not syntactically owned by
56 /// a scope: it's function type. In libabigail, function types are
57 /// represented by abigail::function_type and abigail::method_type.
58 /// These types must be owned by the translation unit they originate
59 /// from. Adding them to the translation unit must be done by a call
60 /// to the method function
61 /// abigail::translation::bind_function_type_life_time().
62 ///
63 /// <b> A declaration that has a type does NOT own the type </b>
64 ///
65 /// This means that, for instance, in an abigail::var_decl (a variable
66 /// declaration), the type of the declaration is not owned by the
67 /// declaration. In other (concrete) words, the variable declaration
68 /// doesn't have a shared pointer to the type. Rather, it has a *weak*
69 /// pointer to its type. That means that it has a data member of type
70 /// abigail::type_base_wptr that contains the type of the declaration.
71 ///
72 /// But then abigail::var_decl::get_type() returns a shared pointer that
73 /// is constructed from the internal weak pointer to the type. That way,
74 /// users of the type of the var can own a temporary reference on it and
75 /// be assured that the type's life time is long enough for their need.
76 ///
77 /// Likewise, data members, function and template parameters similarly
78 /// have weak pointers on their type.
79 ///
80 /// If, for a reason, you really need to keep a type alive for the
81 /// entire lifetime of the type system, then you can bind the life
82 /// time of that type to the life time of the @ref environment that is
83 /// supposed to outlive the type system. You do that by passing the
84 /// type to the function environment::keep_type_alive().
85 ///
86 /// @}
87 
88 namespace abigail
89 {
90 
91 /// The namespace of the internal representation of ABI artifacts like
92 /// types and decls.
93 namespace ir
94 {
95 
96 // Inject some std types in here.
97 using std::unordered_map;
98 
99 /// A convenience typedef for an unordered set of pointer values
100 typedef unordered_set<uintptr_t> pointer_set;
101 
102 /// Functor to hash a canonical type by using its pointer value.
104 {
105  size_t operator()(const type_base_sptr& l) const;
106  size_t operator()(const type_base *l) const;
107 }; //end struct canonical_type_hash
108 
109 /// Helper typedef for an unordered set of type_base_sptr which uses
110 /// pointer value to tell its members appart, because the members are
111 /// canonical types.
112 typedef unordered_set<type_base_sptr,
114 
115 /// Helper typedef for a vector of pointer to type_base.
116 typedef vector<type_base*> type_base_ptrs_type;
117 
118 /// Helper typedef for a vector of shared pointer to a type_base.
119 typedef vector<type_base_sptr> type_base_sptrs_type;
120 
121 void
123  vector<type_base_sptr>& result);
124 
125 /// This is an abstraction of the set of resources necessary to manage
126 /// several aspects of the internal representations of the Abigail
127 /// library.
128 ///
129 /// An environment can be seen as the boundaries in which all related
130 /// Abigail artifacts live. So before doing anything using this
131 /// library, the first thing to create is, well, you know it now, an
132 /// environment.
133 ///
134 /// Note that the lifetime of environment objects must be longer than
135 /// the lifetime of any other type in the Abigail system. So a given
136 /// instance of @ref environment must stay around as long as you are
137 /// using libabigail. It's only when you are done using the library
138 /// that you can de-allocate the environment instance.
140 {
141 public:
142  struct priv;
143  std::unique_ptr<priv> priv_;
144 
145  /// A convenience typedef for a map of canonical types. The key is
146  /// the pretty representation string of a particular type and the
147  /// value is the vector of canonical types that have the same pretty
148  /// representation string.
149  typedef std::unordered_map<string, std::vector<type_base_sptr> >
151 
152  environment();
153 
154  virtual ~environment();
155 
158 
160  get_canonical_types_map() const;
161 
162  const type_base_sptr&
163  get_void_type() const;
164 
165  const type_base_sptr&
167 
168  static string&
170 
171  bool
172  canonicalization_is_done() const;
173 
174  void
176 
177  bool
179 
180  void
182 
183  bool
185 
186  void
187  decl_only_class_equals_definition(bool f) const;
188 
189  bool
190  is_void_type(const type_base_sptr&) const;
191 
192  bool
193  is_void_type(const type_base*) const;
194 
195  bool
197 
198  bool
199  is_variadic_parameter_type(const type_base_sptr&) const;
200 
202  intern(const string&) const;
203 
204  const config&
205  get_config() const;
206 
207  bool
209 
210  void
212 
213  bool
215 
216 #ifdef WITH_DEBUG_SELF_COMPARISON
217  void
218  set_self_comparison_debug_input(const corpus_sptr& corpus);
219 
220  void
221  get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
222  corpus_sptr& second_corpus);
223 
224  void
225  self_comparison_debug_is_on(bool);
226 
227  bool
228  self_comparison_debug_is_on() const;
229 #endif
230 
231 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
232  void
233  debug_type_canonicalization_is_on(bool flag);
234 
235  bool
236  debug_type_canonicalization_is_on() const;
237 
238  void
239  debug_die_canonicalization_is_on(bool flag);
240 
241  bool
242  debug_die_canonicalization_is_on() const;
243 #endif
244 
245  vector<type_base_sptr>* get_canonical_types(const char* name);
246 
247  type_base* get_canonical_type(const char* name, unsigned index);
248 
249 #ifdef WITH_DEBUG_SELF_COMPARISON
250  const unordered_map<string, uintptr_t>&
251  get_type_id_canonical_type_map() const;
252 
253  unordered_map<string, uintptr_t>&
254  get_type_id_canonical_type_map();
255 
256  const unordered_map<uintptr_t, string>&
257  get_pointer_type_id_map() const;
258 
259  unordered_map<uintptr_t, string>&
260  get_pointer_type_id_map();
261 
262  string
263  get_type_id_from_pointer(uintptr_t ptr) const;
264 
265  string
266  get_type_id_from_type(const type_base *ptr) const;
267 
268  uintptr_t
269  get_canonical_type_from_type_id(const char*) const;
270 #endif
271 
272  friend class class_or_union;
273  friend class class_decl;
274  friend class function_type;
275 
276  friend void keep_type_alive(type_base_sptr);
277 }; // end class environment
278 
279 class location_manager;
280 /// @brief The source location of a token.
281 ///
282 /// This represents the location of a token coming from a given
283 /// translation unit. This location is actually an abstraction of
284 /// cursor in the table of all the locations of all the tokens of the
285 /// translation unit. That table is managed by the @ref location_manager
286 /// type. To get the file path, line and column numbers associated to
287 /// a given instance of @ref location, you need to use the
288 /// location_manager::expand_location method.
289 class location
290 {
291  unsigned value_;
292  // The location manager to use to decode the value above. There is
293  // one location manager per translation unit, and the location
294  // manager's life time is managed by its translation unit.
295  location_manager* loc_manager_;
296  // Whether the location is artificial. Being artificial means that
297  // the location wasn't generated by the original emitter of the
298  // metadata (i.e, the compiler if the metadata is debug info). For
299  // instance, implicit location derived from the position of XML
300  // elements in the abixml file is represented as artificial
301  // locations.
302  bool is_artificial_;
303 
304  location(unsigned v, location_manager* m)
305  : value_(v), loc_manager_(m), is_artificial_(false)
306  {}
307 
308  /// Get the location manager to use to decode the value of this
309  /// location.
310  ///
311  /// @return the location manager for the current location value.
313  get_location_manager() const
314  {return loc_manager_;}
315 
316 public:
317 
318  /// Test if the location is artificial.
319  ///
320  /// Being artificial means that the location wasn't generated by the
321  /// original emitter of the metadata (i.e, the compiler if the
322  /// metadata is debug info). For instance, the implicit location
323  /// derived from the position of a given XML element in the abixml
324  /// file is represented as artificial locations. The same XML
325  /// element might carry a non-artificial (natural?) location that was
326  /// originally emitted by the compiler that generated the original
327  /// debug info the abixml file is derived from.
328  ///
329  /// @return true iff the location is artificial.
330  bool
332  {return is_artificial_;}
333 
334  /// Set the artificial-ness of the location.
335  ///
336  /// Being artificial means that the location wasn't generated by the
337  /// original emitter of the metadata (i.e, the compiler if the
338  /// metadata is debug info). For instance, the implicit location
339  /// derived from the position of a given XML element in the abixml
340  /// file is represented as artificial locations. The same XML
341  /// element might carry a non-artificial (natural?) location that
342  /// was originally emitted by the compiler that generated the
343  /// original debug info the abixml file is derived from.
344  ///
345  /// @param f the new artificial-ness state.
346  void
348  {is_artificial_ = f;}
349 
350  /// Copy constructor of the location.
351  ///
352  /// @param l the location to copy from.
353  location(const location& l)
354  : value_(l.value_),
355  loc_manager_(l.loc_manager_),
356  is_artificial_(l.is_artificial_)
357  {}
358 
359  /// Assignment operator of the location.
360  ///
361  /// @param l the location to assign to the current one.
362  location&
363  operator=(const location& l)
364  {
365  value_ = l.value_;
366  loc_manager_ = l.loc_manager_;
367  is_artificial_ = l.is_artificial_;
368  return *this;
369  }
370 
371  /// Default constructor for the @ref location type.
373  : value_(), loc_manager_(), is_artificial_()
374  {}
375 
376  /// Get the value of the location.
377  unsigned
378  get_value() const
379  {return value_;}
380 
381  /// Convert the location into a boolean.
382  ///
383  /// @return true iff the value of the location is different from
384  /// zero.
385  operator bool() const
386  {return !!value_;}
387 
388  /// Equality operator of the @ref location type.
389  ///
390  /// @param other the other location to compare against.
391  ///
392  /// @return true iff both locations are equal.
393  bool
394  operator==(const location &other) const
395  {return value_ == other.value_;}
396 
397  /// "Less than" operator of the @ref location type.
398  ///
399  /// @parm other the other location type to compare against.
400  ///
401  /// @return true iff the current instance is less than the @p other
402  /// one.
403  bool
404  operator<(const location &other) const
405  {return value_ < other.value_;}
406 
407  /// Expand the current location into a tripplet file path, line and
408  /// column number.
409  ///
410  /// @param path the output parameter this function sets the expanded
411  /// path to.
412  ///
413  /// @param line the output parameter this function sets the expanded
414  /// line number to.
415  ///
416  /// @param column the output parameter this function sets the
417  /// expanded column number to.
418  void
419  expand(std::string& path, unsigned& line, unsigned& column) const;
420 
421  string
422  expand(void) const;
423 
424  friend class location_manager;
425 }; // end class location
426 
427 /// @brief The entry point to manage locations.
428 ///
429 /// This type keeps a table of all the locations for tokens of a
430 /// given translation unit.
432 {
433  struct priv;
434  std::unique_ptr<priv> priv_;
435 
436 public:
437 
439 
440  ~location_manager();
441 
442  location
443  create_new_location(const std::string& fle, size_t lne, size_t col);
444 
445  void
446  expand_location(const location& location, std::string& path,
447  unsigned& line, unsigned& column) const;
448 };
449 
450 /// The base of an entity of the intermediate representation that is
451 /// to be traversed.
453 {
454  /// Traverse a given IR node and its children, calling an visitor on
455  /// each node.
456  ///
457  /// @param v the visitor to call on each traversed node.
458  ///
459  /// @return true if the all the IR node tree was traversed.
460  virtual bool
462 }; // end class ir_traversable_base
463 
464 /// The hashing functor for using instances of @ref type_or_decl_base
465 /// as values in a hash map or set.
467 {
468 
469  /// Function-call Operator to hash the string representation of an
470  /// ABI artifact.
471  ///
472  /// @param artifact the ABI artifact to hash.
473  ///
474  /// @return the hash value of the string representation of @p
475  /// artifact.
476  size_t
477  operator()(const type_or_decl_base *artifact) const
478  {
479  string repr = get_pretty_representation(artifact);
480  std::hash<string> do_hash;
481  return do_hash(repr);
482  }
483 
484  /// Function-call Operator to hash the string representation of an
485  /// ABI artifact.
486  ///
487  /// @param artifact the ABI artifact to hash.
488  ///
489  /// @return the hash value of the string representation of @p
490  /// artifact.
491  size_t
492  operator()(const type_or_decl_base_sptr& artifact) const
493  {return operator()(artifact.get());}
494 }; // end struct type_or_decl_hash
495 
496 /// The comparison functor for using instances of @ref
497 /// type_or_decl_base as values in a hash map or set.
499 {
500 
501  /// The function-call operator to compare the string representations
502  /// of two ABI artifacts.
503  ///
504  /// @param l the left hand side ABI artifact operand of the
505  /// comparison.
506  ///
507  /// @param r the right hand side ABI artifact operand of the
508  /// comparison.
509  ///
510  /// @return true iff the string representation of @p l equals the one
511  /// of @p r.
512  bool
514  {
515  string repr1 = get_pretty_representation(l);
516  string repr2 = get_pretty_representation(r);
517 
518  return repr1 == repr2;
519  }
520 
521  /// The function-call operator to compare the string representations
522  /// of two ABI artifacts.
523  ///
524  /// @param l the left hand side ABI artifact operand of the
525  /// comparison.
526  ///
527  /// @param r the right hand side ABI artifact operand of the
528  /// comparison.
529  ///
530  /// @return true iff the string representation of @p l equals the one
531  /// of @p r.
532  bool
534  const type_or_decl_base_sptr &r) const
535  {return operator()(l.get(), r.get());}
536 }; // end type_or_decl_equal
537 
538 /// A convenience typedef for a hash set of type_or_decl_base_sptr
539 typedef unordered_set<type_or_decl_base_sptr,
542 
543 /// A convenience typedef for a hash set of const type_or_decl_base*
544 typedef unordered_set<const type_or_decl_base*,
547 
548 /// A convenience typedef for a map which key is a string and which
549 /// value is a @ref type_base_wptr.
550 typedef unordered_map<string, type_base_wptr> string_type_base_wptr_map_type;
551 
552 /// A convenience typedef for a map which key is a string and which
553 /// value is a @ref type_base_sptr.
554 typedef unordered_map<string, type_base_sptr> string_type_base_sptr_map_type;
555 
556 /// A convenience typedef for a map which key is an @ref
557 /// interned_string and which value is a @ref type_base_wptr.
558 typedef unordered_map<interned_string, type_base_wptr, hash_interned_string>
560 
561 /// A convenience typedef for a map which key is an @ref
562 /// interned_string and which value is a @ref type_base_wptr.
563 typedef unordered_map<interned_string,
567 
568 /// This is a type that aggregates maps of all the kinds of types that
569 /// are supported by libabigail.
570 ///
571 /// For instance, the type_maps contains a map of string to basic
572 /// type, a map of string to class type, a map of string to union
573 /// types, etc. The key of a map entry is the pretty representation
574 /// of the type, and the value of the map entry is the type.
576 {
577  struct priv;
578  std::unique_ptr<priv> priv_;
579 
580 public:
581 
582  type_maps();
583 
584  ~type_maps();
585 
586  bool
587  empty() const;
588 
590  basic_types() const;
591 
593  basic_types();
594 
596  class_types() const;
597 
599  class_types();
600 
602  union_types();
603 
605  union_types() const;
606 
608  enum_types();
609 
611  enum_types() const;
612 
614  typedef_types();
615 
617  typedef_types() const;
618 
620  qualified_types();
621 
623  qualified_types() const;
624 
626  pointer_types();
627 
629  pointer_types() const;
630 
632  reference_types();
633 
635  reference_types() const;
636 
638  array_types();
639 
641  array_types() const;
642 
644  subrange_types() const;
645 
647  subrange_types();
648 
650  function_types();
651 
653  function_types() const;
654 
655  const vector<type_base_wptr>&
656  get_types_sorted_by_name() const;
657 }; // end class type_maps;
658 
659 /// This is the abstraction of the set of relevant artefacts (types,
660 /// variable declarations, functions, templates, etc) bundled together
661 /// into a translation unit.
663 {
664  struct priv;
665  std::unique_ptr<priv> priv_;
666 
667  // Forbidden
668  translation_unit() = delete;
669 
670 public:
671  /// Convenience typedef for a shared pointer on a @ref global_scope.
672  typedef shared_ptr<scope_decl> global_scope_sptr;
673 
674  /// The language of the translation unit.
675  enum language
676  {
677  LANG_UNKNOWN = 0,
678  LANG_Cobol74,
679  LANG_Cobol85,
680  LANG_C89,
681  LANG_C99,
682  LANG_C11,
683  LANG_C,
684  LANG_C_plus_plus_03,
685  LANG_C_plus_plus_11,
686  LANG_C_plus_plus_14,
687  LANG_C_plus_plus,
688  LANG_ObjC,
689  LANG_ObjC_plus_plus,
690  LANG_Fortran77,
691  LANG_Fortran90,
692  LANG_Fortran95,
693  LANG_Ada83,
694  LANG_Ada95,
695  LANG_Pascal83,
696  LANG_Modula2,
697  LANG_Java,
698  LANG_PLI,
699  LANG_UPC,
700  LANG_D,
701  LANG_Python,
702  LANG_Go,
703  LANG_Rust,
704  LANG_Mips_Assembler
705  };
706 
707 public:
709  const std::string& path,
710  char address_size = 0);
711 
712  virtual ~translation_unit();
713 
714  const environment&
715  get_environment() const;
716 
717  language
718  get_language() const;
719 
720  void
722 
723  const std::string&
724  get_path() const;
725 
726  void
727  set_path(const string&);
728 
729  const std::string&
730  get_compilation_dir_path() const;
731 
732  void
733  set_compilation_dir_path(const std::string&);
734 
735  const std::string&
736  get_absolute_path() const;
737 
738  void
739  set_corpus(corpus*);
740 
741  const corpus*
742  get_corpus() const;
743 
744  corpus*
745  get_corpus();
746 
747  const scope_decl_sptr&
748  get_global_scope() const;
749 
752 
753  const type_maps&
754  get_types() const;
755 
756  type_maps&
757  get_types();
758 
759  const vector<function_type_sptr>&
760  get_live_fn_types() const;
761 
763  get_loc_mgr();
764 
765  const location_manager&
766  get_loc_mgr() const;
767 
768  bool
769  is_empty() const;
770 
771  char
772  get_address_size() const;
773 
774  void
775  set_address_size(char);
776 
777  bool
778  is_constructed() const;
779 
780  void
781  set_is_constructed(bool);
782 
783  bool
784  operator==(const translation_unit&) const;
785 
786  bool
787  operator!=(const translation_unit&) const;
788 
789  void
791 
792  virtual bool
794 
795  friend function_type_sptr
796  lookup_function_type_in_translation_unit(const function_type& t,
797  const translation_unit& tu);
798 
799  friend function_type_sptr
801  translation_unit& tu);
802 
803  friend type_base_sptr
804  synthesize_type_from_translation_unit(const type_base_sptr& type,
805  translation_unit& tu);
806 };//end class translation_unit
807 
808 /// A comparison functor to compare translation units based on their
809 /// absolute paths.
811 {
812  /// Compare two translations units based on their absolute paths.
813  ///
814  /// @param lhs the first translation unit to consider for the
815  /// comparison.
816  ///
817  /// @param rhs the second translatin unit to consider for the
818  /// comparison.
819  bool
821  const translation_unit_sptr& rhs) const
822  {return lhs->get_absolute_path() < rhs->get_absolute_path();}
823 }; // end struct shared_translation_unit_comp
824 
825 /// Convenience typedef for an ordered set of @ref
826 /// translation_unit_sptr.
827 typedef std::set<translation_unit_sptr,
829 
830 string
832 
835 
836 bool
838 
839 bool
841 
842 bool
844 
845 bool
847 
848 bool
850 
851 bool
853 
854 /// Access specifier for class members.
856 {
857  no_access,
858  public_access,
859  protected_access,
860  private_access,
861 };
862 
863 class elf_symbol;
864 /// A convenience typedef for a shared pointer to elf_symbol.
865 typedef shared_ptr<elf_symbol> elf_symbol_sptr;
866 
867 /// A convenience typedef for a weak pointer to elf_symbol.
868 typedef weak_ptr<elf_symbol> elf_symbol_wptr;
869 
870 /// Convenience typedef for a map which key is a string and which
871 /// value if the elf symbol of the same name.
872 typedef std::unordered_map<string, elf_symbol_sptr>
874 
875 /// Convenience typedef for a shared pointer to an
876 /// string_elf_symbol_sptr_map_type.
877 typedef shared_ptr<string_elf_symbol_sptr_map_type>
879 
880 /// Convenience typedef for a vector of elf_symbol
881 typedef std::vector<elf_symbol_sptr> elf_symbols;
882 
883 /// Convenience typedef for a map which key is a string and which
884 /// value is a vector of elf_symbol.
885 typedef std::unordered_map<string, elf_symbols>
887 
888 /// Convenience typedef for a shared pointer to
889 /// string_elf_symbols_map_type.
890 typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
891 
892 /// Abstraction of an elf symbol.
893 ///
894 /// This is useful when a given corpus has been read from an ELF file.
895 /// In that case, a given decl might be associated to its underlying
896 /// ELF symbol, if that decl is publicly exported in the ELF file. In
897 /// that case, comparing decls might involve comparing their
898 /// underlying symbols as well.
900 {
901 public:
902  /// The type of a symbol.
903  enum type
904  {
905  NOTYPE_TYPE = 0,
906  OBJECT_TYPE,
907  FUNC_TYPE,
908  SECTION_TYPE,
909  FILE_TYPE,
910  COMMON_TYPE,
911  TLS_TYPE,
912  GNU_IFUNC_TYPE
913  };
914 
915  /// The binding of a symbol.
916  enum binding
917  {
918  LOCAL_BINDING = 0,
919  GLOBAL_BINDING,
920  WEAK_BINDING,
921  GNU_UNIQUE_BINDING
922  };
923 
924  /// The visibility of the symbol.
926  {
927  DEFAULT_VISIBILITY,
928  PROTECTED_VISIBILITY,
929  HIDDEN_VISIBILITY,
930  INTERNAL_VISIBILITY,
931  };
932 
933  /// Inject the elf_symbol::version here.
934  class version;
935 
936 private:
937  struct priv;
938  std::unique_ptr<priv> priv_;
939 
940  elf_symbol();
941 
942  elf_symbol(const environment& e,
943  size_t i,
944  size_t s,
945  const string& n,
946  type t,
947  binding b,
948  bool d,
949  bool c,
950  const version& ve,
951  visibility vi,
952  bool is_in_ksymtab = false,
953  const abg_compat::optional<uint32_t>& crc = {},
954  const abg_compat::optional<std::string>& ns = {},
955  bool is_suppressed = false);
956 
957  elf_symbol(const elf_symbol&);
958 
959  elf_symbol&
960  operator=(const elf_symbol& s);
961 
962 public:
963 
964  static elf_symbol_sptr
965  create(const environment& e,
966  size_t i,
967  size_t s,
968  const string& n,
969  type t,
970  binding b,
971  bool d,
972  bool c,
973  const version& ve,
974  visibility vi,
975  bool is_in_ksymtab = false,
976  const abg_compat::optional<uint32_t>& crc = {},
977  const abg_compat::optional<std::string>& ns = {},
978  bool is_suppressed = false);
979 
980  const environment&
981  get_environment() const;
982 
983  size_t
984  get_index() const;
985 
986  void
987  set_index(size_t);
988 
989  const string&
990  get_name() const;
991 
992  void
993  set_name(const string& n);
994 
995  type
996  get_type() const;
997 
998  void
999  set_type(type t);
1000 
1001  size_t
1002  get_size() const;
1003 
1004  void
1005  set_size(size_t);
1006 
1007  binding
1008  get_binding() const;
1009 
1010  void
1011  set_binding(binding b);
1012 
1013  version&
1014  get_version() const;
1015 
1016  void
1017  set_version(const version& v);
1018 
1019  void
1021 
1022  visibility
1023  get_visibility() const;
1024 
1025  bool
1026  is_defined() const;
1027 
1028  void
1029  is_defined(bool d);
1030 
1031  bool
1032  is_public() const;
1033 
1034  bool
1035  is_function() const;
1036 
1037  bool
1038  is_variable() const;
1039 
1040  bool
1041  is_in_ksymtab() const;
1042 
1043  void
1045 
1047  get_crc() const;
1048 
1049  void
1051 
1053  get_namespace() const;
1054 
1055  void
1057 
1058  bool
1059  is_suppressed() const;
1060 
1061  void
1063 
1064  const elf_symbol_sptr
1065  get_main_symbol() const;
1066 
1068  get_main_symbol();
1069 
1070  bool
1071  is_main_symbol() const;
1072 
1074  update_main_symbol(const std::string&);
1075 
1077  get_next_alias() const;
1078 
1079  bool
1080  has_aliases() const;
1081 
1082  int
1083  get_number_of_aliases() const;
1084 
1085  void
1086  add_alias(const elf_symbol_sptr&);
1087 
1088  bool
1089  is_common_symbol() const;
1090 
1091  bool
1093 
1095  get_next_common_instance() const;
1096 
1097  void
1099 
1100  const string&
1101  get_id_string() const;
1102 
1104  get_alias_from_name(const string& name) const;
1105 
1107  get_alias_which_equals(const elf_symbol& other) const;
1108 
1110  get_alias_with_default_symbol_version() const;
1111 
1112  string
1114  bool include_symbol_itself = true) const;
1115 
1116  string
1117  get_aliases_id_string(bool include_symbol_itself = true) const;
1118 
1119  static bool
1120  get_name_and_version_from_id(const string& id,
1121  string& name,
1122  string& ver);
1123 
1124  bool
1125  operator==(const elf_symbol&) const;
1126 
1127  bool
1128  does_alias(const elf_symbol&) const;
1129 }; // end class elf_symbol.
1130 
1131 std::ostream&
1132 operator<<(std::ostream& o, elf_symbol::type t);
1133 
1134 std::ostream&
1135 operator<<(std::ostream& o, elf_symbol::binding t);
1136 
1137 std::ostream&
1138 operator<<(std::ostream& o, elf_symbol::visibility t);
1139 
1140 bool
1142 
1143 bool
1145 
1146 bool
1148 
1149 bool
1151 
1152 bool
1154 
1155 bool
1156 operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1157 
1158 bool
1159 operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1160 
1161 bool
1162 elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1163 
1164 void
1165 compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1166  const string_elf_symbols_map_type& symtab,
1167  vector<elf_symbol_sptr>& alias_set);
1168 
1169 /// The abstraction of the version of an ELF symbol.
1171 {
1172  struct priv;
1173  std::unique_ptr<priv> priv_;
1174 
1175 public:
1176  version();
1177 
1178  version(const string& v,
1179  bool is_default);
1180 
1181  version(const version& v);
1182 
1183  ~version();
1184 
1185  operator const string&() const;
1186 
1187  const string&
1188  str() const;
1189 
1190  void
1191  str(const string& s);
1192 
1193  bool
1194  is_default() const;
1195 
1196  void
1197  is_default(bool f);
1198 
1199  bool
1200  is_empty() const;
1201 
1202  bool
1203  operator==(const version& o) const;
1204 
1205  bool
1206  operator!=(const version& o) const;
1207 
1208  version&
1209  operator=(const version& o);
1210 };// end class elf_symbol::version
1211 
1212 class context_rel;
1213 /// A convenience typedef for shared pointers to @ref context_rel
1214 typedef shared_ptr<context_rel> context_rel_sptr;
1215 
1216 /// The abstraction of the relationship between an entity and its
1217 /// containing scope (its context). That relationship can carry
1218 /// properties like access rights (if the parent is a class_decl),
1219 /// etc.
1220 ///
1221 /// But importantly, this relationship carries a pointer to the
1222 /// actualy parent.
1224 {
1225 protected:
1226  scope_decl* scope_;
1227  enum access_specifier access_;
1228  bool is_static_;
1229 
1230 public:
1231  context_rel()
1232  : scope_(0),
1233  access_(no_access),
1234  is_static_(false)
1235  {}
1236 
1238  : scope_(s),
1239  access_(no_access),
1240  is_static_(false)
1241  {}
1242 
1244  access_specifier a,
1245  bool f)
1246  : scope_(s),
1247  access_(a),
1248  is_static_(f)
1249  {}
1250 
1251  scope_decl*
1252  get_scope() const
1253  {return scope_;}
1254 
1256  get_access_specifier() const
1257  {return access_;}
1258 
1259  void
1260  set_access_specifier(access_specifier a)
1261  {access_ = a;}
1262 
1263  bool
1264  get_is_static() const
1265  {return is_static_;}
1266 
1267  void
1268  set_is_static(bool s)
1269  {is_static_ = s;}
1270 
1271  void
1272  set_scope(scope_decl* s)
1273  {scope_ = s;}
1274 
1275  bool
1276  operator==(const context_rel& o)const
1277  {
1278  return (access_ == o.access_
1279  && is_static_ == o.is_static_);
1280  }
1281 
1282  /// Inequality operator.
1283  ///
1284  /// @param o the other instance of @ref context_rel to compare the
1285  /// current instance against.
1286  ///
1287  /// @return true iff the current instance of @ref context_rel is
1288  /// different from @p o.
1289  bool
1290  operator!=(const context_rel& o) const
1291  {return !operator==(o);}
1292 
1293  virtual ~context_rel();
1294 };// end class context_rel
1295 
1296 /// A bitfield that gives callers of abigail::ir::equals() some
1297 /// insight about how different two internal representation artifacts
1298 /// are.
1300 {
1301  NO_CHANGE_KIND = 0,
1302 
1303  /// This means that a given IR artifact has a local type change.
1305 
1306  /// This means that a given IR artifact has a local non-type change.
1307  /// That is a change that is carried by the artifact itself, not by
1308  /// its type.
1310 
1311  /// Testing (anding) against this mask means that a given IR artifact has
1312  /// local differences, with respect to the other artifact it was compared
1313  /// against. A local change is a change that is carried by the artifact
1314  /// itself (or its type), rather than by one off its sub-types.
1316 
1317  /// This means that a given IR artifact has changes in some of its
1318  /// sub-types, with respect to the other artifact it was compared
1319  /// against.
1321 };// end enum change_kind
1322 
1325 
1328 
1329 change_kind&
1331 
1332 change_kind&
1334 
1335 bool
1337  const decl_base& r,
1338  change_kind* k);
1339 
1340 bool
1341 equals(const decl_base&, const decl_base&, change_kind*);
1342 
1343 /// The base class of both types and declarations.
1345 {
1346  struct priv;
1347  mutable std::unique_ptr<priv> priv_;
1348 
1351 
1352 protected:
1353 
1354  /// This is a bitmap type which instance is meant to contain the
1355  /// runtime type of a given ABI artifact. Bits of the identifiers
1356  /// of the type of a given artifact as well as the types it inherits
1357  /// from are to be set to 1.
1359  {
1360  ABSTRACT_TYPE_OR_DECL,
1361  ABSTRACT_DECL_BASE = 1,
1362  ABSTRACT_SCOPE_DECL = 1 << 1,
1363  GLOBAL_SCOPE_DECL = 1 << 2,
1364  NAMESPACE_DECL = 1 << 3,
1365  VAR_DECL = 1 << 4,
1366  FUNCTION_DECL = 1 << 5,
1367  FUNCTION_PARAMETER_DECL = 1 << 6,
1368  METHOD_DECL = 1 << 7,
1369  TEMPLATE_DECL = 1 << 8,
1370  ABSTRACT_TYPE_BASE = 1 << 9,
1371  ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1372  BASIC_TYPE = 1 << 11,
1373  QUALIFIED_TYPE = 1 << 12,
1374  POINTER_TYPE = 1 << 13,
1375  REFERENCE_TYPE = 1 << 14,
1376  ARRAY_TYPE = 1 << 15,
1377  ENUM_TYPE = 1 << 16,
1378  TYPEDEF_TYPE = 1 << 17,
1379  CLASS_TYPE = 1 << 18,
1380  UNION_TYPE = 1 << 19,
1381  FUNCTION_TYPE = 1 << 20,
1382  METHOD_TYPE = 1 << 21,
1383  }; // end enum type_or_decl_kind
1384 
1385  enum type_or_decl_kind
1386  kind() const;
1387 
1388  void
1389  kind(enum type_or_decl_kind);
1390 
1391  const void*
1392  runtime_type_instance() const;
1393 
1394  void*
1396 
1397  void
1398  runtime_type_instance(void*);
1399 
1400  const void*
1401  type_or_decl_base_pointer() const;
1402 
1403  void*
1405 
1406  bool hashing_started() const;
1407 
1408  void hashing_started(bool) const;
1409 
1411  operator=(const type_or_decl_base&);
1412 
1413 public:
1414 
1416  enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1417 
1418  virtual ~type_or_decl_base();
1419 
1420  bool
1421  get_is_artificial() const;
1422 
1423  void
1424  set_is_artificial(bool);
1425 
1426  const environment&
1427  get_environment() const;
1428 
1429  void
1431 
1432  location&
1433  get_artificial_location() const;
1434 
1435  bool
1436  has_artificial_location() const;
1437 
1438  const corpus*
1439  get_corpus() const;
1440 
1441  corpus*
1442  get_corpus();
1443 
1444  void
1446 
1447  const translation_unit*
1448  get_translation_unit() const;
1449 
1452 
1453  virtual bool
1455 
1456  virtual string
1457  get_pretty_representation(bool internal = false,
1458  bool qualified_name = true) const = 0;
1459 
1463 
1467 
1471 
1475 
1476  friend class_decl*
1478 
1479  friend pointer_type_def*
1481 
1482  friend type_base*
1483  is_type(const type_or_decl_base*);
1484 
1485  friend decl_base*
1486  is_decl(const type_or_decl_base* d);
1487 }; // end class type_or_decl_base
1488 
1492 
1496 
1500 
1504 
1505 bool
1507 
1508 bool
1510 
1511 bool
1513 
1514 /// The base type of all declarations.
1515 class decl_base : public virtual type_or_decl_base
1516 {
1517  // Forbidden
1518  decl_base();
1519 
1520  struct priv;
1521 
1522 protected:
1523 
1524  const interned_string&
1525  peek_qualified_name() const;
1526 
1527  void
1529 
1530  void
1531  set_qualified_name(const interned_string&) const;
1532 
1533  const interned_string&
1535 
1536  void
1538 
1539 public:
1540  // This is public because some internals of the library need to
1541  // update it. But it's opaque to client code anyway, so no big
1542  // deal. Also, it's not handled by a shared_ptr because accessing
1543  // the data members of the priv struct for this decl_base shows up
1544  // on performance profiles when dealing with big binaries with a lot
1545  // of types; dereferencing the shared_ptr involves locking of some
1546  // sort and that is slower than just dereferencing a pointer likere
1547  // here. There are other types for which the priv pointer is
1548  // managed using shared_ptr just fine, because those didn't show up
1549  // during our performance profiling.
1550  priv* priv_;
1551 
1552  /// Facility to hash instances of decl_base.
1553  struct hash;
1554 
1555  /// ELF visibility
1557  {
1558  VISIBILITY_NONE,
1559  VISIBILITY_DEFAULT,
1560  VISIBILITY_PROTECTED,
1561  VISIBILITY_HIDDEN,
1562  VISIBILITY_INTERNAL
1563  };
1564 
1565  /// ELF binding
1566  enum binding
1567  {
1568  BINDING_NONE,
1569  BINDING_LOCAL,
1570  BINDING_GLOBAL,
1571  BINDING_WEAK
1572  };
1573 
1574  virtual void
1576 
1577 protected:
1578  const context_rel*
1579  get_context_rel() const;
1580 
1581  context_rel*
1582  get_context_rel();
1583 
1584  void
1585  set_context_rel(context_rel *c);
1586  decl_base(const decl_base&);
1587 
1588 public:
1589  decl_base(const environment& e,
1590  const string& name,
1591  const location& locus,
1592  const string& mangled_name = "",
1593  visibility vis = VISIBILITY_DEFAULT);
1594 
1595  decl_base(const environment& e,
1596  const interned_string& name,
1597  const location& locus,
1598  const interned_string& mangled_name = interned_string(),
1599  visibility vis = VISIBILITY_DEFAULT);
1600 
1601  decl_base(const environment&, const location&);
1602 
1603  virtual bool
1604  operator==(const decl_base&) const;
1605 
1606  virtual bool
1607  operator!=(const decl_base&) const;
1608 
1609  virtual bool
1611 
1612  virtual ~decl_base();
1613 
1614  virtual size_t
1615  get_hash() const;
1616 
1617  virtual string
1618  get_pretty_representation(bool internal = false,
1619  bool qualified_name = true) const;
1620 
1621  virtual void
1622  get_qualified_name(interned_string& qualified_name,
1623  bool internal = false) const;
1624 
1625  virtual const interned_string&
1626  get_qualified_name(bool internal = false) const;
1627 
1628  virtual const interned_string&
1629  get_scoped_name() const;
1630 
1631  bool
1633 
1634  void
1636 
1637  const location&
1638  get_location() const;
1639 
1640  void
1641  set_location(const location& l);
1642 
1643  const interned_string&
1644  get_name() const;
1645 
1646  const interned_string&
1647  get_qualified_parent_name() const;
1648 
1649  void
1650  set_name(const string& n);
1651 
1652  bool
1653  get_is_anonymous() const;
1654 
1655  void
1656  set_is_anonymous(bool);
1657 
1658  bool
1659  get_has_anonymous_parent() const;
1660 
1661  bool
1663 
1665  get_naming_typedef() const;
1666 
1667  void
1669 
1670  const interned_string&
1671  get_linkage_name() const;
1672 
1673  virtual void
1674  set_linkage_name(const string& m);
1675 
1676  scope_decl*
1677  get_scope() const;
1678 
1679  visibility
1680  get_visibility() const;
1681 
1682  void
1684 
1685  const decl_base_sptr
1686  get_earlier_declaration() const;
1687 
1688  void
1689  set_earlier_declaration(const decl_base_sptr&);
1690 
1691  const decl_base_sptr
1693 
1694  void
1695  set_definition_of_declaration(const decl_base_sptr&);
1696 
1697  const decl_base*
1699 
1700  bool
1701  get_is_declaration_only() const;
1702 
1703  void
1704  set_is_declaration_only(bool f);
1705 
1706  friend bool
1707  equals(const decl_base&, const decl_base&, change_kind*);
1708 
1709  friend bool
1710  equals(const var_decl&, const var_decl&, change_kind*);
1711 
1712  friend bool
1714 
1715  friend bool
1717  const decl_base& r,
1718  change_kind* k);
1719 
1720  friend decl_base_sptr
1721  add_decl_to_scope(decl_base_sptr decl, scope_decl* scpe);
1722 
1723  friend void
1724  remove_decl_from_scope(decl_base_sptr);
1725 
1726  friend decl_base_sptr
1727  insert_decl_into_scope(decl_base_sptr,
1728  vector<shared_ptr<decl_base> >::iterator,
1729  scope_decl*);
1730 
1731  friend enum access_specifier
1733 
1734  friend enum access_specifier
1735  get_member_access_specifier(const decl_base_sptr& d);
1736 
1737  friend void
1739  access_specifier a);
1740 
1741  friend bool
1742  get_member_is_static(const decl_base& d);
1743 
1744  friend bool
1745  get_member_is_static(const decl_base_sptr& d);
1746 
1747  friend void
1748  set_member_is_static(const decl_base_sptr& d, bool s);
1749 
1750  friend void
1751  set_member_is_static(decl_base& d, bool s);
1752 
1753  friend bool
1755 
1756  friend void
1758 
1759  friend class class_or_union;
1760  friend class class_decl;
1761  friend class scope_decl;
1762 };// end class decl_base
1763 
1764 bool
1765 operator==(const decl_base_sptr&, const decl_base_sptr&);
1766 
1767 bool
1768 operator!=(const decl_base_sptr&, const decl_base_sptr&);
1769 
1770 bool
1771 operator==(const type_base_sptr&, const type_base_sptr&);
1772 
1773 bool
1774 operator!=(const type_base_sptr&, const type_base_sptr&);
1775 
1776 std::ostream&
1777 operator<<(std::ostream&, decl_base::visibility);
1778 
1779 std::ostream&
1780 operator<<(std::ostream&, decl_base::binding);
1781 
1782 bool
1783 equals(const scope_decl&, const scope_decl&, change_kind*);
1784 
1785 /// A declaration that introduces a scope.
1786 class scope_decl : public virtual decl_base
1787 {
1788  struct priv;
1789  std::unique_ptr<priv> priv_;
1790 
1791 public:
1792 
1793  /// Convenience typedef for a vector of @ref decl_base_sptr.
1794  typedef std::vector<decl_base_sptr > declarations;
1795  /// Convenience typedef for a vector of @ref function_type_sptr.
1796  typedef std::vector<function_type_sptr > function_types;
1797  /// Convenience typedef for a vector of @ref scope_decl_sptr.
1798  typedef std::vector<scope_decl_sptr> scopes;
1799 
1800  scope_decl();
1801 
1802 protected:
1803  virtual decl_base_sptr
1804  add_member_decl(const decl_base_sptr& member);
1805 
1806  decl_base_sptr
1807  insert_member_decl(decl_base_sptr member, declarations::iterator before);
1808 
1809  virtual void
1810  remove_member_decl(decl_base_sptr member);
1811 
1812 public:
1813  struct hash;
1814 
1815  scope_decl(const environment& env,
1816  const string& name, const location& locus,
1817  visibility vis = VISIBILITY_DEFAULT);
1818 
1819  scope_decl(const environment& env, location& l);
1820 
1821  virtual size_t
1822  get_hash() const;
1823 
1824  virtual bool
1825  operator==(const decl_base&) const;
1826 
1828  get_canonical_types() const;
1829 
1832 
1833  const type_base_sptrs_type&
1835 
1836  const declarations&
1837  get_member_decls() const;
1838 
1839  declarations&
1840  get_member_decls();
1841 
1842  const declarations&
1843  get_sorted_member_decls() const;
1844 
1845  virtual size_t
1847 
1848  virtual size_t
1850 
1851  virtual size_t
1853 
1854  scopes&
1856 
1857  const scopes&
1858  get_member_scopes() const;
1859 
1860  bool
1861  is_empty() const;
1862 
1863  bool
1864  find_iterator_for_member(const decl_base*, declarations::iterator&);
1865 
1866  bool
1867  find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1868 
1869  void
1870  insert_member_type(type_base_sptr t,
1871  declarations::iterator before);
1872 
1873  void
1874  add_member_type(type_base_sptr t);
1875 
1876  type_base_sptr
1877  add_member_type(type_base_sptr t, access_specifier a);
1878 
1879  void
1880  remove_member_type(type_base_sptr t);
1881 
1882  const type_base_sptrs_type&
1883  get_member_types() const;
1884 
1885  const type_base_sptrs_type&
1886  get_sorted_member_types() const;
1887 
1888  type_base_sptr
1889  find_member_type(const string& name) const;
1890 
1891  virtual bool
1893 
1894  virtual ~scope_decl();
1895 
1896  friend decl_base_sptr
1897  add_decl_to_scope(decl_base_sptr decl, scope_decl* scope);
1898 
1899  friend decl_base_sptr
1900  insert_decl_into_scope(decl_base_sptr decl,
1901  scope_decl::declarations::iterator before,
1902  scope_decl* scope);
1903 
1904  friend void
1905  remove_decl_from_scope(decl_base_sptr decl);
1906 };//end class scope_decl
1907 
1908 bool
1910 
1911 bool
1913 
1914 /// Hasher for the @ref scope_decl type.
1916 {
1917  size_t
1918  operator()(const scope_decl& d) const;
1919 
1920  size_t
1921  operator()(const scope_decl* d) const;
1922 };
1923 
1924 /// This abstracts the global scope of a given translation unit.
1925 ///
1926 /// Only one instance of this class must be present in a given
1927 /// translation_unit. That instance is implicitely created the first
1928 /// time translatin_unit::get_global_scope is invoked.
1929 class global_scope : public scope_decl
1930 {
1931  translation_unit* translation_unit_;
1932 
1934 
1935 public:
1936 
1937  friend class translation_unit;
1938 
1940  get_translation_unit() const
1941  {return translation_unit_;}
1942 
1943  virtual ~global_scope();
1944 };
1945 
1946 bool
1947 equals(const type_base&, const type_base&, change_kind*);
1948 
1949 /// An abstraction helper for type declarations
1950 class type_base : public virtual type_or_decl_base
1951 {
1952  struct priv;
1953 
1954 public:
1955  // This priv pointer is not handled by a shared_ptr because
1956  // accessing the data members of the priv struct for this type_base
1957  // shows up on performance profiles when dealing with big binaries
1958  // with a lot of types; dereferencing the shared_ptr involves
1959  // locking of some sort and that is slower than just dereferencing a
1960  // pointer likere here. There are other types for which the priv
1961  // pointer is managed using shared_ptr just fine, because those
1962  // didn't show up during our performance profiling.
1963  priv* priv_;
1964 
1965 private:
1966  // Forbid this.
1967  type_base();
1968 
1969  static type_base_sptr
1970  get_canonical_type_for(type_base_sptr);
1971 
1972 protected:
1973  virtual void
1975 
1976 public:
1977 
1978  /// A hasher for type_base types.
1979  struct hash;
1980 
1981  /// A hasher for types. It gets the dynamic type of the current
1982  /// instance of type and hashes it accordingly. Note that the hashing
1983  /// function of this hasher must be updated each time a new kind of
1984  /// type is added to the IR.
1985  struct dynamic_hash;
1986 
1987  /// A hasher for shared_ptr<type_base> that will hash it based on the
1988  /// runtime type of the type pointed to.
1989  struct shared_ptr_hash;
1990 
1991  type_base(const environment& e, size_t s, size_t a);
1992 
1993  friend type_base_sptr canonicalize(type_base_sptr);
1994 
1995  type_base_sptr
1996  get_canonical_type() const;
1997 
1998  type_base*
1999  get_naked_canonical_type() const;
2000 
2001  const interned_string&
2002  get_cached_pretty_representation(bool internal = false) const;
2003 
2004  virtual bool
2005  operator==(const type_base&) const;
2006 
2007  virtual bool
2008  operator!=(const type_base&) const;
2009 
2010  virtual bool
2012 
2013  virtual ~type_base();
2014 
2015  virtual void
2016  set_size_in_bits(size_t);
2017 
2018  virtual size_t
2019  get_size_in_bits() const;
2020 
2021  virtual void
2022  set_alignment_in_bits(size_t);
2023 
2024  virtual size_t
2025  get_alignment_in_bits() const;
2026 };//end class type_base
2027 
2028 /// Hash functor for instances of @ref type_base.
2030 {
2031  size_t
2032  operator()(const type_base& t) const;
2033 
2034  size_t
2035  operator()(const type_base* t) const;
2036 
2037  size_t
2038  operator()(const type_base_sptr t) const;
2039 }; // end struct type_base::hash
2040 
2041 /// A predicate for deep equality of instances of
2042 /// type_base*
2044 {
2045  bool
2046  operator()(const type_base* l, const type_base* r) const
2047  {
2048  if (!!l != !!r)
2049  return false;
2050 
2051  if (l == r)
2052  return true;
2053 
2054  if (l)
2055  return *l == *r;
2056 
2057  return true;
2058  }
2059 };
2060 
2061 /// A predicate for deep equality of instances of
2062 /// shared_ptr<type_base>
2064 {
2065  bool
2066  operator()(const type_base_sptr l, const type_base_sptr r) const
2067  {
2068  if (!!l != !!r)
2069  return false;
2070 
2071  if (l.get() == r.get())
2072  return true;
2073 
2074  if (l)
2075  return *l == *r;
2076 
2077  return true;
2078  }
2079 };
2080 
2081 bool
2082 equals(const type_decl&, const type_decl&, change_kind*);
2083 
2084 /// A basic type declaration that introduces no scope.
2085 class type_decl : public virtual decl_base, public virtual type_base
2086 {
2087  // Forbidden.
2088  type_decl();
2089 
2090 public:
2091 
2092  /// Facility to hash instance of type_decl
2093  struct hash;
2094 
2095  type_decl(const environment& env,
2096  const string& name,
2097  size_t size_in_bits,
2098  size_t alignment_in_bits,
2099  const location& locus,
2100  const string& mangled_name = "",
2101  visibility vis = VISIBILITY_DEFAULT);
2102 
2103  virtual bool
2104  operator==(const type_base&) const;
2105 
2106  virtual bool
2107  operator==(const decl_base&) const;
2108 
2109  virtual bool
2110  operator==(const type_decl&) const;
2111 
2112  virtual bool
2113  operator!=(const type_base&)const;
2114 
2115  virtual bool
2116  operator!=(const decl_base&)const;
2117 
2118  virtual bool
2119  operator!=(const type_decl&)const;
2120 
2121  virtual void
2122  get_qualified_name(interned_string& qualified_name,
2123  bool internal = false) const;
2124 
2125  virtual const interned_string&
2126  get_qualified_name(bool internal = false) const;
2127 
2128  virtual string
2129  get_pretty_representation(bool internal = false,
2130  bool qualified_name = true) const;
2131 
2132  virtual bool
2134 
2135  virtual ~type_decl();
2136 };// end class type_decl.
2137 
2138 bool
2140 
2141 bool
2142 operator==(const type_decl_sptr&, const type_decl_sptr&);
2143 
2144 bool
2145 operator!=(const type_decl_sptr&, const type_decl_sptr&);
2146 
2147 /// A type that introduces a scope.
2148 class scope_type_decl : public scope_decl, public virtual type_base
2149 {
2150  scope_type_decl();
2151 
2152 public:
2153 
2154  /// Hasher for instances of scope_type_decl
2155  struct hash;
2156 
2157  scope_type_decl(const environment& env, const string& name,
2158  size_t size_in_bits, size_t alignment_in_bits,
2159  const location& locus, visibility vis = VISIBILITY_DEFAULT);
2160 
2161  virtual bool
2162  operator==(const decl_base&) const;
2163 
2164  virtual bool
2165  operator==(const type_base&) const;
2166 
2167  virtual bool
2169 
2170  virtual ~scope_type_decl();
2171 };
2172 
2173 /// The abstraction of a namespace declaration
2175 {
2176 public:
2177 
2178  namespace_decl(const environment& env, const string& name,
2179  const location& locus, visibility vis = VISIBILITY_DEFAULT);
2180 
2181  virtual string
2182  get_pretty_representation(bool internal = false,
2183  bool qualified_name = true) const;
2184 
2185  virtual bool
2186  operator==(const decl_base&) const;
2187 
2188  virtual bool
2190 
2191  virtual ~namespace_decl();
2192 
2194 };// end class namespace_decl
2195 
2196 /// A convenience typedef for vectors of @ref namespace_decl_sptr
2197 typedef vector<namespace_decl_sptr> namespaces_type;
2198 
2199 bool
2201 
2202 /// The abstraction of a qualified type.
2203 class qualified_type_def : public virtual type_base, public virtual decl_base
2204 {
2205  class priv;
2206  std::unique_ptr<priv> priv_;
2207 
2208  // Forbidden.
2210 
2211 protected:
2212  string build_name(bool, bool internal = false) const;
2213  virtual void on_canonical_type_set();
2214 
2215 public:
2216 
2217  /// A Hasher for instances of qualified_type_def
2218  struct hash;
2219 
2220  /// Bit field values representing the cv qualifiers of the
2221  /// underlying type.
2222  enum CV
2223  {
2224  CV_NONE = 0,
2225  CV_CONST = 1,
2226  CV_VOLATILE = 1 << 1,
2227  CV_RESTRICT = 1 << 2
2228  };
2229 
2230  qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2231 
2232  qualified_type_def(const environment& env, CV quals, const location& locus);
2233 
2234  virtual size_t
2235  get_size_in_bits() const;
2236 
2237  virtual bool
2238  operator==(const decl_base&) const;
2239 
2240  virtual bool
2241  operator==(const type_base&) const;
2242 
2243  virtual bool
2244  operator==(const qualified_type_def&) const;
2245 
2246  CV
2247  get_cv_quals() const;
2248 
2249  void
2250  set_cv_quals(CV cv_quals);
2251 
2252  string
2254 
2255  type_base_sptr
2256  get_underlying_type() const;
2257 
2258  void
2259  set_underlying_type(const type_base_sptr&);
2260 
2261  virtual void
2262  get_qualified_name(interned_string& qualified_name,
2263  bool internal = false) const;
2264 
2265  virtual const interned_string&
2266  get_qualified_name(bool internal = false) const;
2267 
2268  virtual bool
2270 
2271  virtual ~qualified_type_def();
2272 }; // end class qualified_type_def.
2273 
2274 bool
2275 operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2276 
2277 bool
2278 operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2279 
2282 
2285 
2288 
2291 
2294 
2295 std::ostream&
2296 operator<<(std::ostream&, qualified_type_def::CV);
2297 
2298 string
2300 
2302 get_name_of_qualified_type(const type_base_sptr& underlying_type,
2303  qualified_type_def::CV quals,
2304  bool qualified = true, bool internal = false);
2305 
2306 qualified_type_def_sptr
2307 lookup_qualified_type(const type_base_sptr&,
2309  const translation_unit&);
2310 bool
2312 
2313 /// The abstraction of a pointer type.
2314 class pointer_type_def : public virtual type_base, public virtual decl_base
2315 {
2316  struct priv;
2317  std::unique_ptr<priv> priv_;
2318 
2319  // Forbidden.
2320  pointer_type_def();
2321 
2322 protected:
2323  virtual void on_canonical_type_set();
2324 
2325 public:
2326 
2327  /// A hasher for instances of pointer_type_def
2328  struct hash;
2329 
2330  pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2331  size_t alignment_in_bits, const location& locus);
2332 
2333  pointer_type_def(const environment& env, size_t size_in_bits,
2334  size_t alignment_in_bits, const location& locus);
2335 
2336  void
2337  set_pointed_to_type(const type_base_sptr&);
2338 
2339  virtual bool
2340  operator==(const decl_base&) const;
2341 
2342  virtual bool
2343  operator==(const type_base&) const;
2344 
2345  bool
2346  operator==(const pointer_type_def&) const;
2347 
2348  const type_base_sptr
2349  get_pointed_to_type() const;
2350 
2351  type_base*
2352  get_naked_pointed_to_type() const;
2353 
2354  virtual void
2355  get_qualified_name(interned_string&, bool internal = false) const;
2356 
2357  virtual const interned_string&
2358  get_qualified_name(bool internal = false) const;
2359 
2360  virtual bool
2362 
2363  virtual ~pointer_type_def();
2364 }; // end class pointer_type_def
2365 
2366 bool
2368 
2369 bool
2371 
2372 bool
2374 
2375 
2376 /// Abstracts a reference type.
2377 class reference_type_def : public virtual type_base, public virtual decl_base
2378 {
2379  type_base_wptr pointed_to_type_;
2380  bool is_lvalue_;
2381 
2382  // Forbidden.
2384 
2385 protected:
2386  virtual void on_canonical_type_set();
2387 
2388 public:
2389 
2390  /// Hasher for intances of reference_type_def.
2391  struct hash;
2392 
2393  reference_type_def(const type_base_sptr pointed_to_type,
2394  bool lvalue, size_t size_in_bits,
2395  size_t alignment_in_bits, const location& locus);
2396 
2397  reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2398  size_t alignment_in_bits, const location& locus);
2399 
2400  void
2401  set_pointed_to_type(type_base_sptr& pointed_to_type);
2402 
2403  virtual bool
2404  operator==(const decl_base&) const;
2405 
2406  virtual bool
2407  operator==(const type_base&) const;
2408 
2409  bool
2410  operator==(const reference_type_def&) const;
2411 
2412  type_base_sptr
2413  get_pointed_to_type() const;
2414 
2415  bool
2416  is_lvalue() const;
2417 
2418  virtual void
2419  get_qualified_name(interned_string& qualified_name,
2420  bool internal = false) const;
2421 
2422  virtual const interned_string&
2423  get_qualified_name(bool internal = false) const;
2424 
2425  virtual string
2426  get_pretty_representation(bool internal = false,
2427  bool qualified_name = true) const;
2428 
2429  virtual bool
2431 
2432  virtual ~reference_type_def();
2433 }; // end class reference_type_def
2434 
2435 bool
2437 
2438 bool
2440 
2441 bool
2443 
2444 /// The abstraction of an array type.
2445 class array_type_def : public virtual type_base, public virtual decl_base
2446 {
2447  struct priv;
2448  std::unique_ptr<priv> priv_;
2449 
2450  // Forbidden.
2451  array_type_def();
2452 
2453  void update_size();
2454 
2455 public:
2456 
2457  /// Hasher for intances of array_type_def.
2458  struct hash;
2459 
2460  class subrange_type;
2461 
2462  /// Convenience typedef for a shared pointer on a @ref
2463  /// function_decl::subrange
2464  typedef shared_ptr<subrange_type> subrange_sptr;
2465 
2466  /// Convenience typedef for a vector of @ref subrange_sptr
2467  typedef std::vector<subrange_sptr> subranges_type;
2468 
2469  /// Abstraction for an array range type, like in Ada, or just for an
2470  /// array dimension like in C or C++.
2471  class subrange_type : public virtual type_base, public virtual decl_base
2472  {
2473  struct priv;
2474  std::unique_ptr<priv> priv_;
2475 
2476  // Forbidden.
2477  subrange_type();
2478  public:
2479 
2480  virtual ~subrange_type();
2481  /// This class is to hold the value of the bound of a subrange.
2482  /// The value can be either signed or unsigned, at least when it
2483  /// comes from DWARF. The class keeps the sign information, but
2484  /// allows users to access the value as signed or unsigned as they
2485  /// see fit.
2487  {
2488  public:
2489  enum signedness
2490  {
2491  UNSIGNED_SIGNEDNESS,
2492  SIGNED_SIGNEDNESS
2493  };
2494 
2495  private:
2496  signedness s_;
2497 
2498  public:
2499  union
2500  {
2501  uint64_t unsigned_;
2502  int64_t signed_;
2503  } v_;
2504  bound_value();
2505  bound_value(uint64_t);
2506  bound_value(int64_t);
2507  enum signedness get_signedness() const;
2508  void set_signedness(enum signedness s);
2509  int64_t get_signed_value() const;
2510  uint64_t get_unsigned_value();
2511  void set_unsigned(uint64_t v);
2512  void set_signed(int64_t v);
2513  bool operator==(const bound_value&) const;
2514  }; //end class bound_value
2515 
2516  /// Hasher for an instance of array::subrange
2517  struct hash;
2518 
2519  subrange_type(const environment& env,
2520  const string& name,
2521  bound_value lower_bound,
2522  bound_value upper_bound,
2523  const type_base_sptr& underlying_type,
2524  const location& loc,
2525  translation_unit::language l = translation_unit::LANG_C11);
2526 
2527  subrange_type(const environment& env,
2528  const string& name,
2529  bound_value lower_bound,
2530  bound_value upper_bound,
2531  const location& loc,
2532  translation_unit::language l = translation_unit::LANG_C11);
2533 
2534  subrange_type(const environment& env,
2535  const string& name,
2536  bound_value upper_bound,
2537  const location& loc,
2538  translation_unit::language l = translation_unit::LANG_C11);
2539 
2540  type_base_sptr
2541  get_underlying_type() const;
2542 
2543  void
2544  set_underlying_type(const type_base_sptr &);
2545 
2546  int64_t
2547  get_upper_bound() const;
2548 
2549  int64_t
2550  get_lower_bound() const;
2551 
2552  void
2553  set_upper_bound(int64_t ub);
2554 
2555  void
2556  set_lower_bound(int64_t lb);
2557 
2558  uint64_t
2559  get_length() const;
2560 
2561  bool
2562  is_infinite() const;
2563 
2564  void
2565  is_infinite(bool);
2566 
2568  get_language() const;
2569 
2570  virtual bool
2571  operator==(const decl_base&) const;
2572 
2573  virtual bool
2574  operator==(const type_base&) const;
2575 
2576  bool
2577  operator==(const subrange_type& o) const;
2578 
2579  bool
2580  operator!=(const decl_base& o) const;
2581 
2582  bool
2583  operator!=(const type_base& o) const;
2584 
2585  bool
2586  operator!=(const subrange_type& o) const;
2587 
2588  string
2589  as_string() const;
2590 
2591  static string
2592  vector_as_string(const vector<subrange_sptr>&);
2593 
2594  virtual string
2595  get_pretty_representation(bool internal = false,
2596  bool qualified_name = true) const;
2597 
2598  virtual bool
2600  }; // end class subrange_type
2601 
2602  array_type_def(const type_base_sptr type,
2603  const std::vector<subrange_sptr>& subs,
2604  const location& locus);
2605 
2606  array_type_def(const environment& env,
2607  const std::vector<subrange_sptr>& subs,
2608  const location& locus);
2609 
2611  get_language() const;
2612 
2613  virtual bool
2614  operator==(const decl_base&) const;
2615 
2616  virtual bool
2617  operator==(const type_base&) const;
2618 
2619  virtual void
2620  get_qualified_name(interned_string& qualified_name,
2621  bool internal = false) const;
2622 
2623  virtual const interned_string&
2624  get_qualified_name(bool internal = false) const;
2625 
2626  const type_base_sptr
2627  get_element_type() const;
2628 
2629  void
2630  set_element_type(const type_base_sptr& element_type);
2631 
2632  virtual void
2633  append_subranges(const std::vector<subrange_sptr>& subs);
2634 
2635  virtual int
2636  get_dimension_count() const;
2637 
2638  virtual bool
2639  is_infinite() const;
2640 
2641  virtual string
2642  get_pretty_representation(bool internal = false,
2643  bool qualified_name = true) const;
2644 
2645  virtual string
2646  get_subrange_representation() const;
2647 
2648  virtual bool
2650 
2651  const location&
2652  get_location() const;
2653 
2654  const std::vector<subrange_sptr>&
2655  get_subranges() const;
2656 
2657  virtual ~array_type_def();
2658 
2659 }; // end class array_type_def
2660 
2662 is_subrange_type(const type_or_decl_base *type);
2663 
2666 
2667 bool
2670  change_kind*);
2671 
2672 bool
2674 
2675 /// Abstracts a declaration for an enum type.
2676 class enum_type_decl : public virtual type_base, public virtual decl_base
2677 {
2678  class priv;
2679  std::unique_ptr<priv> priv_;
2680 
2681  // Forbidden
2682  enum_type_decl();
2683 
2684 public:
2685 
2686  /// A hasher for an enum_type_decl.
2687  struct hash;
2688 
2689  /// Enumerator Datum.
2690  class enumerator;
2691 
2692  /// Convenience typedef for a list of @ref enumerator.
2693  typedef std::vector<enumerator> enumerators;
2694 
2695  /// Constructor of an enum type declaration.
2696  ///
2697  /// @param name the name of the enum
2698  ///
2699  /// @param locus the locus at which the enum appears in the source
2700  /// code.
2701  ///
2702  /// @param underlying_type the underlying type of the enum
2703  ///
2704  /// @param enms a list of enumerators for this enum.
2705  ///
2706  /// @param mangled_name the mangled name of the enum type.
2707  ///
2708  /// @param vis the visibility of instances of this type.
2709  enum_type_decl(const string& name,
2710  const location& locus,
2711  type_base_sptr underlying_type,
2712  enumerators& enms,
2713  const string& mangled_name = "",
2714  visibility vis = VISIBILITY_DEFAULT);
2715 
2716  type_base_sptr
2717  get_underlying_type() const;
2718 
2719  const enumerators&
2720  get_enumerators() const;
2721 
2722  enumerators&
2723  get_enumerators();
2724 
2725  virtual string
2726  get_pretty_representation(bool internal = false,
2727  bool qualified_name = true) const;
2728 
2729  virtual bool
2730  operator==(const decl_base&) const;
2731 
2732  virtual bool
2733  operator==(const type_base&) const;
2734 
2735  virtual bool
2737 
2738  virtual ~enum_type_decl();
2739 
2740  friend bool
2742  const enum_type_decl& r,
2743  change_kind* k);
2744 }; // end class enum_type_decl
2745 
2746 bool
2748 
2749 bool
2751 
2752 bool
2754  const enum_type_decl& r,
2755  change_kind* k);
2756 
2757 /// The abstraction of an enumerator
2759 {
2760  class priv;
2761  std::unique_ptr<priv> priv_;
2762 
2763 public:
2764 
2765  enumerator();
2766 
2767  ~enumerator();
2768 
2769  enumerator(const string& name, int64_t value);
2770 
2771  enumerator(const enumerator&);
2772 
2773  enumerator&
2774  operator=(const enumerator&);
2775 
2776  bool
2777  operator==(const enumerator& other) const;
2778 
2779  bool
2780  operator!=(const enumerator& other) const;
2781 
2782  const string&
2783  get_name() const;
2784 
2785  const string&
2786  get_qualified_name(bool internal = false) const;
2787 
2788  void
2789  set_name(const string& n);
2790 
2791  int64_t
2792  get_value() const;
2793 
2794  void
2795  set_value(int64_t v);
2796 
2798  get_enum_type() const;
2799 
2800  void
2802 }; // end class enum_type_def::enumerator
2803 
2804 bool
2805 equals(const typedef_decl&, const typedef_decl&, change_kind*);
2806 
2807 /// The abstraction of a typedef declaration.
2808 class typedef_decl : public virtual type_base, public virtual decl_base
2809 {
2810  struct priv;
2811  std::unique_ptr<priv> priv_;
2812 
2813  // Forbidden
2814  typedef_decl();
2815 
2816 public:
2817 
2818  /// Hasher for the typedef_decl type.
2819  struct hash;
2820 
2821  typedef_decl(const string& name,
2822  const type_base_sptr underlying_type,
2823  const location& locus,
2824  const string& mangled_name = "",
2825  visibility vis = VISIBILITY_DEFAULT);
2826 
2827  typedef_decl(const string& name,
2828  const environment& env,
2829  const location& locus,
2830  const string& mangled_name = "",
2831  visibility vis = VISIBILITY_DEFAULT);
2832 
2833  virtual size_t
2834  get_size_in_bits() const;
2835 
2836  virtual size_t
2837  get_alignment_in_bits() const;
2838 
2839  virtual bool
2840  operator==(const decl_base&) const;
2841 
2842  virtual bool
2843  operator==(const type_base&) const;
2844 
2845  virtual string
2846  get_pretty_representation(bool internal = false,
2847  bool qualified_name = true) const;
2848 
2849  type_base_sptr
2850  get_underlying_type() const;
2851 
2852  void
2853  set_underlying_type(const type_base_sptr&);
2854 
2855  virtual bool
2857 
2858  virtual ~typedef_decl();
2859 };// end class typedef_decl
2860 
2861 /// The abstraction for a data member context relationship. This
2862 /// relates a data member to its parent class.
2863 ///
2864 /// The relationship carries properties like the offset of the data
2865 /// member, if applicable.
2867 {
2868 protected:
2869  struct priv;
2870  std::unique_ptr<priv> priv_;
2871 
2872 public:
2873  dm_context_rel();
2874 
2876  bool is_laid_out,
2877  size_t offset_in_bits,
2878  access_specifier a,
2879  bool is_static);
2880 
2882 
2883  bool
2884  get_is_laid_out() const;
2885 
2886  void
2887  set_is_laid_out(bool f);
2888 
2889  size_t
2890  get_offset_in_bits() const;
2891 
2892  void
2893  set_offset_in_bits(size_t o);
2894 
2895  const var_decl*
2896  get_anonymous_data_member() const;
2897 
2898  void
2900 
2901  bool
2902  operator==(const dm_context_rel& o) const;
2903 
2904  bool
2905  operator!=(const dm_context_rel& o) const;
2906 
2907  virtual ~dm_context_rel();
2908 };// end class class_decl::dm_context_rel
2909 
2910 bool
2911 equals(const var_decl&, const var_decl&, change_kind*);
2912 
2913 bool
2915 
2916 bool
2918 
2919 /// Abstracts a variable declaration.
2920 class var_decl : public virtual decl_base
2921 {
2922  struct priv;
2923  std::unique_ptr<priv> priv_;
2924 
2925  // Forbidden
2926  var_decl();
2927 
2928  virtual void
2929  set_scope(scope_decl*);
2930 
2931 public:
2932 
2933  /// Hasher for a var_decl type.
2934  struct hash;
2935 
2936  /// Equality functor to compare pointers to variable_decl.
2937  struct ptr_equal;
2938 
2939  var_decl(const string& name,
2940  type_base_sptr type,
2941  const location& locus,
2942  const string& mangled_name,
2943  visibility vis = VISIBILITY_DEFAULT,
2944  binding bind = BINDING_NONE);
2945 
2946  virtual bool
2947  operator==(const decl_base&) const;
2948 
2949  const type_base_sptr
2950  get_type() const;
2951 
2952  void
2953  set_type(type_base_sptr&);
2954 
2955  const type_base*
2956  get_naked_type() const;
2957 
2958  binding
2959  get_binding() const;
2960 
2961  void
2962  set_binding(binding b);
2963 
2964  void
2965  set_symbol(const elf_symbol_sptr& sym);
2966 
2967  const elf_symbol_sptr&
2968  get_symbol() const;
2969 
2971  clone() const;
2972 
2974  get_id() const;
2975 
2976  virtual const interned_string&
2977  get_qualified_name(bool internal = false) const;
2978 
2979  virtual size_t
2980  get_hash() const;
2981 
2982  virtual string
2983  get_pretty_representation(bool internal = false,
2984  bool qualified_name = true) const;
2985 
2986  string
2987  get_anon_dm_reliable_name(bool qualified = true) const;
2988 
2989  virtual bool
2991 
2992  virtual ~var_decl();
2993 
2994  friend void
2995  set_data_member_offset(var_decl_sptr m, uint64_t o);
2996 
2997  friend uint64_t
2999 
3000  friend uint64_t
3001  get_data_member_offset(const var_decl& m);
3002 
3003  friend uint64_t
3005 
3006  friend uint64_t
3008 
3009  friend void
3011 
3012  friend bool
3014 
3015  friend bool
3017 }; // end class var_decl
3018 
3019 bool
3020 equals(const function_decl&, const function_decl&, change_kind*);
3021 
3022 /// Abstraction for a function declaration.
3023 class function_decl : public virtual decl_base
3024 {
3025  struct priv;
3026  // This priv pointer is not handled by a shared_ptr because
3027  // accessing the data members of the priv struct for this
3028  // function_decl shows up on performance profiles when dealing with
3029  // big binaries with a lot of types; dereferencing the shared_ptr
3030  // involves locking of some sort and that is slower than just
3031  // dereferencing a pointer likere here. There are other types for
3032  // which the priv pointer is managed using shared_ptr just fine,
3033  // because those didn't show up during our performance profiling.
3034  priv* priv_;
3035 
3036 public:
3037  /// Hasher for function_decl
3038  struct hash;
3039 
3040  /// Equality functor to compare pointers to function_decl
3041  struct ptr_equal;
3042 
3043  /// Abstraction for the parameter of a function.
3044  class parameter;
3045 
3046  /// Convenience typedef for a shared pointer on a @ref
3047  /// function_decl::parameter
3048  typedef shared_ptr<parameter> parameter_sptr;
3049 
3050  /// Convenience typedef for a vector of @ref parameter_sptr
3051  typedef std::vector<parameter_sptr> parameters;
3052 
3053  function_decl(const string& name,
3055  bool declared_inline,
3056  const location& locus,
3057  const string& mangled_name,
3058  visibility vis,
3059  binding bind);
3060 
3061  function_decl(const string& name,
3062  type_base_sptr fn_type,
3063  bool declared_inline,
3064  const location& locus,
3065  const string& mangled_name = "",
3066  visibility vis = VISIBILITY_DEFAULT,
3067  binding bind = BINDING_GLOBAL);
3068 
3069  virtual string
3070  get_pretty_representation(bool internal = false,
3071  bool qualified_name = true) const;
3072 
3073  string
3074  get_pretty_representation_of_declarator (bool internal = false) const;
3075 
3076  const std::vector<parameter_sptr >&
3077  get_parameters() const;
3078 
3079  void
3081 
3082  void
3083  append_parameters(std::vector<parameter_sptr >& parms);
3084 
3085  parameters::const_iterator
3087 
3088  const function_type_sptr
3089  get_type() const;
3090 
3091  const function_type*
3092  get_naked_type() const;
3093 
3094  const type_base_sptr
3095  get_return_type() const;
3096 
3097  void
3098  set_type(const function_type_sptr& fn_type);
3099 
3100  void
3101  set_symbol(const elf_symbol_sptr& sym);
3102 
3103  const elf_symbol_sptr&
3104  get_symbol() const;
3105 
3106  bool
3107  is_declared_inline() const;
3108 
3109  binding
3110  get_binding() const;
3111 
3113  clone() const;
3114 
3115  virtual bool
3116  operator==(const decl_base& o) const;
3117 
3118  /// Return true iff the function takes a variable number of
3119  /// parameters.
3120  ///
3121  /// @return true if the function taks a variable number
3122  /// of parameters.
3123  bool
3124  is_variadic() const;
3125 
3126  virtual size_t
3127  get_hash() const;
3128 
3130  get_id() const;
3131 
3132  virtual bool
3134 
3135  virtual ~function_decl();
3136 }; // end class function_decl
3137 
3138 bool
3140 
3141 bool
3143 
3144 bool
3145 function_decls_alias(const function_decl& f1, const function_decl& f2);
3146 
3147 bool
3149  const function_decl::parameter&,
3150  change_kind*);
3151 
3152 /// A comparison functor to compare pointer to instances of @ref
3153 /// type_or_decl_base.
3155 {
3156  /// Comparison operator for ABI artifacts.
3157  ///
3158  /// @param f the first ABI artifact to consider for the comparison.
3159  ///
3160  /// @param s the second ABI artifact to consider for the comparison.
3161  ///
3162  /// @return true iff @p f is lexicographically less than than @p s.
3163  bool
3165  const type_or_decl_base *s)
3166  {
3167  function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3168  if (f_fn && s_fn)
3169  return function_decl_is_less_than(*f_fn, *s_fn);
3170 
3171  var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3172  if (f_var && s_var)
3173  return get_name(f_var) < get_name(s_var);
3174 
3175  string l_repr = get_pretty_representation(f),
3176  r_repr = get_pretty_representation(s);
3177 
3178  return l_repr < r_repr;
3179  }
3180 
3181  /// Comparison operator for ABI artifacts.
3182  ///
3183  /// @param f the first ABI artifact to consider for the comparison.
3184  ///
3185  /// @param s the second ABI artifact to consider for the comparison.
3186  ///
3187  /// @return true iff @p f is lexicographically less than than @p s.
3188  bool
3190  const type_or_decl_base_sptr& s)
3191  {return operator()(f.get(), s.get());}
3192 }; // end struct type_or_decl_base_comp
3193 
3194 /// Abstraction of a function parameter.
3196 {
3197  struct priv;
3198  std::unique_ptr<priv> priv_;
3199 
3200 public:
3201 
3202  /// Hasher for an instance of function::parameter
3203  struct hash;
3204 
3205  parameter(const type_base_sptr type,
3206  unsigned index,
3207  const string& name,
3208  const location& loc,
3209  bool variadic_marker = false);
3210 
3211  parameter(const type_base_sptr type,
3212  unsigned index,
3213  const string& name,
3214  const location& loc,
3215  bool variadic_marker,
3216  bool is_artificial);
3217 
3218  parameter(const type_base_sptr type,
3219  const string& name,
3220  const location& loc,
3221  bool variadic_marker = false,
3222  bool is_artificial = false);
3223 
3224  parameter(const type_base_sptr type,
3225  unsigned index = 0,
3226  bool variadic_marker = false);
3227 
3228  virtual ~parameter();
3229 
3230  const type_base_sptr
3231  get_type()const;
3232 
3234  get_type_name() const;
3235 
3236  const string
3238 
3240  get_name_id() const;
3241 
3242  unsigned
3243  get_index() const;
3244 
3245  void
3246  set_index(unsigned i);
3247 
3248  bool
3249  get_variadic_marker() const;
3250 
3251  bool
3252  operator==(const parameter& o) const;
3253 
3254  virtual bool
3255  operator==(const decl_base&) const;
3256 
3257  virtual bool
3259 
3260  virtual size_t
3261  get_hash() const;
3262 
3263  virtual void
3264  get_qualified_name(interned_string& qualified_name,
3265  bool internal = false) const;
3266 
3267  virtual string
3268  get_pretty_representation(bool internal = false,
3269  bool qualified_name = true) const;
3270 }; // end class function_decl::parameter
3271 
3272 bool
3275 
3276 /// A hashing functor for a function_decl::parameter.
3278 {
3279  size_t
3280  operator()(const function_decl::parameter&) const;
3281 
3282  size_t
3283  operator()(const function_decl::parameter*) const;
3284 
3285  size_t
3286  operator()(const function_decl::parameter_sptr) const;
3287 }; // end struct function_decl::parameter::hash
3288 
3291 
3294 
3295 bool
3296 equals(const function_type&, const function_type&, change_kind*);
3297 
3298 /// Abstraction of a function type.
3299 class function_type : public virtual type_base
3300 {
3301 protected:
3302  virtual void on_canonical_type_set();
3303 
3304 public:
3305  /// Hasher for an instance of function_type
3306  struct hash;
3307 
3308  /// Convenience typedef for a shared pointer on a @ref
3309  /// function_decl::parameter
3310  typedef shared_ptr<function_decl::parameter> parameter_sptr;
3311  /// Convenience typedef for a vector of @ref parameter_sptr
3312  typedef std::vector<parameter_sptr> parameters;
3313 
3314  struct priv;
3315  std::unique_ptr<priv> priv_;
3316 
3317 private:
3318  function_type();
3319 
3320 public:
3321 
3322  function_type(type_base_sptr return_type,
3323  const parameters& parms,
3324  size_t size_in_bits,
3325  size_t alignment_in_bits);
3326 
3327  function_type(type_base_sptr return_type,
3328  size_t size_in_bits,
3329  size_t alignment_in_bits);
3330 
3331  function_type(const environment& env,
3332  size_t size_in_bits,
3333  size_t alignment_in_bits);
3334 
3335  type_base_sptr
3336  get_return_type() const;
3337 
3338  void
3339  set_return_type(type_base_sptr t);
3340 
3341  const parameters&
3342  get_parameters() const;
3343 
3344  const parameter_sptr
3346 
3347  void
3348  set_parameters(const parameters &p);
3349 
3350  void
3352 
3353  bool
3354  is_variadic() const;
3355 
3356  parameters::const_iterator
3358 
3359  parameters::const_iterator
3360  get_first_parm() const;
3361 
3362  const interned_string&
3363  get_cached_name(bool internal = false) const;
3364 
3365  virtual bool
3366  operator==(const type_base&) const;
3367 
3368  virtual string
3369  get_pretty_representation(bool internal = false,
3370  bool qualified_name = true) const;
3371 
3372  virtual bool
3374 
3375  virtual ~function_type();
3376 
3377  friend bool
3378  equals(const function_type&, const function_type&, change_kind*);
3379 };//end class function_type
3380 
3381 /// The hashing functor for @ref function_type.
3383 {
3384  size_t
3385  operator()(const function_type& t) const;
3386 
3387  size_t
3388  operator()(const function_type* t) const;
3389 
3390  size_t
3391  operator()(const function_type_sptr t) const;
3392 };// end struct function_type::hash
3393 
3394 /// Abstracts the type of a class member function.
3396 {
3397  struct priv;
3398  std::unique_ptr<priv> priv_;
3399 
3400  method_type();
3401 
3402 public:
3403 
3404  /// Hasher for intances of method_type
3405  struct hash;
3406 
3407  method_type(type_base_sptr return_type,
3408  class_or_union_sptr class_type,
3409  const std::vector<function_decl::parameter_sptr>& parms,
3410  bool is_const,
3411  size_t size_in_bits,
3412  size_t alignment_in_bits);
3413 
3414  method_type(type_base_sptr return_type,
3415  type_base_sptr class_type,
3416  const std::vector<function_decl::parameter_sptr>& parms,
3417  bool is_const,
3418  size_t size_in_bits,
3419  size_t alignment_in_bits);
3420 
3421  method_type(class_or_union_sptr class_type,
3422  bool is_const,
3423  size_t size_in_bits,
3424  size_t alignment_in_bits);
3425 
3426  method_type(const environment& env,
3427  size_t size_in_bits,
3428  size_t alignment_in_bits);
3429 
3430  class_or_union_sptr
3431  get_class_type() const;
3432 
3433  void
3434  set_class_type(const class_or_union_sptr& t);
3435 
3436  void set_is_const(bool);
3437 
3438  bool get_is_const() const;
3439 
3440  virtual ~method_type();
3441 
3442  virtual string
3443  get_pretty_representation(bool internal = false,
3444  bool qualified_name = true) const;
3445 
3446  friend interned_string
3447  get_method_type_name(const method_type& fn_type, bool internal);
3448 };// end class method_type.
3449 
3450 /// The base class of templates.
3451 class template_decl : public virtual decl_base
3452 {
3453  class priv;
3454  std::unique_ptr<priv> priv_;
3455 
3456  template_decl();
3457 
3458 public:
3459 
3460  /// Hasher.
3461  struct hash;
3462 
3463  template_decl(const environment& env,
3464  const string& name,
3465  const location& locus,
3466  visibility vis = VISIBILITY_DEFAULT);
3467 
3468  void
3470 
3471  const std::list<template_parameter_sptr>&
3472  get_template_parameters() const;
3473 
3474  virtual bool
3475  operator==(const decl_base& o) const;
3476 
3477  virtual bool
3478  operator==(const template_decl& o) const;
3479 
3480  virtual ~template_decl();
3481 };//end class template_decl
3482 
3483 /// Base class for a template parameter. Client code should use the
3484 /// more specialized type_template_parameter,
3485 /// non_type_template_parameter and template_template_parameter below.
3487 {
3488  class priv;
3489  std::unique_ptr<priv> priv_;
3490 
3491  // Forbidden
3493 
3494  public:
3495 
3496  /// Hashers.
3497  struct hash;
3498  struct dynamic_hash;
3499  struct shared_ptr_hash;
3500 
3501  template_parameter(unsigned index,
3502  template_decl_sptr enclosing_tdecl);
3503 
3504  virtual bool
3505  operator==(const template_parameter&) const;
3506 
3507  bool
3508  operator!=(const template_parameter&) const;
3509 
3510  unsigned
3511  get_index() const;
3512 
3513  const template_decl_sptr
3514  get_enclosing_template_decl() const;
3515 
3516  bool
3517  get_hashing_has_started() const;
3518 
3519  void
3520  set_hashing_has_started(bool f) const;
3521 
3522  virtual ~template_parameter();
3523 };//end class template_parameter
3524 
3526 {
3527  size_t
3528  operator()(const template_decl& t) const;
3529 };// end struct template_decl::hash
3530 
3531 /// Abstracts a type template parameter.
3532 class type_tparameter : public template_parameter, public virtual type_decl
3533 {
3534  class priv;
3535  std::unique_ptr<priv> priv_;
3536 
3537  // Forbidden
3538  type_tparameter();
3539 
3540 public:
3541 
3542  /// Hasher.
3543  struct hash;
3544 
3545  type_tparameter(unsigned index,
3546  template_decl_sptr enclosing_tdecl,
3547  const string& name,
3548  const location& locus);
3549 
3550  virtual bool
3551  operator==(const type_base&) const;
3552 
3553  virtual bool
3554  operator==(const type_decl&) const;
3555 
3556  virtual bool
3557  operator==(const decl_base&) const;
3558 
3559  virtual bool
3560  operator==(const template_parameter&) const;
3561 
3562  virtual bool
3563  operator==(const type_tparameter&) const;
3564 
3565  virtual ~type_tparameter();
3566 };// end class type_tparameter.
3567 
3568 /// Abstracts non type template parameters.
3569 class non_type_tparameter : public template_parameter, public virtual decl_base
3570 {
3571  class priv;
3572  std::unique_ptr<priv> priv_;
3573 
3574  type_base_wptr type_;
3575 
3576  // Forbidden
3578 
3579 public:
3580  /// Hasher.
3581  struct hash;
3582 
3583  non_type_tparameter(unsigned index,
3584  template_decl_sptr enclosing_tdecl,
3585  const string& name,
3586  type_base_sptr type,
3587  const location& locus);
3588  virtual size_t
3589  get_hash() const;
3590 
3591  virtual bool
3592  operator==(const decl_base&) const;
3593 
3594  virtual bool
3595  operator==(const template_parameter&) const;
3596 
3597  const type_base_sptr
3598  get_type() const;
3599 
3600  virtual ~non_type_tparameter();
3601 };// end class non_type_tparameter
3602 
3603 /// Hasher for the @ref non_type_tparameter type.
3605 {
3606  size_t
3607  operator()(const non_type_tparameter& t) const;
3608 
3609  size_t
3610  operator()(const non_type_tparameter* t) const;
3611 };
3612 
3613 class template_tparameter;
3614 
3615 /// Abstracts a template template parameter.
3617 {
3618  class priv;
3619  std::unique_ptr<priv> priv_;
3620 
3621  // Forbidden
3623 
3624 public:
3625 
3626  /// A hasher for instances of template_tparameter
3627  struct hash;
3628 
3629  template_tparameter(unsigned index,
3630  template_decl_sptr enclosing_tdecl,
3631  const string& name,
3632  const location& locus);
3633 
3634  virtual bool
3635  operator==(const type_base&) const;
3636 
3637  virtual bool
3638  operator==(const decl_base&) const;
3639 
3640  virtual bool
3641  operator==(const template_parameter&) const;
3642 
3643  virtual bool
3644  operator==(const template_decl&) const;
3645 
3646  virtual ~template_tparameter();
3647 };
3648 
3649 /// This abstracts a composition of types based on template type
3650 /// parameters. The result of the composition is a type that can be
3651 /// referred to by a template non-type parameter. Instances of this
3652 /// type can appear at the same level as template parameters, in the
3653 /// scope of a template_decl.
3654 class type_composition : public template_parameter, public virtual decl_base
3655 {
3656  class priv;
3657  std::unique_ptr<priv> priv_;
3658 
3659  type_composition();
3660 
3661 public:
3662  struct hash;
3663 
3664  type_composition(unsigned index,
3665  template_decl_sptr tdecl,
3666  type_base_sptr composed_type);
3667 
3668  const type_base_sptr
3669  get_composed_type() const;
3670 
3671  void
3672  set_composed_type(type_base_sptr t);
3673 
3674  virtual size_t
3675  get_hash() const;
3676 
3677  virtual ~type_composition();
3678 };
3679 
3680 /// Hasher for the @ref type_composition type.
3682 {
3683  size_t
3684  operator()(const type_composition& t) const;
3685 
3686  size_t
3687  operator()(const type_composition* t) const;
3688 
3689 }; //struct type_composition::hash
3690 
3691 /// Abstract a function template declaration.
3693 {
3694  class priv;
3695  std::unique_ptr<priv> priv_;
3696 
3697  // Forbidden
3698  function_tdecl();
3699 
3700 public:
3701 
3702  /// Hash functor for function templates.
3703  struct hash;
3704  struct shared_ptr_hash;
3705 
3706  function_tdecl(const environment& env,
3707  const location& locus,
3708  visibility vis = VISIBILITY_DEFAULT,
3709  binding bind = BINDING_NONE);
3710 
3712  const location& locus,
3713  visibility vis = VISIBILITY_DEFAULT,
3714  binding bind = BINDING_NONE);
3715 
3716  virtual bool
3717  operator==(const decl_base&) const;
3718 
3719  virtual bool
3720  operator==(const template_decl&) const;
3721 
3722  virtual bool
3723  operator==(const function_tdecl&) const;
3724 
3725  void
3726  set_pattern(shared_ptr<function_decl> p);
3727 
3728  shared_ptr<function_decl>
3729  get_pattern() const;
3730 
3731  binding
3732  get_binding() const;
3733 
3734  virtual bool
3736 
3737  virtual ~function_tdecl();
3738 }; // end class function_tdecl.
3739 
3740 /// Abstract a class template.
3741 class class_tdecl : public template_decl, public scope_decl
3742 {
3743  class priv;
3744  std::unique_ptr<priv> priv_;
3745 
3746  // Forbidden
3747  class_tdecl();
3748 
3749 public:
3750 
3751  /// Hashers.
3752  struct hash;
3753  struct shared_ptr_hash;
3754 
3755  class_tdecl(const environment& env, const location& locus,
3756  visibility vis = VISIBILITY_DEFAULT);
3757 
3758  class_tdecl(class_decl_sptr pattern,
3759  const location& locus,
3760  visibility vis = VISIBILITY_DEFAULT);
3761 
3762  virtual bool
3763  operator==(const decl_base&) const;
3764 
3765  virtual bool
3766  operator==(const template_decl&) const;
3767 
3768  virtual bool
3769  operator==(const class_tdecl&) const;
3770 
3771  void
3773 
3774  shared_ptr<class_decl>
3775  get_pattern() const;
3776 
3777  virtual bool
3779 
3780  virtual ~class_tdecl();
3781 };// end class class_tdecl
3782 
3783 /// The base class for member types, data members and member
3784 /// functions. Its purpose is mainly to carry the access specifier
3785 /// (and possibly other properties that might be shared by all class
3786 /// members) for the member.
3788 {
3789 protected:
3790  enum access_specifier access_;
3791  bool is_static_;
3792 
3793 private:
3794  // Forbidden
3795  member_base();
3796 
3797 public:
3798  /// Hasher.
3799  struct hash;
3800 
3801  member_base(access_specifier a, bool is_static = false)
3802  : access_(a), is_static_(is_static)
3803  {}
3804 
3805  /// Getter for the access specifier of this member.
3806  ///
3807  /// @return the access specifier for this member.
3810  {return access_;}
3811 
3812  /// Setter for the access specifier of this member.
3813  ///
3814  /// @param a the new access specifier.
3815  void
3817  {access_ = a;}
3818 
3819  /// @return true if the member is static, false otherwise.
3820  bool
3822  {return is_static_;}
3823 
3824  /// Set a flag saying if the parameter is static or not.
3825  ///
3826  /// @param f set to true if the member is static, false otherwise.
3827  void
3829  {is_static_ = f;}
3830 
3831  virtual bool
3832  operator==(const member_base& o) const;
3833 };// end class member_base
3834 
3835 /// Abstraction of the declaration of a method.
3837 {
3838  method_decl();
3839 
3840  virtual void
3841  set_scope(scope_decl*);
3842 
3843 public:
3844 
3845  method_decl(const string& name, method_type_sptr type,
3846  bool declared_inline, const location& locus,
3847  const string& mangled_name = "",
3848  visibility vis = VISIBILITY_DEFAULT,
3849  binding bind = BINDING_GLOBAL);
3850 
3851  method_decl(const string& name,
3852  function_type_sptr type,
3853  bool declared_inline,
3854  const location& locus,
3855  const string& mangled_name = "",
3856  visibility vis = VISIBILITY_DEFAULT,
3857  binding bind = BINDING_GLOBAL);
3858 
3859  method_decl(const string& name, type_base_sptr type,
3860  bool declared_inline, const location& locus,
3861  const string& mangled_name = "",
3862  visibility vis = VISIBILITY_DEFAULT,
3863  binding bind = BINDING_GLOBAL);
3864 
3865  virtual void
3866  set_linkage_name(const string&);
3867 
3868  /// @return the type of the current instance of the
3869  /// method_decl.
3870  const method_type_sptr
3871  get_type() const;
3872 
3873  void
3874  set_type(const method_type_sptr fn_type)
3875  {function_decl::set_type(fn_type);}
3876 
3877  friend bool
3879 
3880  friend void
3882 
3883  friend void
3885 
3886  friend bool
3888 
3889  friend void
3891 
3892  friend void
3894 
3895  friend bool
3896  get_member_function_is_static(const function_decl&);
3897 
3898  friend void
3899  set_member_function_is_static(const function_decl&, bool);
3900 
3901  friend bool
3903 
3904  friend void
3906 
3907  friend void
3909 
3910  friend bool
3912 
3913  friend ssize_t
3915 
3916  friend void
3918 
3919  friend void
3921 
3922  friend bool
3924 
3925  friend void
3927 
3928  virtual ~method_decl();
3929 };// end class method_decl
3930 
3931 bool
3932 operator==(const method_decl_sptr& l, const method_decl_sptr& r);
3933 
3934 bool
3935 operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
3936 
3937 /// The base type of @ref class_decl and @ref union_decl
3939 {
3940 public:
3941  struct priv;
3942  priv *priv_;
3943 
3944 private:
3945  // Forbidden
3946  class_or_union();
3947 
3948 protected:
3949 
3950  virtual decl_base_sptr
3951  add_member_decl(const decl_base_sptr&);
3952 
3953  decl_base_sptr
3954  insert_member_decl(decl_base_sptr member);
3955 
3956  virtual void
3957  remove_member_decl(decl_base_sptr);
3958 
3959  void
3961 
3962 public:
3963  /// Hasher.
3964  struct hash;
3965 
3966  /// Convenience typedef
3967  /// @{
3968  typedef vector<type_base_sptr> member_types;
3969  typedef vector<var_decl_sptr> data_members;
3970  typedef vector<method_decl_sptr> member_functions;
3971  typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
3972  typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
3973  typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
3974  /// @}
3975 
3976  class_or_union(const environment& env, const string& name,
3977  size_t size_in_bits, size_t align_in_bits,
3978  const location& locus, visibility vis,
3979  member_types& mbrs, data_members& data_mbrs,
3980  member_functions& member_fns);
3981 
3982  class_or_union(const environment& env, const string& name,
3983  size_t size_in_bits, size_t align_in_bits,
3984  const location& locus, visibility vis);
3985 
3986  class_or_union(const environment& env, const string& name,
3987  bool is_declaration_only = true);
3988 
3989  virtual void
3990  set_size_in_bits(size_t);
3991 
3992  virtual size_t
3993  get_size_in_bits() const;
3994 
3995  virtual size_t
3996  get_alignment_in_bits() const;
3997 
3998  virtual void
3999  set_alignment_in_bits(size_t);
4000 
4001  virtual size_t
4003 
4004  virtual size_t
4006 
4007  virtual size_t
4009 
4010  void
4012  bool is_laid_out, bool is_static,
4013  size_t offset_in_bits);
4014 
4015  const data_members&
4016  get_data_members() const;
4017 
4018  const var_decl_sptr
4019  find_data_member(const string&) const;
4020 
4021  const var_decl_sptr
4022  find_data_member(const var_decl_sptr&) const;
4023 
4024  const var_decl_sptr
4026 
4027  const data_members&
4029 
4030  void
4031  add_member_function(method_decl_sptr f,
4032  access_specifier a,
4033  bool is_static, bool is_ctor,
4034  bool is_dtor, bool is_const);
4035 
4036  void
4037  add_member_function(method_decl_sptr f,
4038  access_specifier a,
4039  bool is_virtual,
4040  size_t vtable_offset,
4041  bool is_static, bool is_ctor,
4042  bool is_dtor, bool is_const);
4043 
4044  const member_functions&
4045  get_member_functions() const;
4046 
4047  const method_decl*
4048  find_member_function(const string& mangled_name) const;
4049 
4050  method_decl*
4051  find_member_function(const string& mangled_name);
4052 
4053  method_decl_sptr
4054  find_member_function_sptr(const string& mangled_name);
4055 
4056  const method_decl*
4057  find_member_function_from_signature(const string& s) const;
4058 
4059  method_decl*
4060  find_member_function_from_signature(const string& s);
4061 
4062  void
4063  add_member_function_template(member_function_template_sptr);
4064 
4065  const member_function_templates&
4067 
4068  void
4069  add_member_class_template(member_class_template_sptr m);
4070 
4071  const member_class_templates&
4073 
4074  bool
4075  has_no_member() const;
4076 
4077  virtual bool
4078  operator==(const decl_base&) const;
4079 
4080  virtual bool
4081  operator==(const type_base&) const;
4082 
4083  virtual bool
4084  operator==(const class_or_union&) const;
4085 
4086  virtual bool
4088 
4089  virtual ~class_or_union();
4090 
4091  friend method_decl_sptr
4092  copy_member_function(class_or_union_sptr& t,
4093  const method_decl*m);
4094 
4095  friend method_decl_sptr
4096  copy_member_function(class_or_union_sptr& t,
4097  const method_decl_sptr& m);
4098 
4099  friend void
4100  fixup_virtual_member_function(method_decl_sptr method);
4101 
4102  friend void
4103  set_member_is_static(decl_base& d, bool s);
4104 
4105  friend bool
4106  equals(const class_or_union&, const class_or_union&, change_kind*);
4107 
4108  friend bool
4109  equals(const class_decl&, const class_decl&, change_kind*);
4110 
4111  friend class method_decl;
4112  friend class class_decl;
4113 }; // end class class_or_union
4114 
4115 method_decl_sptr
4116 copy_member_function(const class_or_union_sptr& clazz,
4117  const method_decl_sptr& f);
4118 
4119 method_decl_sptr
4120 copy_member_function(const class_or_union_sptr& clazz,
4121  const method_decl* f);
4122 
4123 bool
4124 operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4125 
4126 bool
4127 operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4128 
4129 /// Hasher for the @ref class_or_union type
4131 {
4132  size_t
4133  operator()(const class_or_union& t) const;
4134 
4135  size_t
4136  operator()(const class_or_union* t) const;
4137 }; // end struct class_decl::hash
4138 
4139 /// Abstracts a class declaration.
4141 {
4142  // Forbidden
4143  class_decl();
4144 
4145 protected:
4146 
4147  decl_base_sptr
4148  insert_member_decl(decl_base_sptr member);
4149 
4150 public:
4151  /// Hasher.
4152  struct hash;
4153 
4154  /// Forward declarations.
4155  class base_spec;
4156 
4157  /// Convenience typedef
4158  /// @{
4159  typedef shared_ptr<base_spec> base_spec_sptr;
4160  typedef vector<base_spec_sptr> base_specs;
4161 
4162  /// @}
4163 
4164 protected:
4165  virtual void
4167 
4168 private:
4169  struct priv;
4170  // This priv it's not handled by a shared_ptr because accessing the
4171  // data members of the priv struct for this class_decl shows up on
4172  // performance profiles when dealing with big binaries with a lot of
4173  // types; dereferencing the shared_ptr involves locking of some sort
4174  // and that is slower than just dereferencing a pointer likere here.
4175  // There are other types for which the priv pointer is managed using
4176  // shared_ptr just fine, because those didn't show up during our
4177  // performance profiling.
4178  priv * priv_;
4179 
4180 public:
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,
4185  visibility vis, base_specs& bases,
4186  member_types& mbrs, data_members& data_mbrs,
4187  member_functions& member_fns);
4188 
4189  class_decl(const environment& env, const string& name,
4190  size_t size_in_bits, size_t align_in_bits,
4191  bool is_struct, const location& locus,
4192  visibility vis, base_specs& bases,
4193  member_types& mbrs, data_members& data_mbrs,
4194  member_functions& member_fns, bool is_anonymous);
4195 
4196  class_decl(const environment& env, const string& name,
4197  size_t size_in_bits, size_t align_in_bits,
4198  bool is_struct, const location& locus, visibility vis);
4199 
4200  class_decl(const environment& env, const string& name,
4201  size_t size_in_bits, size_t align_in_bits,
4202  bool is_struct, const location& locus,
4203  visibility vis, bool is_anonymous);
4204 
4205  class_decl(const environment& env, const string& name, bool is_struct,
4206  bool is_declaration_only = true);
4207 
4208  virtual string
4209  get_pretty_representation(bool internal = false,
4210  bool qualified_name = true) const;
4211 
4212  void
4213  is_struct(bool f);
4214 
4215  bool
4216  is_struct() const;
4217 
4218  void
4219  add_base_specifier(shared_ptr<base_spec> b);
4220 
4221  const base_specs&
4222  get_base_specifiers() const;
4223 
4225  find_base_class(const string&) const;
4226 
4227  const member_functions&
4228  get_virtual_mem_fns() const;
4229 
4231  get_virtual_mem_fns_map() const;
4232 
4233  void
4235 
4236  bool
4237  has_no_base_nor_member() const;
4238 
4239  bool
4241 
4242  bool
4243  has_virtual_bases() const;
4244 
4245  bool
4246  has_vtable() const;
4247 
4248  ssize_t
4249  get_biggest_vtable_offset() const;
4250 
4251  virtual size_t
4252  get_hash() const;
4253 
4254  virtual bool
4255  operator==(const decl_base&) const;
4256 
4257  virtual bool
4258  operator==(const type_base&) const;
4259 
4260  virtual bool
4261  operator==(const class_or_union&) const;
4262 
4263  virtual bool
4264  operator==(const class_decl&) const;
4265 
4266  virtual bool
4268 
4269  virtual ~class_decl();
4270 
4271  friend void
4272  fixup_virtual_member_function(method_decl_sptr method);
4273 
4274  friend void
4275  set_member_is_static(decl_base& d, bool s);
4276 
4277  friend bool
4278  equals(const class_decl&, const class_decl&, change_kind*);
4279 
4280  friend class method_decl;
4281  friend class class_or_union;
4282 };// end class class_decl
4283 
4284 bool
4285 equals(const class_decl&, const class_decl&, change_kind*);
4286 
4287 method_decl_sptr
4289  const method_decl_sptr& f);
4290 
4291 method_decl_sptr
4293  const method_decl* f);
4294 void
4295 fixup_virtual_member_function(method_decl_sptr method);
4296 
4297 /// Hasher for the @ref class_decl type
4299 {
4300  size_t
4301  operator()(const class_decl& t) const;
4302 
4303  size_t
4304  operator()(const class_decl* t) const;
4305 }; // end struct class_decl::hash
4306 
4307 enum access_specifier
4309 
4310 enum access_specifier
4311 get_member_access_specifier(const decl_base_sptr&);
4312 
4313 void
4316 
4317 void
4318 set_member_access_specifier(const decl_base_sptr&,
4320 
4321 std::ostream&
4322 operator<<(std::ostream&, access_specifier);
4323 
4324 bool
4325 operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4326 
4327 bool
4328 operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4329 
4330 bool
4332  const class_decl::base_spec&,
4333  change_kind*);
4334 
4335 /// Abstraction of a base specifier in a class declaration.
4337  public virtual decl_base
4338 {
4339  struct priv;
4340  std::unique_ptr<priv> priv_;
4341 
4342  // Forbidden
4343  base_spec();
4344 
4345 public:
4346 
4347  /// Hasher.
4348  struct hash;
4349 
4351  long offset_in_bits = -1, bool is_virtual = false);
4352 
4353  base_spec(const type_base_sptr& base, access_specifier a,
4354  long offset_in_bits = -1, bool is_virtual = false);
4355 
4356  virtual ~base_spec();
4357 
4359  get_base_class() const;
4360 
4361  bool
4362  get_is_virtual() const;
4363 
4364  long
4365  get_offset_in_bits() const;
4366 
4367  virtual bool
4368  operator==(const decl_base&) const;
4369 
4370  virtual bool
4371  operator==(const member_base&) const;
4372 
4373  virtual size_t
4374  get_hash() const;
4375 
4376  virtual bool
4378 };// end class class_decl::base_spec
4379 
4380 bool
4382  const class_decl::base_spec_sptr& r);
4383 
4384 bool
4386  const class_decl::base_spec_sptr& r);
4387 
4390 
4393 
4394 /// Abstracts a union type declaration.
4396 {
4397  // Forbid
4398  union_decl();
4399 
4400 public:
4401 
4402  union_decl(const environment& env, const string& name,
4403  size_t size_in_bits, const location& locus,
4404  visibility vis, member_types& mbrs,
4405  data_members& data_mbrs, member_functions& member_fns);
4406 
4407  union_decl(const environment& env, const string& name,
4408  size_t size_in_bits, const location& locus,
4409  visibility vis, member_types& mbrs,
4410  data_members& data_mbrs, member_functions& member_fns,
4411  bool is_anonymous);
4412 
4413  union_decl(const environment& env, const string& name,
4414  size_t size_in_bits, const location& locus,
4415  visibility vis);
4416 
4417  union_decl(const environment& env, const string& name,
4418  size_t size_in_bits, const location& locus,
4419  visibility vis, bool is_anonymous);
4420 
4421  union_decl(const environment& env, const string& name,
4422  bool is_declaration_only = true);
4423 
4424  virtual string
4425  get_pretty_representation(bool internal = false,
4426  bool qualified_name = true) const;
4427 
4428  virtual bool
4429  operator==(const decl_base&) const;
4430 
4431  virtual bool
4432  operator==(const type_base&) const;
4433 
4434  virtual bool
4435  operator==(const class_or_union&) const;
4436 
4437  virtual bool
4438  operator==(const union_decl&) const;
4439 
4440  virtual bool
4442 
4443  virtual ~union_decl();
4444 }; // union_decl
4445 
4446 bool
4447 equals(const union_decl&, const union_decl&, change_kind*);
4448 
4449 method_decl_sptr
4450 copy_member_function(const union_decl_sptr& union_type,
4451  const method_decl_sptr& f);
4452 
4453 method_decl_sptr
4454 copy_member_function(const union_decl_sptr& union_type,
4455  const method_decl* f);
4456 
4457 bool
4458 operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4459 
4460 bool
4461 operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4462 
4463 /// Abstraction of a member function context relationship. This
4464 /// relates a member function to its parent class.
4466 {
4467 protected:
4468  bool is_virtual_;
4469  ssize_t vtable_offset_in_bits_;
4470  bool is_constructor_;
4471  bool is_destructor_;
4472  bool is_const_;
4473 
4474 public:
4476  : context_rel(),
4477  is_virtual_(false),
4478  vtable_offset_in_bits_(-1),
4479  is_constructor_(false),
4480  is_destructor_(false),
4481  is_const_(false)
4482  {}
4483 
4485  : context_rel(s),
4486  is_virtual_(false),
4487  vtable_offset_in_bits_(-1),
4488  is_constructor_(false),
4489  is_destructor_(false),
4490  is_const_(false)
4491  {}
4492 
4494  bool is_constructor,
4495  bool is_destructor,
4496  bool is_const,
4497  bool is_virtual,
4498  size_t vtable_offset_in_bits,
4499  access_specifier access,
4500  bool is_static)
4501  : context_rel(s, access, is_static),
4502  is_virtual_(is_virtual),
4503  vtable_offset_in_bits_(vtable_offset_in_bits),
4504  is_constructor_(is_constructor),
4505  is_destructor_(is_destructor),
4506  is_const_(is_const)
4507  {}
4508 
4509  bool
4510  is_virtual() const
4511  {return is_virtual_;}
4512 
4513  void
4514  is_virtual(bool is_virtual)
4515  {is_virtual_ = is_virtual;}
4516 
4517  /// Getter for the vtable offset property.
4518  ///
4519  /// This is the vtable offset of the member function of this
4520  /// relation.
4521  ///
4522  /// @return the vtable offset property of the relation.
4523  size_t
4525  {return vtable_offset_in_bits_;}
4526 
4527  /// Setter for the vtable offset property.
4528  ///
4529  /// This is the vtable offset of the member function of this
4530  /// relation.
4531  ///
4532  /// @partam s the new vtable offset.
4533  void
4534  vtable_offset(size_t s)
4535  {vtable_offset_in_bits_ = s;}
4536 
4537  /// Getter for the 'is-constructor' property.
4538  ///
4539  /// This tells if the member function of this relation is a
4540  /// constructor.
4541  ///
4542  /// @return the is-constructor property of the relation.
4543  bool
4545  {return is_constructor_;}
4546 
4547  /// Setter for the 'is-constructor' property.
4548  ///
4549  /// @param f the new value of the the property. Is true if this is
4550  /// for a constructor, false otherwise.
4551  void
4553  {is_constructor_ = f;}
4554 
4555  /// Getter for the 'is-destructor' property.
4556  ///
4557  /// Tells if the member function of this relation is a destructor.
4558  ///
4559  /// @return the is-destructor property of the relation;
4560  bool
4562  {return is_destructor_;}
4563 
4564  /// Setter for the 'is-destructor' property.
4565  ///
4566  /// @param f the new value of the property. Is true if this is for
4567  /// a destructor, false otherwise.
4568  void
4570  {is_destructor_ = f;}
4571 
4572  /// Getter for the 'is-const' property.
4573  ///
4574  /// Tells if the member function of this relation is a const member
4575  /// function.
4576  ///
4577  /// @return the 'is-const' property of the relation.
4578  bool
4579  is_const() const
4580  {return is_const_;}
4581 
4582  /// Setter for the 'is-const' property.
4583  ///
4584  /// @param f the new value of the property. Is true if this is for
4585  /// a const entity, false otherwise.
4586  void
4587  is_const(bool f)
4588  {is_const_ = f;}
4589 
4590  virtual ~mem_fn_context_rel();
4591 }; // end class mem_fn_context_rel
4592 
4593 method_decl*
4595 
4596 method_decl*
4598 
4599 method_decl_sptr
4601 
4602 const var_decl*
4603 lookup_data_member(const type_base* type,
4604  const char* dm_name);
4605 
4608  unsigned parm_num);
4609 
4610 /// Abstract a member function template.
4611 class member_function_template : public member_base, public virtual decl_base
4612 {
4613  bool is_constructor_;
4614  bool is_const_;
4615  shared_ptr<function_tdecl> fn_tmpl_;
4616 
4617  // Forbiden
4619 
4620 public:
4621  /// Hasher.
4622  struct hash;
4623 
4625  access_specifier access, bool is_static,
4626  bool is_constructor, bool is_const)
4627  : type_or_decl_base(f->get_environment()),
4628  decl_base(f->get_environment(), f->get_name(), location()),
4629  member_base(access, is_static), is_constructor_(is_constructor),
4630  is_const_(is_const), fn_tmpl_(f)
4631  {}
4632 
4633  bool
4634  is_constructor() const
4635  {return is_constructor_;}
4636 
4637  bool
4638  is_const() const
4639  {return is_const_;}
4640 
4641  operator const function_tdecl& () const
4642  {return *fn_tmpl_;}
4643 
4645  as_function_tdecl() const
4646  {return fn_tmpl_;}
4647 
4648  virtual bool
4649  operator==(const member_base& o) const;
4650 
4651  virtual bool
4653 };// end class member_function_template
4654 
4655 bool
4656 operator==(const member_function_template_sptr& l,
4657  const member_function_template_sptr& r);
4658 
4659 bool
4660 operator!=(const member_function_template_sptr& l,
4661  const member_function_template_sptr& r);
4662 
4663 /// Abstracts a member class template template
4665  : public member_base,
4666  public virtual decl_base
4667 {
4668  shared_ptr<class_tdecl> class_tmpl_;
4669 
4670  // Forbidden
4672 
4673 public:
4674 
4675  /// Hasher.
4676  struct hash;
4677 
4679  access_specifier access, bool is_static)
4680  : type_or_decl_base(c->get_environment()),
4681  decl_base(c->get_environment(), c->get_name(), location()),
4682  member_base(access, is_static),
4683  class_tmpl_(c)
4684  {}
4685 
4686  operator const class_tdecl& () const
4687  { return *class_tmpl_; }
4688 
4690  as_class_tdecl() const
4691  {return class_tmpl_;}
4692 
4693  virtual bool
4694  operator==(const member_base& o) const;
4695 
4696  virtual bool
4697  operator==(const decl_base&) const;
4698 
4699  virtual bool
4700  operator==(const member_class_template&) const;
4701 
4702  virtual bool
4704 };// end class member_class_template
4705 
4706 bool
4707 operator==(const member_class_template_sptr& l,
4708  const member_class_template_sptr& r);
4709 
4710 bool
4711 operator!=(const member_class_template_sptr& l,
4712  const member_class_template_sptr& r);
4713 
4714 // Forward declarations for select nested hashers.
4716 {
4717  size_t
4718  operator()(const shared_ptr<type_base> t) const;
4719 };
4720 
4722 {
4723  size_t
4724  operator()(const type_base* t) const;
4725 };
4726 
4727 /// A hashing functor for instances and pointers of @ref var_decl.
4729 {
4730  size_t
4731  operator()(const var_decl& t) const;
4732 
4733  size_t
4734  operator()(const var_decl* t) const;
4735 }; //end struct var_decl::hash
4736 
4737 /// A comparison functor for pointers to @ref var_decl.
4739 {
4740  /// Return true if the two instances of @ref var_decl are equal.
4741  ///
4742  /// @param l the first variable to compare.
4743  ///
4744  /// @param r the second variable to compare.
4745  ///
4746  /// @return true if @p l equals @p r.
4747  bool
4748  operator()(const var_decl* l, const var_decl* r) const
4749  {
4750  if (l == r)
4751  return true;
4752  if (!!l != !!r)
4753  return false;
4754  return (*l == *r);
4755  }
4756 };// end struct var_decl::ptr_equal
4757 
4758 /// A hashing functor fo instances and pointers of @ref function_decl.
4760 {
4761  size_t
4762  operator()(const function_decl& t) const;
4763 
4764  size_t
4765  operator()(const function_decl* t) const;
4766 };//end struct function_decl::hash
4767 
4768 /// Equality functor for instances of @ref function_decl
4770 {
4771  /// Tests if two pointers to @ref function_decl are equal.
4772  ///
4773  /// @param l the first pointer to @ref function_decl to consider in
4774  /// the comparison.
4775  ///
4776  /// @param r the second pointer to @ref function_decl to consider in
4777  /// the comparison.
4778  ///
4779  /// @return true if the two functions @p l and @p r are equal, false
4780  /// otherwise.
4781  bool
4782  operator()(const function_decl* l, const function_decl* r) const
4783  {
4784  if (l == r)
4785  return true;
4786  if (!!l != !!r)
4787  return false;
4788  return (*l == *r);
4789  }
4790 };// function_decl::ptr_equal
4791 
4792 /// The hashing functor for class_decl::base_spec.
4794 {
4795  size_t
4796  operator()(const base_spec& t) const;
4797 };
4798 
4799 /// The hashing functor for member_base.
4801 {
4802  size_t
4803  operator()(const member_base& m) const;
4804 };
4805 
4806 /// The hashing functor for member_function_template.
4808 {
4809  size_t
4810  operator()(const member_function_template& t) const;
4811 };
4812 
4813 /// The hashing functor for member_class_template
4815 {
4816  size_t
4817  operator()(const member_class_template& t) const;
4818 };
4819 
4821 {
4822  size_t
4823  operator()(const function_tdecl& t) const;
4824 };
4825 
4827 {
4828  size_t
4829  operator()(const shared_ptr<function_tdecl> f) const;
4830 };
4831 
4833 {
4834  size_t
4835  operator()(const class_tdecl& t) const;
4836 };
4837 
4839 {
4840  size_t
4841  operator()(const shared_ptr<class_tdecl> t) const;
4842 };
4843 
4844 /// The base class for the visitor type hierarchy used for traversing
4845 /// a translation unit.
4846 ///
4847 /// Client code willing to get notified for a certain kind of node
4848 /// during the IR traversal might want to define a visitor class that
4849 /// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4850 /// or ir_node_visitor::visit_end() method of its choice, and provide
4851 /// and implementation for it. If either
4852 /// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4853 /// return false, it means the traversal has to stop immediately after
4854 /// the methods' return. If the methods return true, it means the
4855 /// traversal keeps going.
4856 ///
4857 /// That new visitor class would then be passed to e.g,
4858 /// translation_unit::traverse or to the traverse method of any type
4859 /// where the traversal is supposed to start from.
4861 {
4862  struct priv;
4863  std::unique_ptr<priv> priv_;
4864 
4865 public:
4866 
4867  ir_node_visitor();
4868 
4869  virtual ~ir_node_visitor();
4870 
4876 
4877  virtual bool visit_begin(decl_base*);
4878  virtual bool visit_end(decl_base*);
4879 
4880  virtual bool visit_begin(scope_decl*);
4881  virtual bool visit_end(scope_decl*);
4882 
4883  virtual bool visit_begin(type_base*);
4884  virtual bool visit_end(type_base*);
4885 
4886  virtual bool visit_begin(scope_type_decl*);
4887  virtual bool visit_end(scope_type_decl*);
4888 
4889  virtual bool visit_begin(type_decl*);
4890  virtual bool visit_end(type_decl*);
4891 
4892  virtual bool visit_begin(namespace_decl*);
4893  virtual bool visit_end(namespace_decl*);
4894 
4895  virtual bool visit_begin(qualified_type_def*);
4896  virtual bool visit_end(qualified_type_def*);
4897 
4898  virtual bool visit_begin(pointer_type_def*);
4899  virtual bool visit_end(pointer_type_def*);
4900 
4901  virtual bool visit_begin(reference_type_def*);
4902  virtual bool visit_end(reference_type_def*);
4903 
4904  virtual bool visit_begin(array_type_def*);
4905  virtual bool visit_end(array_type_def*);
4906 
4907  virtual bool visit_begin(array_type_def::subrange_type*);
4908  virtual bool visit_end(array_type_def::subrange_type*);
4909 
4910  virtual bool visit_begin(enum_type_decl*);
4911  virtual bool visit_end(enum_type_decl*);
4912 
4913  virtual bool visit_begin(typedef_decl*);
4914  virtual bool visit_end(typedef_decl*);
4915 
4916  virtual bool visit_begin(function_type*);
4917  virtual bool visit_end(function_type*);
4918 
4919  virtual bool visit_begin(var_decl*);
4920  virtual bool visit_end(var_decl*);
4921 
4922  virtual bool visit_begin(function_decl*);
4923  virtual bool visit_end(function_decl*);
4924 
4925  virtual bool visit_begin(function_decl::parameter*);
4926  virtual bool visit_end(function_decl::parameter*);
4927 
4928  virtual bool visit_begin(function_tdecl*);
4929  virtual bool visit_end(function_tdecl*);
4930 
4931  virtual bool visit_begin(class_tdecl*);
4932  virtual bool visit_end(class_tdecl*);
4933 
4934  virtual bool visit_begin(class_or_union *);
4935  virtual bool visit_end(class_or_union *);
4936 
4937  virtual bool visit_begin(class_decl*);
4938  virtual bool visit_end(class_decl*);
4939 
4940  virtual bool visit_begin(union_decl*);
4941  virtual bool visit_end(union_decl*);
4942 
4943  virtual bool visit_begin(class_decl::base_spec*);
4944  virtual bool visit_end(class_decl::base_spec*);
4945 
4946  virtual bool visit_begin(member_function_template*);
4947  virtual bool visit_end(member_function_template*);
4948 
4949  virtual bool visit_begin(member_class_template*);
4950  virtual bool visit_end(member_class_template*);
4951 }; // end struct ir_node_visitor
4952 
4953 // Debugging facility
4954 void
4955 fns_to_str(vector<function_decl*>::const_iterator a_begin,
4956  vector<function_decl*>::const_iterator a_end,
4957  vector<function_decl*>::const_iterator b_begin,
4958  vector<function_decl*>::const_iterator b_end,
4959  std::ostream& o);
4960 
4961 }// end namespace ir
4962 } // end namespace abigail
4963 #endif // __ABG_IR_H__
This type abstracts the configuration information of the library.
Definition: abg-config.h:18
The abstraction of an interned string.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
Definition: abg-ir.h:2487
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition: abg-ir.cc:17379
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:17347
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:17340
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition: abg-ir.cc:17354
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition: abg-ir.cc:17391
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition: abg-ir.cc:17362
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition: abg-ir.cc:17312
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition: abg-ir.cc:17369
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition: abg-ir.h:2472
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition: abg-ir.cc:17555
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition: abg-ir.cc:17548
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:17524
string as_string() const
Return a string representation of the sub range.
Definition: abg-ir.cc:17604
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17793
bool is_infinite() const
Test if the length of the subrange type is infinite.
Definition: abg-ir.cc:17582
bool operator!=(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:17732
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition: abg-ir.cc:17534
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:17516
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:17688
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition: abg-ir.cc:17541
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:17771
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition: abg-ir.cc:17627
uint64_t get_length() const
Getter of the length of the subrange type.
Definition: abg-ir.cc:17565
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition: abg-ir.cc:17597
The abstraction of an array type.
Definition: abg-ir.h:2446
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:18199
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition: abg-ir.cc:18130
virtual bool is_infinite() const
Definition: abg-ir.cc:18169
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition: abg-ir.cc:18145
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition: abg-ir.h:2460
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18259
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition: abg-ir.cc:18286
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:18108
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition: abg-ir.h:2467
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:17981
translation_unit::language get_language() const
Get the language of the array.
Definition: abg-ir.cc:18097
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition: abg-ir.cc:18155
Abstraction of a base specifier in a class declaration.
Definition: abg-ir.h:4338
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition: abg-ir.cc:23263
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition: abg-ir.cc:23270
long get_offset_in_bits() const
Getter of the offset of the base.
Definition: abg-ir.cc:23277
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:23303
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition: abg-ir.cc:23397
virtual size_t get_hash() const
Calculate the hash value for a class_decl::base_spec.
Definition: abg-ir.cc:23284
Abstracts a class declaration.
Definition: abg-ir.h:4141
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:23793
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition: abg-ir.cc:23844
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:23143
bool is_struct() const
Test if the class is a struct.
Definition: abg-ir.cc:23081
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition: abg-ir.cc:23098
virtual ~class_decl()
Destructor of the class_decl type.
Definition: abg-ir.cc:24444
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:23059
bool has_vtable() const
Test if the current instance has a vtable.
Definition: abg-ir.cc:23872
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition: abg-ir.cc:23886
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition: abg-ir.cc:23853
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24360
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition: abg-ir.h:4155
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition: abg-ir.cc:23088
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition: abg-ir.cc:23124
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition: abg-ir.cc:23148
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition: abg-ir.cc:24024
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition: abg-ir.cc:24212
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:24747
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition: abg-ir.cc:23835
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:23903
class_decl_sptr find_base_class(const string &) const
Find a base class of a given qualified name for the current class.
Definition: abg-ir.cc:23108
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition: abg-ir.h:4160
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:23169
The base type of class_decl and union_decl.
Definition: abg-ir.h:3939
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition: abg-ir.cc:21917
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:22135
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:22068
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition: abg-ir.cc:22163
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:23793
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition: abg-ir.cc:21803
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition: abg-ir.cc:22239
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition: abg-ir.cc:21902
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition: abg-ir.cc:21935
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition: abg-ir.cc:22253
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition: abg-ir.h:3971
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition: abg-ir.h:3970
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition: abg-ir.cc:22027
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition: abg-ir.h:3972
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:21984
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:22214
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:22198
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition: abg-ir.cc:21886
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition: abg-ir.cc:22295
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:21791
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21709
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition: abg-ir.cc:22267
const data_members & get_non_static_data_members() const
Get the non-static data memebers of this class_or_union.
Definition: abg-ir.cc:22118
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:22172
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:21828
vector< var_decl_sptr > data_members
Convenience typedef.
Definition: abg-ir.h:3969
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition: abg-ir.cc:21782
bool has_no_member() const
Definition: abg-ir.cc:22280
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:22329
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:24747
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition: abg-ir.cc:21854
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition: abg-ir.cc:22246
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition: abg-ir.cc:21870
vector< type_base_sptr > member_types
Convenience typedef.
Definition: abg-ir.h:3964
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition: abg-ir.cc:21953
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:22038
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition: abg-ir.cc:22399
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition: abg-ir.h:3973
Abstract a class template.
Definition: abg-ir.h:3742
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition: abg-ir.cc:26134
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition: abg-ir.cc:26123
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26183
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:26138
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition: abg-ir.h:1224
bool operator!=(const context_rel &o) const
Inequality operator.
Definition: abg-ir.h:1290
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:1516
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition: abg-ir.cc:14925
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:5036
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition: abg-ir.cc:5293
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition: abg-ir.cc:4865
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition: abg-ir.cc:4574
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:4658
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:5648
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition: abg-ir.cc:4984
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition: abg-ir.cc:4840
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:5020
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition: abg-ir.cc:4896
void clear_qualified_name()
Clear the qualified name of this decl.
Definition: abg-ir.cc:4567
void set_name(const string &n)
Setter for the name of the decl.
Definition: abg-ir.cc:4728
const location & get_location() const
Get the location of a given declaration.
Definition: abg-ir.cc:4678
binding
ELF binding.
Definition: abg-ir.h:1567
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
Definition: abg-ir.cc:4788
const interned_string & get_name() const
Getter for the name of the current decl.
Definition: abg-ir.cc:4884
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition: abg-ir.cc:5320
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition: abg-ir.cc:4558
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition: abg-ir.cc:4608
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6659
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition: abg-ir.cc:4741
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.
Definition: abg-ir.cc:8293
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:24821
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition: abg-ir.cc:4976
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:5004
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5617
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition: abg-ir.cc:8317
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition: abg-ir.cc:4806
void set_location(const location &l)
Set the location for a given declaration.
Definition: abg-ir.cc:4716
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition: abg-ir.cc:4751
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition: abg-ir.cc:4857
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4601
visibility get_visibility() const
Getter for the visibility of the decl.
Definition: abg-ir.cc:4850
visibility
ELF visibility.
Definition: abg-ir.h:1557
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition: abg-ir.cc:5027
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:5309
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition: abg-ir.cc:4992
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition: abg-ir.cc:4833
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5588
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition: abg-ir.cc:6621
virtual ~decl_base()
Destructor of the decl_base type.
Definition: abg-ir.cc:5297
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:5282
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:4877
bool get_is_anonymous_or_has_anonymous_parent() const
Definition: abg-ir.cc:4774
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition: abg-ir.cc:4763
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:4650
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition: abg-ir.cc:5199
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
Definition: abg-ir.cc:4627
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4587
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:4919
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:5100
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:19442
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition: abg-ir.h:2867
const var_decl * get_anonymous_data_member() const
Return a non-nil value if this data member context relationship has an anonymous data member....
Definition: abg-ir.cc:3158
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition: abg-ir.cc:3168
The abstraction of the version of an ELF symbol.
Definition: abg-ir.h:1171
version & operator=(const version &o)
Assign a version to the current one.
Definition: abg-ir.cc:3071
bool operator==(const version &o) const
Compares the current version against another one.
Definition: abg-ir.cc:3053
bool is_default() const
Getter for the 'is_default' property of the version.
Definition: abg-ir.cc:3033
const string & str() const
Getter for the version name.
Definition: abg-ir.cc:3019
bool operator!=(const version &o) const
Inequality operator.
Definition: abg-ir.cc:3062
Abstraction of an elf symbol.
Definition: abg-ir.h:900
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition: abg-ir.cc:2156
elf_symbol_sptr get_alias_which_equals(const elf_symbol &other) const
In the list of aliases of a given elf symbol, get the alias that equals this current symbol.
Definition: abg-ir.cc:2479
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition: abg-ir.cc:2374
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:1996
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition: abg-ir.cc:2211
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2135
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition: abg-ir.cc:2240
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition: abg-ir.cc:1986
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition: abg-ir.cc:2172
binding
The binding of a symbol.
Definition: abg-ir.h:917
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition: abg-ir.cc:2247
string get_aliases_id_string(const string_elf_symbols_map_type &symtab, bool include_symbol_itself=true) const
Return a comma separated list of the id of the current symbol as well as the id string of its aliases...
Definition: abg-ir.cc:2500
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2031
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition: abg-ir.cc:2385
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition: abg-ir.cc:2264
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition: abg-ir.cc:2181
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition: abg-ir.cc:2119
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition: abg-ir.cc:2310
void set_size(size_t)
Setter of the size of the symbol.
Definition: abg-ir.cc:2017
const string & get_name() const
Getter for the name of the elf_symbol.
Definition: abg-ir.cc:1979
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2024
static bool get_name_and_version_from_id(const string &id, string &name, string &ver)
Given the ID of a symbol, get the name and the version of said symbol.
Definition: abg-ir.cc:2566
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition: abg-ir.cc:2110
type
The type of a symbol.
Definition: abg-ir.h:904
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition: abg-ir.cc:2045
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition: abg-ir.cc:2142
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2056
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition: abg-ir.cc:2625
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition: abg-ir.cc:2225
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition: abg-ir.cc:2149
static elf_symbol_sptr create(const environment &e, size_t i, size_t s, const string &n, type t, binding b, bool d, bool c, const version &ve, visibility vi, bool is_in_ksymtab=false, const abg_compat::optional< uint32_t > &crc={}, const abg_compat::optional< std::string > &ns={}, bool is_suppressed=false)
Factory of instances of elf_symbol.
Definition: abg-ir.cc:1902
visibility
The visibility of the symbol.
Definition: abg-ir.h:926
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition: abg-ir.cc:2038
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition: abg-ir.cc:2343
void set_index(size_t)
Setter for the index.
Definition: abg-ir.cc:1972
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2064
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition: abg-ir.cc:2359
size_t get_index() const
Getter for the index.
Definition: abg-ir.cc:1965
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition: abg-ir.cc:2430
elf_symbol_sptr get_alias_from_name(const string &name) const
From the aliases of the current symbol, lookup one with a given name.
Definition: abg-ir.cc:2457
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition: abg-ir.cc:1958
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2003
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition: abg-ir.cc:2094
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2127
size_t get_size() const
Getter of the size of the symbol.
Definition: abg-ir.cc:2010
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition: abg-ir.cc:2072
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition: abg-ir.cc:2163
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition: abg-ir.cc:2232
bool operator==(const elf_symbol &) const
Test if two main symbols are textually equal, or, if they have aliases that are textually equal.
Definition: abg-ir.cc:2611
The abstraction of an enumerator.
Definition: abg-ir.h:2759
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:18848
bool operator!=(const enumerator &other) const
Inequality operator.
Definition: abg-ir.cc:18908
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition: abg-ir.cc:18950
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition: abg-ir.cc:18972
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition: abg-ir.cc:18917
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition: abg-ir.cc:18979
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:18965
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:18934
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:18958
bool operator==(const enumerator &other) const
Equality operator.
Definition: abg-ir.cc:18895
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:18879
Abstracts a declaration for an enum type.
Definition: abg-ir.h:2677
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:18438
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition: abg-ir.h:2690
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition: abg-ir.cc:18426
const enumerators & get_enumerators() const
Definition: abg-ir.cc:18357
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18404
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition: abg-ir.cc:18352
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:18769
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:18383
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition: abg-ir.h:140
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
Definition: abg-ir.cc:3619
std::unordered_map< string, std::vector< type_base_sptr > > canonical_types_map_type
A convenience typedef for a map of canonical types. The key is the pretty representation string of a ...
Definition: abg-ir.h:150
bool user_set_analyze_exported_interfaces_only() const
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() p...
Definition: abg-ir.cc:3733
const type_base_sptr & get_void_type() const
Get a type_decl that represents a "void" type for the current environment.
Definition: abg-ir.cc:3523
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:3685
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition: abg-ir.cc:3551
const config & get_config() const
Getter of the general configuration object.
Definition: abg-ir.cc:3723
environment()
Default constructor of the environment type.
Definition: abg-ir.cc:3183
vector< type_base_sptr > * get_canonical_types(const char *name)
Get the vector of canonical types which have a given "string representation".
Definition: abg-ir.cc:3870
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition: abg-ir.cc:3563
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "string representation".
Definition: abg-ir.cc:3893
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:3538
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:3655
virtual ~environment()
Destructor for the environment type.
Definition: abg-ir.cc:3188
interned_string intern(const string &) const
Do intern a string.
Definition: abg-ir.cc:3716
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:26322
bool do_on_the_fly_canonicalization() const
Getter for the "on-the-fly-canonicalization" flag.
Definition: abg-ir.cc:3586
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:3759
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition: abg-ir.cc:3196
Abstraction of a function parameter.
Definition: abg-ir.h:3196
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition: abg-ir.cc:21542
interned_string get_type_name() const
Definition: abg-ir.cc:21331
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition: abg-ir.cc:21369
const string get_type_pretty_representation() const
Definition: abg-ir.cc:21350
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition: abg-ir.cc:21507
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
Definition: abg-ir.cc:21527
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:21562
Abstraction for a function declaration.
Definition: abg-ir.h:3024
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3044
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:20724
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition: abg-ir.cc:20818
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21193
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition: abg-ir.cc:20888
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition: abg-ir.cc:21112
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition: abg-ir.cc:20784
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition: abg-ir.cc:20803
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:20605
const type_base_sptr get_return_type() const
Definition: abg-ir.cc:20869
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition: abg-ir.cc:20901
const std::vector< parameter_sptr > & get_parameters() const
Definition: abg-ir.cc:20874
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition: abg-ir.cc:20881
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition: abg-ir.cc:20840
virtual ~function_decl()
Destructor of the function_decl type.
Definition: abg-ir.cc:21209
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:20856
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition: abg-ir.cc:21098
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3051
virtual size_t get_hash() const
The virtual implementation of 'get_hash' for a function_decl.
Definition: abg-ir.cc:21124
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:20674
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:21140
Abstract a function template declaration.
Definition: abg-ir.h:3693
binding get_binding() const
Get the binding of the function template.
Definition: abg-ir.cc:25971
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition: abg-ir.cc:25953
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition: abg-ir.cc:25964
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26031
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition: abg-ir.cc:25980
Abstraction of a function type.
Definition: abg-ir.h:3300
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3306
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition: abg-ir.cc:20035
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:20317
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition: abg-ir.cc:20002
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:20213
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:19816
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition: abg-ir.cc:20276
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:19987
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition: abg-ir.cc:19964
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition: abg-ir.cc:20233
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:19943
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition: abg-ir.cc:19906
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition: abg-ir.cc:19914
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:20191
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition: abg-ir.cc:19923
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3312
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:20300
This abstracts the global scope of a given translation unit.
Definition: abg-ir.h:1930
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition: abg-ir.h:4861
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:26973
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition: abg-ir.cc:27017
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition: abg-ir.cc:27007
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition: abg-ir.cc:26952
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition: abg-ir.cc:26983
The entry point to manage locations.
Definition: abg-ir.h:432
location create_new_location(const std::string &fle, size_t lne, size_t col)
Insert the triplet representing a source locus into our internal vector of location triplet....
Definition: abg-ir.cc:448
void expand_location(const location &location, std::string &path, unsigned &line, unsigned &column) const
Given an instance of location type, return the triplet {path,line,column} that represents the source ...
Definition: abg-ir.cc:471
The source location of a token.
Definition: abg-ir.h:290
location()
Default constructor for the location type.
Definition: abg-ir.h:372
bool get_is_artificial() const
Test if the location is artificial.
Definition: abg-ir.h:331
location & operator=(const location &l)
Assignment operator of the location.
Definition: abg-ir.h:363
bool operator<(const location &other) const
"Less than" operator of the location type.
Definition: abg-ir.h:404
bool operator==(const location &other) const
Equality operator of the location type.
Definition: abg-ir.h:394
location(const location &l)
Copy constructor of the location.
Definition: abg-ir.h:353
unsigned get_value() const
Get the value of the location.
Definition: abg-ir.h:378
void set_is_artificial(bool f)
Set the artificial-ness of the location.
Definition: abg-ir.h:347
string expand(void) const
Expand the location into a string.
Definition: abg-ir.cc:413
Abstraction of a member function context relationship. This relates a member function to its parent c...
Definition: abg-ir.h:4466
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition: abg-ir.h:4544
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition: abg-ir.h:4534
bool is_const() const
Getter for the 'is-const' property.
Definition: abg-ir.h:4579
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition: abg-ir.h:4569
void is_const(bool f)
Setter for the 'is-const' property.
Definition: abg-ir.h:4587
size_t vtable_offset() const
Getter for the vtable offset property.
Definition: abg-ir.h:4524
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition: abg-ir.h:4552
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition: abg-ir.h:4561
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition: abg-ir.h:3788
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition: abg-ir.h:3809
bool get_is_static() const
Definition: abg-ir.h:3821
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition: abg-ir.h:3816
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition: abg-ir.h:3828
Abstracts a member class template template.
Definition: abg-ir.h:4667
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition: abg-ir.cc:24607
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24692
Abstract a member function template.
Definition: abg-ir.h:4612
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:24586
Abstraction of the declaration of a method.
Definition: abg-ir.h:3837
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition: abg-ir.cc:6518
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition: abg-ir.cc:23544
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6659
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition: abg-ir.cc:6405
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition: abg-ir.cc:6558
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition: abg-ir.cc:6375
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition: abg-ir.cc:6462
const method_type_sptr get_type() const
Definition: abg-ir.cc:23562
friend void set_member_function_vtable_offset(function_decl &, ssize_t)
Set the vtable offset of a member function.
Definition: abg-ir.cc:6591
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:6547
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition: abg-ir.cc:6434
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition: abg-ir.cc:6490
friend bool get_member_function_is_virtual(const function_decl &)
Test if a given member function is virtual.
Definition: abg-ir.cc:6621
Abstracts the type of a class member function.
Definition: abg-ir.h:3396
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:20504
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition: abg-ir.cc:20536
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:9081
virtual ~method_type()
The destructor of method_type.
Definition: abg-ir.cc:20547
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:20528
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition: abg-ir.cc:20495
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition: abg-ir.cc:20543
The abstraction of a namespace declaration.
Definition: abg-ir.h:2175
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:15992
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16023
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
Definition: abg-ir.cc:15926
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition: abg-ir.cc:15978
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:15964
Abstracts non type template parameters.
Definition: abg-ir.h:3570
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition: abg-ir.cc:25650
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:25664
virtual size_t get_hash() const
Get the hash value of the current instance.
Definition: abg-ir.cc:25657
The abstraction of a pointer type.
Definition: abg-ir.h:2315
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition: abg-ir.cc:16656
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:16790
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:16587
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16873
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition: abg-ir.cc:16726
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition: abg-ir.cc:16770
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition: abg-ir.cc:16777
The abstraction of a qualified type.
Definition: abg-ir.h:2204
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:16314
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition: abg-ir.cc:16438
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition: abg-ir.cc:16178
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:16426
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition: abg-ir.h:2223
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:16118
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition: abg-ir.cc:16417
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16386
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition: abg-ir.cc:16412
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition: abg-ir.cc:16431
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition: abg-ir.cc:16258
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition: abg-ir.cc:16095
Abstracts a reference type.
Definition: abg-ir.h:2378
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:17172
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:16946
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17238
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:17044
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition: abg-ir.cc:17114
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:17217
A declaration that introduces a scope.
Definition: abg-ir.h:1787
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition: abg-ir.cc:7802
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition: abg-ir.cc:7982
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition: abg-ir.cc:7941
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition: abg-ir.cc:7957
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition: abg-ir.cc:8317
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition: abg-ir.cc:7820
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition: abg-ir.cc:7855
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition: abg-ir.h:1798
bool is_empty() const
Test if the current scope is empty.
Definition: abg-ir.cc:7869
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:8264
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition: abg-ir.cc:7916
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition: abg-ir.h:1796
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:8028
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition: abg-ir.h:1794
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:8337
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:7738
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:8216
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition: abg-ir.cc:8058
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:7885
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:7927
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7762
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:7726
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition: abg-ir.cc:8001
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.
Definition: abg-ir.cc:8293
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:8170
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition: abg-ir.cc:7780
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition: abg-ir.cc:7838
virtual size_t get_hash() const
Return the hash value for the current instance of scope_decl.
Definition: abg-ir.cc:8095
A type that introduces a scope.
Definition: abg-ir.h:2149
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:15885
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition: abg-ir.cc:15847
The base class of templates.
Definition: abg-ir.h:3452
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:25318
virtual ~template_decl()
Destructor.
Definition: abg-ir.cc:25343
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:25310
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:25352
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition: abg-ir.h:3487
virtual ~template_parameter()
Destructor.
Definition: abg-ir.cc:25479
bool operator!=(const template_parameter &) const
Inequality operator.
Definition: abg-ir.cc:25475
Abstracts a template template parameter.
Definition: abg-ir.h:3617
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:25737
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
Definition: abg-ir.h:663
void set_address_size(char)
Setter of the address size in this translation unit.
Definition: abg-ir.cc:1393
const std::string & get_absolute_path() const
Get the concatenation of the build directory and the relative path of the translation unit.
Definition: abg-ir.cc:1308
void set_is_constructed(bool)
Setter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
Definition: abg-ir.cc:1425
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
Definition: abg-ir.cc:1435
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
Definition: abg-ir.cc:1351
char get_address_size() const
Getter of the address size in this translation unit.
Definition: abg-ir.cc:1386
const std::string & get_compilation_dir_path() const
Get the path of the directory that was 'current' when the translation unit was compiled.
Definition: abg-ir.cc:1289
friend type_base_sptr synthesize_type_from_translation_unit(const type_base_sptr &type, translation_unit &tu)
In a translation unit, lookup a given type or synthesize it if it's a qualified type.
Definition: abg-ir.cc:14049
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
Definition: abg-ir.cc:1335
void set_language(language l)
Setter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1252
void bind_function_type_life_time(function_type_sptr) const
Ensure that the life time of a function type is bound to the life time of the current translation uni...
Definition: abg-ir.cc:1461
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
Definition: abg-ir.cc:1188
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
Definition: abg-ir.cc:1375
bool is_constructed() const
Getter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
Definition: abg-ir.cc:1409
friend function_type_sptr synthesize_function_type_from_translation_unit(const function_type &fn_type, translation_unit &tu)
In a translation unit, lookup the sub-types that make up a given function type and if the sub-types a...
Definition: abg-ir.cc:14132
const std::string & get_path() const
Get the path of the current translation unit.
Definition: abg-ir.cc:1265
void set_compilation_dir_path(const std::string &)
Set the path of the directory that was 'current' when the translation unit was compiled.
Definition: abg-ir.cc:1300
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
Definition: abg-ir.cc:1359
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
Definition: abg-ir.cc:1276
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
Definition: abg-ir.cc:1493
language
The language of the translation unit.
Definition: abg-ir.h:676
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition: abg-ir.h:672
bool operator!=(const translation_unit &) const
Inequality operator.
Definition: abg-ir.cc:1450
const vector< function_type_sptr > & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
Definition: abg-ir.cc:1231
const environment & get_environment() const
Getter of the environment of the current translation_unit.
Definition: abg-ir.cc:1238
const type_maps & get_types() const
Getter of the types of the current translation_unit.
Definition: abg-ir.cc:1215
language get_language() const
Getter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1245
The interface for types which are feeling social and want to be visited during the traversal of a hie...
Definition: abg-traverse.h:39
An abstraction helper for type declarations.
Definition: abg-ir.h:1951
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
Definition: abg-ir.cc:14987
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition: abg-ir.cc:14970
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition: abg-ir.cc:15066
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:15092
friend type_base_sptr canonicalize(type_base_sptr)
Compute the canonical type of a given type.
Definition: abg-ir.cc:14839
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:14749
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition: abg-ir.cc:15059
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition: abg-ir.cc:15052
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition: abg-ir.cc:15042
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition: abg-ir.cc:15080
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition: abg-ir.cc:15073
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition: abg-ir.cc:14954
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition: abg-ir.h:3655
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition: abg-ir.cc:25843
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition: abg-ir.cc:25850
virtual size_t get_hash() const
Get the hash value for the current instance.
Definition: abg-ir.cc:25857
A basic type declaration that introduces no scope.
Definition: abg-ir.h:2086
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:15679
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:15758
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:15617
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:15573
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:15738
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Definition: abg-ir.h:576
istring_type_base_wptrs_map_type & typedef_types()
Getter for the map that associates the name of a typedef to the vector of instances of typedef_decl_s...
Definition: abg-ir.cc:591
istring_type_base_wptrs_map_type & function_types()
Getter for the map that associates the name of a function type to the vector of instances of function...
Definition: abg-ir.cc:680
istring_type_base_wptrs_map_type & reference_types()
Getter for the map that associates the name of a reference type to the vector of instances of referen...
Definition: abg-ir.cc:631
const istring_type_base_wptrs_map_type & class_types() const
Getter for the map that associates the name of a class type to the vector of instances of class_decl_...
Definition: abg-ir.cc:549
istring_type_base_wptrs_map_type & union_types()
Getter for the map that associates the name of a union type to the vector of instances of union_decl_...
Definition: abg-ir.cc:563
istring_type_base_wptrs_map_type & array_types()
Getter for the map that associates the name of an array type to the vector of instances of array_type...
Definition: abg-ir.cc:645
istring_type_base_wptrs_map_type & enum_types()
Getter for the map that associates the name of an enum type to the vector of instances of enum_type_d...
Definition: abg-ir.cc:577
bool empty() const
Test if the type_maps is empty.
Definition: abg-ir.cc:517
istring_type_base_wptrs_map_type & qualified_types()
Getter for the map that associates the name of a qualified type to the vector of instances of qualifi...
Definition: abg-ir.cc:604
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
Definition: abg-ir.cc:1124
istring_type_base_wptrs_map_type & pointer_types()
Getter for the map that associates the name of a pointer type to the vector of instances of pointer_t...
Definition: abg-ir.cc:617
const istring_type_base_wptrs_map_type & basic_types() const
Getter for the map that associates the name of a basic type to the vector instances of type_decl_sptr...
Definition: abg-ir.cc:535
const istring_type_base_wptrs_map_type & subrange_types() const
Getter for the map that associates the name of a subrange type to the vector of instances of array_ty...
Definition: abg-ir.cc:666
The base class of both types and declarations.
Definition: abg-ir.h:1345
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4331
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4145
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition: abg-ir.cc:4134
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition: abg-ir.cc:4291
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition: abg-ir.cc:4298
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition: abg-ir.cc:10207
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition: abg-ir.cc:4323
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition: abg-ir.cc:10458
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition: abg-ir.cc:4168
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4157
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition: abg-ir.cc:4356
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition: abg-ir.cc:4188
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:4223
bool hashing_started() const
Getter for the 'hashing_started' property.
Definition: abg-ir.cc:4241
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition: abg-ir.cc:4273
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:1359
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:4095
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:4115
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition: abg-ir.cc:4255
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:4085
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:4105
friend pointer_type_def * is_pointer_type(type_or_decl_base *)
Test whether a type is a pointer_type_def.
Definition: abg-ir.cc:10558
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition: abg-ir.cc:10134
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4348
Abstracts a type template parameter.
Definition: abg-ir.h:3533
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:25521
The abstraction of a typedef declaration.
Definition: abg-ir.h:2809
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition: abg-ir.cc:19207
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition: abg-ir.cc:19062
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19222
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition: abg-ir.cc:19200
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:19142
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition: abg-ir.cc:19079
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:19183
Abstracts a union type declaration.
Definition: abg-ir.h:4396
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:25112
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition: abg-ir.cc:25052
virtual ~union_decl()
Destructor of the union_decl type.
Definition: abg-ir.cc:25185
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:25019
Abstracts a variable declaration.
Definition: abg-ir.h:2921
binding get_binding() const
Getter of the binding of the variable.
Definition: abg-ir.cc:19336
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition: abg-ir.cc:19318
void set_binding(binding b)
Setter of the binding of the variable.
Definition: abg-ir.cc:19343
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition: abg-ir.cc:6179
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition: abg-ir.cc:19381
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:19644
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:19329
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition: abg-ir.cc:6324
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:19311
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19788
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:19765
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition: abg-ir.cc:6253
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition: abg-ir.cc:19358
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:6147
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:6310
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:19374
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition: abg-ir.cc:19569
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:19611
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:19674
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:19588
string get_pretty_representation(diff *d)
Get a copy of the pretty representation of a diff node.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition: abg-fwd.h:229
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:18438
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
Definition: abg-fwd.h:215
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:554
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:263
access_specifier
Access specifier for class members.
Definition: abg-ir.h:856
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition: abg-ir.cc:21175
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
Definition: abg-fwd.h:287
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
Definition: abg-corpus.cc:1616
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:23793
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:18058
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:541
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
Definition: abg-ir.cc:1505
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
Definition: abg-fwd.h:129
integral_type::modifiers_type operator~(integral_type::modifiers_type l)
Bitwise one's complement operator for integral_type::modifiers_type.
Definition: abg-ir.cc:15149
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:11032
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:863
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:546
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1300
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition: abg-ir.h:1304
@ 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:1320
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition: abg-ir.h:1315
@ 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:1309
bool operator==(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep comparison operator for pointers to translation units.
Definition: abg-ir.cc:1688
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
Definition: abg-ir.h:119
string get_pretty_representation(const type_or_decl_base *tod, bool internal)
Build and return a copy of the pretty representation of an ABI artifact that could be either a type o...
Definition: abg-ir.cc:9144
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:24501
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition: abg-ir.h:881
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
Definition: abg-fwd.h:312
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition: abg-fwd.h:187
bool string_to_elf_symbol_type(const string &s, elf_symbol::type &t)
Convert a string representing a symbol type into an elf_symbol::type.
Definition: abg-ir.cc:2878
void fns_to_str(vector< function_decl * >::const_iterator a_begin, vector< function_decl * >::const_iterator a_end, vector< function_decl * >::const_iterator b_begin, vector< function_decl * >::const_iterator b_end, std::ostream &o)
For each sequence of functions given in argument, generate a sequence of string that matches a given ...
Definition: abg-ir.cc:27369
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:8529
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5617
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition: abg-fwd.h:205
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition: abg-fwd.h:161
std::ostream & operator<<(std::ostream &o, elf_symbol::type t)
Serialize an instance of symbol_type and stream it to a given output stream.
Definition: abg-ir.cc:2750
bool var_equals_modulo_types(const var_decl &l, const var_decl &r, change_kind *k)
Compares two instances of var_decl without taking their type into account.
Definition: abg-ir.cc:19442
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:3508
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
Definition: abg-corpus.cc:1602
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
Definition: abg-ir.cc:2959
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition: abg-ir.cc:1651
std::unordered_map< string, elf_symbol_sptr > string_elf_symbol_sptr_map_type
Convenience typedef for a map which key is a string and which value if the elf symbol of the same nam...
Definition: abg-ir.h:873
unordered_map< interned_string, type_base_wptrs_type, hash_interned_string > istring_type_base_wptrs_map_type
A convenience typedef for a map which key is an interned_string and which value is a vector of type_b...
Definition: abg-fwd.h:149
bool function_decl_is_less_than(const function_decl &f, const function_decl &s)
Test if the pretty representation of a given function_decl is lexicographically less then the pretty ...
Definition: abg-ir.cc:26564
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition: abg-ir.cc:2681
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:246
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
Definition: abg-corpus.cc:1630
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition: abg-fwd.h:258
bool string_to_elf_symbol_binding(const string &s, elf_symbol::binding &b)
Convert a string representing a an elf symbol binding into an elf_symbol::binding.
Definition: abg-ir.cc:2911
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
Definition: abg-fwd.h:119
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
Definition: abg-fwd.h:134
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:890
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition: abg-ir.h:1212
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:878
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition: abg-ir.cc:1665
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10111
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition: abg-ir.cc:5199
bool string_to_elf_symbol_visibility(const string &s, elf_symbol::visibility &v)
Convert a string representing a an elf symbol visibility into an elf_symbol::visibility.
Definition: abg-ir.cc:2936
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition: abg-ir.h:868
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition: abg-fwd.h:220
translation_unit::language string_to_translation_unit_language(const string &l)
Parse a string representing a language into a translation_unit::language enumerator into a string.
Definition: abg-ir.cc:1575
const function_decl::parameter * get_function_parameter(const decl_base *fun, unsigned parm_index)
Get the function parameter designated by its index.
Definition: abg-ir.cc:26852
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition: abg-ir.cc:10890
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition: abg-ir.cc:1637
method_decl * is_method_decl(const type_or_decl_base *d)
Test if a function_decl is actually a method_decl.
Definition: abg-ir.cc:23624
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5588
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition: abg-fwd.h:169
vector< type_base * > type_base_ptrs_type
Helper typedef for a vector of pointer to type_base.
Definition: abg-ir.h:116
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
Definition: abg-ir.h:100
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
Definition: abg-ir.cc:8609
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:559
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:8337
vector< namespace_decl_sptr > namespaces_type
A convenience typedef for vectors of namespace_decl_sptr.
Definition: abg-ir.h:2197
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:8892
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
Definition: abg-fwd.h:304
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:8499
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:828
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:26830
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition: abg-fwd.h:156
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:11485
translation_unit * get_translation_unit(const decl_base &decl)
Return the translation unit a declaration belongs to.
Definition: abg-ir.cc:9910
unordered_set< type_base_sptr, canonical_type_hash > canonical_type_sptr_set_type
Helper typedef for an unordered set of type_base_sptr which uses pointer value to tell its members ap...
Definition: abg-ir.h:113
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
Definition: abg-ir.cc:1674
unordered_map< interned_string, type_or_decl_base_sptr, hash_interned_string > istring_type_or_decl_base_sptr_map_type
A convenience typedef for a map which key is an interned_string and which value is a type_base_wptr.
Definition: abg-ir.h:566
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
Definition: abg-corpus.cc:1644
bool operator!=(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep inequality operator for pointers to translation units.
Definition: abg-ir.cc:1707
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10082
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
Definition: abg-ir.cc:2969
std::unordered_map< string, elf_symbols > string_elf_symbols_map_type
Convenience typedef for a map which key is a string and which value is a vector of elf_symbol.
Definition: abg-ir.h:886
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:22631
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
Definition: abg-fwd.h:292
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:550
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:5100
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
Definition: abg-ir.cc:152
A functor to hash instances of interned_string.
Functor to hash a canonical type by using its pointer value.
Definition: abg-ir.h:104
size_t operator()(const type_base_sptr &l) const
Hash a type by returning the pointer value of its canonical type.
Definition: abg-ir.cc:7665
The hashing functor for class_decl::base_spec.
Definition: abg-ir.h:4794
Hasher for the class_decl type.
Definition: abg-ir.h:4299
size_t operator()(const class_decl &t) const
Compute a hash for a class_decl.
Definition: abg-hash.cc:686
Hasher for the class_or_union type.
Definition: abg-ir.h:4131
size_t operator()(const class_or_union &t) const
Compute a hash for a class_or_union.
Definition: abg-hash.cc:607
The private data of the environment type.
Definition: abg-ir-priv.h:389
A hashing functor fo instances and pointers of function_decl.
Definition: abg-ir.h:4760
size_t operator()(const function_decl &t) const
Compute a hash value for an instance of function_decl.
Definition: abg-hash.cc:396
A hashing functor for a function_decl::parameter.
Definition: abg-ir.h:3278
Equality functor for instances of function_decl.
Definition: abg-ir.h:4770
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition: abg-ir.h:4782
The hashing functor for function_type.
Definition: abg-ir.h:3383
size_t operator()(const function_type &t) const
Hashing function for function_type.
Definition: abg-hash.cc:501
The type of the private data of the function_type type.
Definition: abg-ir-priv.h:1519
The base of an entity of the intermediate representation that is to be traversed.
Definition: abg-ir.h:453
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:26935
The hashing functor for member_base.
Definition: abg-ir.h:4801
The hashing functor for member_class_template.
Definition: abg-ir.h:4815
The hashing functor for member_function_template.
Definition: abg-ir.h:4808
The base class for the visitor type hierarchy used for traversing a hierarchy of nodes.
Definition: abg-traverse.h:28
Hasher for the non_type_tparameter type.
Definition: abg-ir.h:3605
size_t operator()(const non_type_tparameter &t) const
Compute a hash value for a non_type_tparameter.
Definition: abg-hash.cc:828
Hasher for the scope_decl type.
Definition: abg-ir.h:1916
size_t operator()(const scope_decl &d) const
Hashing operator for the scope_decl type.
Definition: abg-hash.cc:169
A comparison functor to compare translation units based on their absolute paths.
Definition: abg-ir.h:811
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:820
Private type to hold private members of translation_unit.
Definition: abg-ir-priv.h:143
size_t operator()(const type_base *t) const
A hashing function for type declarations.
Definition: abg-hash.cc:988
Hash functor for instances of type_base.
Definition: abg-ir.h:2030
size_t operator()(const type_base &t) const
Hash function for an instance of type_base.
Definition: abg-hash.cc:95
Definition of the private data of type_base.
Definition: abg-ir-priv.h:179
Hasher for the type_composition type.
Definition: abg-ir.h:3682
size_t operator()(const type_composition &t) const
Compute a hash value for a type_composition type.
Definition: abg-hash.cc:892
A comparison functor to compare pointer to instances of type_or_decl_base.
Definition: abg-ir.h:3155
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:3189
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition: abg-ir.h:3164
The comparison functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:499
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:533
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:513
The hashing functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:467
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:477
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:492
A predicate for deep equality of instances of type_base*.
Definition: abg-ir.h:2044
A predicate for deep equality of instances of shared_ptr<type_base>
Definition: abg-ir.h:2064
A hashing functor for instances and pointers of var_decl.
Definition: abg-ir.h:4729
size_t operator()(const var_decl &t) const
Compute a hash for an instance var_decl.
Definition: abg-hash.cc:357
A comparison functor for pointers to var_decl.
Definition: abg-ir.h:4739
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:4748