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&
166  get_void_pointer_type() const;
167 
168  const type_base_sptr&
170 
171  static string&
173 
174  bool
175  canonicalization_is_done() const;
176 
177  void
179 
180  bool
182 
183  void
185 
186  bool
188 
189  void
190  decl_only_class_equals_definition(bool f) const;
191 
192  bool
193  is_void_type(const type_base_sptr&) const;
194 
195  bool
196  is_void_type(const type_base*) const;
197 
198  bool
199  is_void_pointer_type(const type_base_sptr&) const;
200 
201  bool
202  is_void_pointer_type(const type_base*) const;
203 
204  bool
206 
207  bool
208  is_variadic_parameter_type(const type_base_sptr&) const;
209 
211  intern(const string&) const;
212 
213  const config&
214  get_config() const;
215 
216  bool
218 
219  void
221 
222  bool
224 
225 #ifdef WITH_DEBUG_SELF_COMPARISON
226  void
227  set_self_comparison_debug_input(const corpus_sptr& corpus);
228 
229  void
230  get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
231  corpus_sptr& second_corpus);
232 
233  void
234  self_comparison_debug_is_on(bool);
235 
236  bool
237  self_comparison_debug_is_on() const;
238 #endif
239 
240 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
241  void
242  debug_type_canonicalization_is_on(bool flag);
243 
244  bool
245  debug_type_canonicalization_is_on() const;
246 
247  void
248  debug_die_canonicalization_is_on(bool flag);
249 
250  bool
251  debug_die_canonicalization_is_on() const;
252 #endif
253 
254  vector<type_base_sptr>* get_canonical_types(const char* name);
255 
256  type_base* get_canonical_type(const char* name, unsigned index);
257 
258 #ifdef WITH_DEBUG_SELF_COMPARISON
259  const unordered_map<string, uintptr_t>&
260  get_type_id_canonical_type_map() const;
261 
262  unordered_map<string, uintptr_t>&
263  get_type_id_canonical_type_map();
264 
265  const unordered_map<uintptr_t, string>&
266  get_pointer_type_id_map() const;
267 
268  unordered_map<uintptr_t, string>&
269  get_pointer_type_id_map();
270 
271  string
272  get_type_id_from_pointer(uintptr_t ptr) const;
273 
274  string
275  get_type_id_from_type(const type_base *ptr) const;
276 
277  uintptr_t
278  get_canonical_type_from_type_id(const char*) const;
279 #endif
280 
281  friend class class_or_union;
282  friend class class_decl;
283  friend class function_type;
284 
285  friend void keep_type_alive(type_base_sptr);
286 }; // end class environment
287 
288 class location_manager;
289 /// @brief The source location of a token.
290 ///
291 /// This represents the location of a token coming from a given
292 /// translation unit. This location is actually an abstraction of
293 /// cursor in the table of all the locations of all the tokens of the
294 /// translation unit. That table is managed by the @ref location_manager
295 /// type. To get the file path, line and column numbers associated to
296 /// a given instance of @ref location, you need to use the
297 /// location_manager::expand_location method.
298 class location
299 {
300  unsigned value_;
301  // The location manager to use to decode the value above. There is
302  // one location manager per translation unit, and the location
303  // manager's life time is managed by its translation unit.
304  location_manager* loc_manager_;
305  // Whether the location is artificial. Being artificial means that
306  // the location wasn't generated by the original emitter of the
307  // metadata (i.e, the compiler if the metadata is debug info). For
308  // instance, implicit location derived from the position of XML
309  // elements in the abixml file is represented as artificial
310  // locations.
311  bool is_artificial_;
312 
313  location(unsigned v, location_manager* m)
314  : value_(v), loc_manager_(m), is_artificial_(false)
315  {}
316 
317  /// Get the location manager to use to decode the value of this
318  /// location.
319  ///
320  /// @return the location manager for the current location value.
322  get_location_manager() const
323  {return loc_manager_;}
324 
325 public:
326 
327  /// Test if the location is artificial.
328  ///
329  /// Being artificial means that the location wasn't generated by the
330  /// original emitter of the metadata (i.e, the compiler if the
331  /// metadata is debug info). For instance, the implicit location
332  /// derived from the position of a given XML element in the abixml
333  /// file is represented as artificial locations. The same XML
334  /// element might carry a non-artificial (natural?) location that was
335  /// originally emitted by the compiler that generated the original
336  /// debug info the abixml file is derived from.
337  ///
338  /// @return true iff the location is artificial.
339  bool
341  {return is_artificial_;}
342 
343  /// Set the artificial-ness of the location.
344  ///
345  /// Being artificial means that the location wasn't generated by the
346  /// original emitter of the metadata (i.e, the compiler if the
347  /// metadata is debug info). For instance, the implicit location
348  /// derived from the position of a given XML element in the abixml
349  /// file is represented as artificial locations. The same XML
350  /// element might carry a non-artificial (natural?) location that
351  /// was originally emitted by the compiler that generated the
352  /// original debug info the abixml file is derived from.
353  ///
354  /// @param f the new artificial-ness state.
355  void
357  {is_artificial_ = f;}
358 
359  /// Copy constructor of the location.
360  ///
361  /// @param l the location to copy from.
362  location(const location& l)
363  : value_(l.value_),
364  loc_manager_(l.loc_manager_),
365  is_artificial_(l.is_artificial_)
366  {}
367 
368  /// Assignment operator of the location.
369  ///
370  /// @param l the location to assign to the current one.
371  location&
372  operator=(const location& l)
373  {
374  value_ = l.value_;
375  loc_manager_ = l.loc_manager_;
376  is_artificial_ = l.is_artificial_;
377  return *this;
378  }
379 
380  /// Default constructor for the @ref location type.
382  : value_(), loc_manager_(), is_artificial_()
383  {}
384 
385  /// Get the value of the location.
386  unsigned
387  get_value() const
388  {return value_;}
389 
390  /// Convert the location into a boolean.
391  ///
392  /// @return true iff the value of the location is different from
393  /// zero.
394  operator bool() const
395  {return !!value_;}
396 
397  /// Equality operator of the @ref location type.
398  ///
399  /// @param other the other location to compare against.
400  ///
401  /// @return true iff both locations are equal.
402  bool
403  operator==(const location &other) const
404  {return value_ == other.value_;}
405 
406  /// "Less than" operator of the @ref location type.
407  ///
408  /// @parm other the other location type to compare against.
409  ///
410  /// @return true iff the current instance is less than the @p other
411  /// one.
412  bool
413  operator<(const location &other) const
414  {return value_ < other.value_;}
415 
416  /// Expand the current location into a tripplet file path, line and
417  /// column number.
418  ///
419  /// @param path the output parameter this function sets the expanded
420  /// path to.
421  ///
422  /// @param line the output parameter this function sets the expanded
423  /// line number to.
424  ///
425  /// @param column the output parameter this function sets the
426  /// expanded column number to.
427  void
428  expand(std::string& path, unsigned& line, unsigned& column) const;
429 
430  string
431  expand(void) const;
432 
433  friend class location_manager;
434 }; // end class location
435 
436 /// @brief The entry point to manage locations.
437 ///
438 /// This type keeps a table of all the locations for tokens of a
439 /// given translation unit.
441 {
442  struct priv;
443  std::unique_ptr<priv> priv_;
444 
445 public:
446 
448 
449  ~location_manager();
450 
451  location
452  create_new_location(const std::string& fle, size_t lne, size_t col);
453 
454  void
455  expand_location(const location& location, std::string& path,
456  unsigned& line, unsigned& column) const;
457 };
458 
459 /// The base of an entity of the intermediate representation that is
460 /// to be traversed.
462 {
463  /// Traverse a given IR node and its children, calling an visitor on
464  /// each node.
465  ///
466  /// @param v the visitor to call on each traversed node.
467  ///
468  /// @return true if the all the IR node tree was traversed.
469  virtual bool
471 }; // end class ir_traversable_base
472 
473 /// The hashing functor for using instances of @ref type_or_decl_base
474 /// as values in a hash map or set.
476 {
477 
478  /// Function-call Operator to hash the string representation of an
479  /// ABI artifact.
480  ///
481  /// @param artifact the ABI artifact to hash.
482  ///
483  /// @return the hash value of the string representation of @p
484  /// artifact.
485  size_t
486  operator()(const type_or_decl_base *artifact) const
487  {
488  string repr = get_pretty_representation(artifact);
489  std::hash<string> do_hash;
490  return do_hash(repr);
491  }
492 
493  /// Function-call Operator to hash the string representation of an
494  /// ABI artifact.
495  ///
496  /// @param artifact the ABI artifact to hash.
497  ///
498  /// @return the hash value of the string representation of @p
499  /// artifact.
500  size_t
501  operator()(const type_or_decl_base_sptr& artifact) const
502  {return operator()(artifact.get());}
503 }; // end struct type_or_decl_hash
504 
505 /// The comparison functor for using instances of @ref
506 /// type_or_decl_base as values in a hash map or set.
508 {
509 
510  /// The function-call operator to compare the string representations
511  /// of two ABI artifacts.
512  ///
513  /// @param l the left hand side ABI artifact operand of the
514  /// comparison.
515  ///
516  /// @param r the right hand side ABI artifact operand of the
517  /// comparison.
518  ///
519  /// @return true iff the string representation of @p l equals the one
520  /// of @p r.
521  bool
523  {
524  string repr1 = get_pretty_representation(l);
525  string repr2 = get_pretty_representation(r);
526 
527  return repr1 == repr2;
528  }
529 
530  /// The function-call operator to compare the string representations
531  /// of two ABI artifacts.
532  ///
533  /// @param l the left hand side ABI artifact operand of the
534  /// comparison.
535  ///
536  /// @param r the right hand side ABI artifact operand of the
537  /// comparison.
538  ///
539  /// @return true iff the string representation of @p l equals the one
540  /// of @p r.
541  bool
543  const type_or_decl_base_sptr &r) const
544  {return operator()(l.get(), r.get());}
545 }; // end type_or_decl_equal
546 
547 /// A convenience typedef for a hash set of type_or_decl_base_sptr
548 typedef unordered_set<type_or_decl_base_sptr,
551 
552 /// A convenience typedef for a hash set of const type_or_decl_base*
553 typedef unordered_set<const type_or_decl_base*,
556 
557 /// A convenience typedef for a map which key is a string and which
558 /// value is a @ref type_base_wptr.
559 typedef unordered_map<string, type_base_wptr> string_type_base_wptr_map_type;
560 
561 /// A convenience typedef for a map which key is a string and which
562 /// value is a @ref type_base_sptr.
563 typedef unordered_map<string, type_base_sptr> string_type_base_sptr_map_type;
564 
565 /// A convenience typedef for a map which key is an @ref
566 /// interned_string and which value is a @ref type_base_wptr.
567 typedef unordered_map<interned_string, type_base_wptr, hash_interned_string>
569 
570 /// A convenience typedef for a map which key is an @ref
571 /// interned_string and which value is a @ref type_base_wptr.
572 typedef unordered_map<interned_string,
576 
577 typedef unordered_map<interned_string,
578  const function_decl*,
579  hash_interned_string> istring_function_decl_ptr_map_type;
580 
581 typedef unordered_map<interned_string,
582  const var_decl*,
583  hash_interned_string> istring_var_decl_ptr_map_type;
584 
585 /// This is a type that aggregates maps of all the kinds of types that
586 /// are supported by libabigail.
587 ///
588 /// For instance, the type_maps contains a map of string to basic
589 /// type, a map of string to class type, a map of string to union
590 /// types, etc. The key of a map entry is the pretty representation
591 /// of the type, and the value of the map entry is the type.
593 {
594  struct priv;
595  std::unique_ptr<priv> priv_;
596 
597 public:
598 
599  type_maps();
600 
601  ~type_maps();
602 
603  bool
604  empty() const;
605 
607  basic_types() const;
608 
610  basic_types();
611 
613  class_types() const;
614 
616  class_types();
617 
619  union_types();
620 
622  union_types() const;
623 
625  enum_types();
626 
628  enum_types() const;
629 
631  typedef_types();
632 
634  typedef_types() const;
635 
637  qualified_types();
638 
640  qualified_types() const;
641 
643  pointer_types();
644 
646  pointer_types() const;
647 
650 
652  ptr_to_mbr_types() const;
653 
655  reference_types();
656 
658  reference_types() const;
659 
661  array_types();
662 
664  array_types() const;
665 
667  subrange_types() const;
668 
670  subrange_types();
671 
673  function_types();
674 
676  function_types() const;
677 
678  const vector<type_base_wptr>&
679  get_types_sorted_by_name() const;
680 }; // end class type_maps;
681 
682 /// This is the abstraction of the set of relevant artefacts (types,
683 /// variable declarations, functions, templates, etc) bundled together
684 /// into a translation unit.
686 {
687  struct priv;
688  std::unique_ptr<priv> priv_;
689 
690  // Forbidden
691  translation_unit() = delete;
692 
693 public:
694  /// Convenience typedef for a shared pointer on a @ref global_scope.
695  typedef shared_ptr<scope_decl> global_scope_sptr;
696 
697  /// The language of the translation unit.
698  enum language
699  {
700  LANG_UNKNOWN = 0,
701  LANG_Cobol74,
702  LANG_Cobol85,
703  LANG_C89,
704  LANG_C99,
705  LANG_C11,
706  LANG_C,
707  LANG_C_plus_plus_03,
708  LANG_C_plus_plus_11,
709  LANG_C_plus_plus_14,
710  LANG_C_plus_plus,
711  LANG_ObjC,
712  LANG_ObjC_plus_plus,
713  LANG_Fortran77,
714  LANG_Fortran90,
715  LANG_Fortran95,
716  LANG_Ada83,
717  LANG_Ada95,
718  LANG_Pascal83,
719  LANG_Modula2,
720  LANG_Java,
721  LANG_PLI,
722  LANG_UPC,
723  LANG_D,
724  LANG_Python,
725  LANG_Go,
726  LANG_Rust,
727  LANG_Mips_Assembler
728  };
729 
730 public:
732  const std::string& path,
733  char address_size = 0);
734 
735  virtual ~translation_unit();
736 
737  const environment&
738  get_environment() const;
739 
740  language
741  get_language() const;
742 
743  void
745 
746  const std::string&
747  get_path() const;
748 
749  void
750  set_path(const string&);
751 
752  const std::string&
753  get_compilation_dir_path() const;
754 
755  void
756  set_compilation_dir_path(const std::string&);
757 
758  const std::string&
759  get_absolute_path() const;
760 
761  void
762  set_corpus(corpus*);
763 
764  const corpus*
765  get_corpus() const;
766 
767  corpus*
768  get_corpus();
769 
770  const scope_decl_sptr&
771  get_global_scope() const;
772 
775 
776  const type_maps&
777  get_types() const;
778 
779  type_maps&
780  get_types();
781 
782  const vector<function_type_sptr>&
783  get_live_fn_types() const;
784 
786  get_loc_mgr();
787 
788  const location_manager&
789  get_loc_mgr() const;
790 
791  bool
792  is_empty() const;
793 
794  char
795  get_address_size() const;
796 
797  void
798  set_address_size(char);
799 
800  bool
801  is_constructed() const;
802 
803  void
804  set_is_constructed(bool);
805 
806  bool
807  operator==(const translation_unit&) const;
808 
809  bool
810  operator!=(const translation_unit&) const;
811 
812  void
814 
815  virtual bool
817 
818  friend function_type_sptr
819  lookup_function_type_in_translation_unit(const function_type& t,
820  const translation_unit& tu);
821 
822  friend function_type_sptr
824  translation_unit& tu);
825 
826  friend type_base_sptr
827  synthesize_type_from_translation_unit(const type_base_sptr& type,
828  translation_unit& tu);
829 };//end class translation_unit
830 
831 /// A comparison functor to compare translation units based on their
832 /// absolute paths.
834 {
835  /// Compare two translations units based on their absolute paths.
836  ///
837  /// @param lhs the first translation unit to consider for the
838  /// comparison.
839  ///
840  /// @param rhs the second translatin unit to consider for the
841  /// comparison.
842  bool
844  const translation_unit_sptr& rhs) const
845  {return lhs->get_absolute_path() < rhs->get_absolute_path();}
846 }; // end struct shared_translation_unit_comp
847 
848 /// Convenience typedef for an ordered set of @ref
849 /// translation_unit_sptr.
850 typedef std::set<translation_unit_sptr,
852 
853 string
855 
858 
859 bool
861 
862 bool
864 
865 bool
867 
868 bool
870 
871 bool
873 
874 bool
876 
877 /// Access specifier for class members.
879 {
880  no_access,
881  public_access,
882  protected_access,
883  private_access,
884 };
885 
886 class elf_symbol;
887 /// A convenience typedef for a shared pointer to elf_symbol.
888 typedef shared_ptr<elf_symbol> elf_symbol_sptr;
889 
890 /// A convenience typedef for a weak pointer to elf_symbol.
891 typedef weak_ptr<elf_symbol> elf_symbol_wptr;
892 
893 /// Convenience typedef for a map which key is a string and which
894 /// value if the elf symbol of the same name.
895 typedef std::unordered_map<string, elf_symbol_sptr>
897 
898 /// Convenience typedef for a shared pointer to an
899 /// string_elf_symbol_sptr_map_type.
900 typedef shared_ptr<string_elf_symbol_sptr_map_type>
902 
903 /// Convenience typedef for a vector of elf_symbol
904 typedef std::vector<elf_symbol_sptr> elf_symbols;
905 
906 /// Convenience typedef for a map which key is a string and which
907 /// value is a vector of elf_symbol.
908 typedef std::unordered_map<string, elf_symbols>
910 
911 /// Convenience typedef for a shared pointer to
912 /// string_elf_symbols_map_type.
913 typedef shared_ptr<string_elf_symbols_map_type> string_elf_symbols_map_sptr;
914 
915 /// Abstraction of an elf symbol.
916 ///
917 /// This is useful when a given corpus has been read from an ELF file.
918 /// In that case, a given decl might be associated to its underlying
919 /// ELF symbol, if that decl is publicly exported in the ELF file. In
920 /// that case, comparing decls might involve comparing their
921 /// underlying symbols as well.
923 {
924 public:
925  /// The type of a symbol.
926  enum type
927  {
928  NOTYPE_TYPE = 0,
929  OBJECT_TYPE,
930  FUNC_TYPE,
931  SECTION_TYPE,
932  FILE_TYPE,
933  COMMON_TYPE,
934  TLS_TYPE,
935  GNU_IFUNC_TYPE
936  };
937 
938  /// The binding of a symbol.
939  enum binding
940  {
941  LOCAL_BINDING = 0,
942  GLOBAL_BINDING,
943  WEAK_BINDING,
944  GNU_UNIQUE_BINDING
945  };
946 
947  /// The visibility of the symbol.
949  {
950  DEFAULT_VISIBILITY,
951  PROTECTED_VISIBILITY,
952  HIDDEN_VISIBILITY,
953  INTERNAL_VISIBILITY,
954  };
955 
956  /// Inject the elf_symbol::version here.
957  class version;
958 
959 private:
960  struct priv;
961  std::unique_ptr<priv> priv_;
962 
963  elf_symbol();
964 
965  elf_symbol(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  elf_symbol(const elf_symbol&);
981 
982  elf_symbol&
983  operator=(const elf_symbol& s);
984 
985 public:
986 
987  static elf_symbol_sptr
988  create(const environment& e,
989  size_t i,
990  size_t s,
991  const string& n,
992  type t,
993  binding b,
994  bool d,
995  bool c,
996  const version& ve,
997  visibility vi,
998  bool is_in_ksymtab = false,
999  const abg_compat::optional<uint32_t>& crc = {},
1000  const abg_compat::optional<std::string>& ns = {},
1001  bool is_suppressed = false);
1002 
1003  const environment&
1004  get_environment() const;
1005 
1006  size_t
1007  get_index() const;
1008 
1009  void
1010  set_index(size_t);
1011 
1012  const string&
1013  get_name() const;
1014 
1015  void
1016  set_name(const string& n);
1017 
1018  type
1019  get_type() const;
1020 
1021  void
1022  set_type(type t);
1023 
1024  size_t
1025  get_size() const;
1026 
1027  void
1028  set_size(size_t);
1029 
1030  binding
1031  get_binding() const;
1032 
1033  void
1034  set_binding(binding b);
1035 
1036  version&
1037  get_version() const;
1038 
1039  void
1040  set_version(const version& v);
1041 
1042  void
1044 
1045  visibility
1046  get_visibility() const;
1047 
1048  bool
1049  is_defined() const;
1050 
1051  void
1052  is_defined(bool d);
1053 
1054  bool
1055  is_public() const;
1056 
1057  bool
1058  is_function() const;
1059 
1060  bool
1061  is_variable() const;
1062 
1063  bool
1064  is_in_ksymtab() const;
1065 
1066  void
1068 
1070  get_crc() const;
1071 
1072  void
1074 
1076  get_namespace() const;
1077 
1078  void
1080 
1081  bool
1082  is_suppressed() const;
1083 
1084  void
1086 
1087  const elf_symbol_sptr
1088  get_main_symbol() const;
1089 
1091  get_main_symbol();
1092 
1093  bool
1094  is_main_symbol() const;
1095 
1097  update_main_symbol(const std::string&);
1098 
1100  get_next_alias() const;
1101 
1102  bool
1103  has_aliases() const;
1104 
1105  int
1106  get_number_of_aliases() const;
1107 
1108  void
1109  add_alias(const elf_symbol_sptr&);
1110 
1111  bool
1112  is_common_symbol() const;
1113 
1114  bool
1116 
1118  get_next_common_instance() const;
1119 
1120  void
1122 
1123  const string&
1124  get_id_string() const;
1125 
1127  get_alias_from_name(const string& name) const;
1128 
1130  get_alias_which_equals(const elf_symbol& other) const;
1131 
1133  get_alias_with_default_symbol_version() const;
1134 
1135  string
1137  bool include_symbol_itself = true) const;
1138 
1139  string
1140  get_aliases_id_string(bool include_symbol_itself = true) const;
1141 
1142  static bool
1143  get_name_and_version_from_id(const string& id,
1144  string& name,
1145  string& ver);
1146 
1147  bool
1148  operator==(const elf_symbol&) const;
1149 
1150  bool
1151  does_alias(const elf_symbol&) const;
1152 }; // end class elf_symbol.
1153 
1154 std::ostream&
1155 operator<<(std::ostream& o, elf_symbol::type t);
1156 
1157 std::ostream&
1158 operator<<(std::ostream& o, elf_symbol::binding t);
1159 
1160 std::ostream&
1161 operator<<(std::ostream& o, elf_symbol::visibility t);
1162 
1163 bool
1165 
1166 bool
1168 
1169 bool
1171 
1172 bool
1174 
1175 bool
1177 
1178 bool
1179 operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1180 
1181 bool
1182 operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs);
1183 
1184 bool
1185 elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2);
1186 
1187 void
1188 compute_aliases_for_elf_symbol(const elf_symbol& symbol,
1189  const string_elf_symbols_map_type& symtab,
1190  vector<elf_symbol_sptr>& alias_set);
1191 
1192 /// The abstraction of the version of an ELF symbol.
1194 {
1195  struct priv;
1196  std::unique_ptr<priv> priv_;
1197 
1198 public:
1199  version();
1200 
1201  version(const string& v,
1202  bool is_default);
1203 
1204  version(const version& v);
1205 
1206  ~version();
1207 
1208  operator const string&() const;
1209 
1210  const string&
1211  str() const;
1212 
1213  void
1214  str(const string& s);
1215 
1216  bool
1217  is_default() const;
1218 
1219  void
1220  is_default(bool f);
1221 
1222  bool
1223  is_empty() const;
1224 
1225  bool
1226  operator==(const version& o) const;
1227 
1228  bool
1229  operator!=(const version& o) const;
1230 
1231  version&
1232  operator=(const version& o);
1233 };// end class elf_symbol::version
1234 
1235 class context_rel;
1236 /// A convenience typedef for shared pointers to @ref context_rel
1237 typedef shared_ptr<context_rel> context_rel_sptr;
1238 
1239 /// The abstraction of the relationship between an entity and its
1240 /// containing scope (its context). That relationship can carry
1241 /// properties like access rights (if the parent is a class_decl),
1242 /// etc.
1243 ///
1244 /// But importantly, this relationship carries a pointer to the
1245 /// actualy parent.
1247 {
1248 protected:
1249  scope_decl* scope_;
1250  enum access_specifier access_;
1251  bool is_static_;
1252 
1253 public:
1254  context_rel()
1255  : scope_(0),
1256  access_(no_access),
1257  is_static_(false)
1258  {}
1259 
1261  : scope_(s),
1262  access_(no_access),
1263  is_static_(false)
1264  {}
1265 
1267  access_specifier a,
1268  bool f)
1269  : scope_(s),
1270  access_(a),
1271  is_static_(f)
1272  {}
1273 
1274  scope_decl*
1275  get_scope() const
1276  {return scope_;}
1277 
1279  get_access_specifier() const
1280  {return access_;}
1281 
1282  void
1283  set_access_specifier(access_specifier a)
1284  {access_ = a;}
1285 
1286  bool
1287  get_is_static() const
1288  {return is_static_;}
1289 
1290  void
1291  set_is_static(bool s)
1292  {is_static_ = s;}
1293 
1294  void
1295  set_scope(scope_decl* s)
1296  {scope_ = s;}
1297 
1298  bool
1299  operator==(const context_rel& o)const
1300  {
1301  return (access_ == o.access_
1302  && is_static_ == o.is_static_);
1303  }
1304 
1305  /// Inequality operator.
1306  ///
1307  /// @param o the other instance of @ref context_rel to compare the
1308  /// current instance against.
1309  ///
1310  /// @return true iff the current instance of @ref context_rel is
1311  /// different from @p o.
1312  bool
1313  operator!=(const context_rel& o) const
1314  {return !operator==(o);}
1315 
1316  virtual ~context_rel();
1317 };// end class context_rel
1318 
1319 /// A bitfield that gives callers of abigail::ir::equals() some
1320 /// insight about how different two internal representation artifacts
1321 /// are.
1323 {
1324  NO_CHANGE_KIND = 0,
1325 
1326  /// This means that a given IR artifact has a local type change.
1328 
1329  /// This means that a given IR artifact has a local non-type change.
1330  /// That is a change that is carried by the artifact itself, not by
1331  /// its type.
1333 
1334  /// Testing (anding) against this mask means that a given IR artifact has
1335  /// local differences, with respect to the other artifact it was compared
1336  /// against. A local change is a change that is carried by the artifact
1337  /// itself (or its type), rather than by one off its sub-types.
1339 
1340  /// This means that a given IR artifact has changes in some of its
1341  /// sub-types, with respect to the other artifact it was compared
1342  /// against.
1344 };// end enum change_kind
1345 
1348 
1351 
1352 change_kind&
1354 
1355 change_kind&
1357 
1358 bool
1360  const decl_base& r,
1361  change_kind* k);
1362 
1363 bool
1364 equals(const decl_base&, const decl_base&, change_kind*);
1365 
1366 /// The base class of both types and declarations.
1368 {
1369  struct priv;
1370  mutable std::unique_ptr<priv> priv_;
1371 
1374 
1375 protected:
1376 
1377  /// This is a bitmap type which instance is meant to contain the
1378  /// runtime type of a given ABI artifact. Bits of the identifiers
1379  /// of the type of a given artifact as well as the types it inherits
1380  /// from are to be set to 1.
1382  {
1383  ABSTRACT_TYPE_OR_DECL,
1384  ABSTRACT_DECL_BASE = 1,
1385  ABSTRACT_SCOPE_DECL = 1 << 1,
1386  GLOBAL_SCOPE_DECL = 1 << 2,
1387  NAMESPACE_DECL = 1 << 3,
1388  VAR_DECL = 1 << 4,
1389  FUNCTION_DECL = 1 << 5,
1390  FUNCTION_PARAMETER_DECL = 1 << 6,
1391  METHOD_DECL = 1 << 7,
1392  TEMPLATE_DECL = 1 << 8,
1393  ABSTRACT_TYPE_BASE = 1 << 9,
1394  ABSTRACT_SCOPE_TYPE_DECL = 1 << 10,
1395  BASIC_TYPE = 1 << 11,
1396  SUBRANGE_TYPE = 1 << 12,
1397  QUALIFIED_TYPE = 1 << 13,
1398  POINTER_TYPE = 1 << 14,
1399  REFERENCE_TYPE = 1 << 15,
1400  POINTER_TO_MEMBER_TYPE = 1 << 16,
1401  ARRAY_TYPE = 1 << 17,
1402  ENUM_TYPE = 1 << 18,
1403  TYPEDEF_TYPE = 1 << 19,
1404  CLASS_TYPE = 1 << 20,
1405  UNION_TYPE = 1 << 21,
1406  FUNCTION_TYPE = 1 << 22,
1407  METHOD_TYPE = 1 << 23,
1408  }; // end enum type_or_decl_kind
1409 
1410  enum type_or_decl_kind
1411  kind() const;
1412 
1413  void
1414  kind(enum type_or_decl_kind);
1415 
1416  const void*
1417  runtime_type_instance() const;
1418 
1419  void*
1421 
1422  void
1423  runtime_type_instance(void*);
1424 
1425  const void*
1426  type_or_decl_base_pointer() const;
1427 
1428  void*
1430 
1431  bool hashing_started() const;
1432 
1433  void hashing_started(bool) const;
1434 
1436  operator=(const type_or_decl_base&);
1437 
1438 public:
1439 
1441  enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL);
1442 
1443  virtual ~type_or_decl_base();
1444 
1445  bool
1446  get_is_artificial() const;
1447 
1448  void
1449  set_is_artificial(bool);
1450 
1451  const environment&
1452  get_environment() const;
1453 
1454  void
1456 
1457  location&
1458  get_artificial_location() const;
1459 
1460  bool
1461  has_artificial_location() const;
1462 
1463  const corpus*
1464  get_corpus() const;
1465 
1466  corpus*
1467  get_corpus();
1468 
1469  void
1471 
1472  const translation_unit*
1473  get_translation_unit() const;
1474 
1477 
1478  virtual bool
1480 
1481  virtual string
1482  get_pretty_representation(bool internal = false,
1483  bool qualified_name = true) const = 0;
1484 
1488 
1492 
1496 
1500 
1501  friend class_decl*
1503 
1504  friend type_base*
1505  is_type(const type_or_decl_base*);
1506 
1507  friend decl_base*
1508  is_decl(const type_or_decl_base* d);
1509 }; // end class type_or_decl_base
1510 
1514 
1518 
1522 
1526 
1527 bool
1529 
1530 bool
1532 
1533 bool
1535 
1536 /// The base type of all declarations.
1537 class decl_base : public virtual type_or_decl_base
1538 {
1539  // Forbidden
1540  decl_base();
1541 
1542  struct priv;
1543 
1544 protected:
1545 
1546  const interned_string&
1547  peek_qualified_name() const;
1548 
1549  void
1551 
1552  void
1553  set_qualified_name(const interned_string&) const;
1554 
1555  const interned_string&
1557 
1558  void
1560 
1561 public:
1562  // This is public because some internals of the library need to
1563  // update it. But it's opaque to client code anyway, so no big
1564  // deal. Also, it's not handled by a shared_ptr because accessing
1565  // the data members of the priv struct for this decl_base shows up
1566  // on performance profiles when dealing with big binaries with a lot
1567  // of types; dereferencing the shared_ptr involves locking of some
1568  // sort and that is slower than just dereferencing a pointer likere
1569  // here. There are other types for which the priv pointer is
1570  // managed using shared_ptr just fine, because those didn't show up
1571  // during our performance profiling.
1572  priv* priv_;
1573 
1574  /// Facility to hash instances of decl_base.
1575  struct hash;
1576 
1577  /// ELF visibility
1579  {
1580  VISIBILITY_NONE,
1581  VISIBILITY_DEFAULT,
1582  VISIBILITY_PROTECTED,
1583  VISIBILITY_HIDDEN,
1584  VISIBILITY_INTERNAL
1585  };
1586 
1587  /// ELF binding
1588  enum binding
1589  {
1590  BINDING_NONE,
1591  BINDING_LOCAL,
1592  BINDING_GLOBAL,
1593  BINDING_WEAK
1594  };
1595 
1596  virtual void
1598 
1599 protected:
1600  const context_rel*
1601  get_context_rel() const;
1602 
1603  context_rel*
1604  get_context_rel();
1605 
1606  void
1607  set_context_rel(context_rel *c);
1608  decl_base(const decl_base&);
1609 
1610 public:
1611  decl_base(const environment& e,
1612  const string& name,
1613  const location& locus,
1614  const string& mangled_name = "",
1615  visibility vis = VISIBILITY_DEFAULT);
1616 
1617  decl_base(const environment& e,
1618  const interned_string& name,
1619  const location& locus,
1620  const interned_string& mangled_name = interned_string(),
1621  visibility vis = VISIBILITY_DEFAULT);
1622 
1623  decl_base(const environment&, const location&);
1624 
1625  virtual bool
1626  operator==(const decl_base&) const;
1627 
1628  virtual bool
1629  operator!=(const decl_base&) const;
1630 
1631  virtual bool
1633 
1634  virtual ~decl_base();
1635 
1636  virtual size_t
1637  get_hash() const;
1638 
1639  virtual string
1640  get_pretty_representation(bool internal = false,
1641  bool qualified_name = true) const;
1642 
1643  virtual void
1644  get_qualified_name(interned_string& qualified_name,
1645  bool internal = false) const;
1646 
1647  virtual const interned_string&
1648  get_qualified_name(bool internal = false) const;
1649 
1650  virtual const interned_string&
1651  get_scoped_name() const;
1652 
1653  bool
1655 
1656  void
1658 
1659  const location&
1660  get_location() const;
1661 
1662  void
1663  set_location(const location& l);
1664 
1665  const interned_string&
1666  get_name() const;
1667 
1668  const interned_string&
1669  get_qualified_parent_name() const;
1670 
1671  void
1672  set_name(const string& n);
1673 
1674  bool
1675  get_is_anonymous() const;
1676 
1677  void
1678  set_is_anonymous(bool);
1679 
1680  bool
1681  get_has_anonymous_parent() const;
1682 
1683  bool
1685 
1687  get_naming_typedef() const;
1688 
1689  void
1691 
1692  const interned_string&
1693  get_linkage_name() const;
1694 
1695  virtual void
1696  set_linkage_name(const string& m);
1697 
1698  scope_decl*
1699  get_scope() const;
1700 
1701  visibility
1702  get_visibility() const;
1703 
1704  void
1706 
1707  const decl_base_sptr
1708  get_earlier_declaration() const;
1709 
1710  void
1711  set_earlier_declaration(const decl_base_sptr&);
1712 
1713  const decl_base_sptr
1715 
1716  void
1717  set_definition_of_declaration(const decl_base_sptr&);
1718 
1719  const decl_base*
1721 
1722  bool
1723  get_is_declaration_only() const;
1724 
1725  void
1726  set_is_declaration_only(bool f);
1727 
1728  friend bool
1729  equals(const decl_base&, const decl_base&, change_kind*);
1730 
1731  friend bool
1732  equals(const var_decl&, const var_decl&, change_kind*);
1733 
1734  friend bool
1736 
1737  friend bool
1739  const decl_base& r,
1740  change_kind* k);
1741 
1742  friend decl_base_sptr
1743  add_decl_to_scope(decl_base_sptr decl, scope_decl* scpe);
1744 
1745  friend void
1746  remove_decl_from_scope(decl_base_sptr);
1747 
1748  friend decl_base_sptr
1749  insert_decl_into_scope(decl_base_sptr,
1750  vector<shared_ptr<decl_base> >::iterator,
1751  scope_decl*);
1752 
1753  friend enum access_specifier
1755 
1756  friend enum access_specifier
1757  get_member_access_specifier(const decl_base_sptr& d);
1758 
1759  friend void
1761  access_specifier a);
1762 
1763  friend bool
1764  get_member_is_static(const decl_base& d);
1765 
1766  friend bool
1767  get_member_is_static(const decl_base_sptr& d);
1768 
1769  friend void
1770  set_member_is_static(const decl_base_sptr& d, bool s);
1771 
1772  friend void
1773  set_member_is_static(decl_base& d, bool s);
1774 
1775  friend bool
1777 
1778  friend void
1780 
1781  friend class class_or_union;
1782  friend class class_decl;
1783  friend class scope_decl;
1784 };// end class decl_base
1785 
1786 bool
1787 operator==(const decl_base_sptr&, const decl_base_sptr&);
1788 
1789 bool
1790 operator!=(const decl_base_sptr&, const decl_base_sptr&);
1791 
1792 bool
1793 operator==(const type_base_sptr&, const type_base_sptr&);
1794 
1795 bool
1796 operator!=(const type_base_sptr&, const type_base_sptr&);
1797 
1798 std::ostream&
1799 operator<<(std::ostream&, decl_base::visibility);
1800 
1801 std::ostream&
1802 operator<<(std::ostream&, decl_base::binding);
1803 
1804 bool
1805 equals(const scope_decl&, const scope_decl&, change_kind*);
1806 
1807 /// A declaration that introduces a scope.
1808 class scope_decl : public virtual decl_base
1809 {
1810  struct priv;
1811  std::unique_ptr<priv> priv_;
1812 
1813 public:
1814 
1815  /// Convenience typedef for a vector of @ref decl_base_sptr.
1816  typedef std::vector<decl_base_sptr > declarations;
1817  /// Convenience typedef for a vector of @ref function_type_sptr.
1818  typedef std::vector<function_type_sptr > function_types;
1819  /// Convenience typedef for a vector of @ref scope_decl_sptr.
1820  typedef std::vector<scope_decl_sptr> scopes;
1821 
1822  scope_decl();
1823 
1824 protected:
1825  virtual decl_base_sptr
1826  add_member_decl(const decl_base_sptr& member);
1827 
1828  decl_base_sptr
1829  insert_member_decl(decl_base_sptr member, declarations::iterator before);
1830 
1831  virtual void
1832  remove_member_decl(decl_base_sptr member);
1833 
1834 public:
1835  struct hash;
1836 
1837  scope_decl(const environment& env,
1838  const string& name, const location& locus,
1839  visibility vis = VISIBILITY_DEFAULT);
1840 
1841  scope_decl(const environment& env, location& l);
1842 
1843  virtual size_t
1844  get_hash() const;
1845 
1846  virtual bool
1847  operator==(const decl_base&) const;
1848 
1850  get_canonical_types() const;
1851 
1854 
1855  const type_base_sptrs_type&
1857 
1858  const declarations&
1859  get_member_decls() const;
1860 
1861  declarations&
1862  get_member_decls();
1863 
1864  const declarations&
1865  get_sorted_member_decls() const;
1866 
1867  virtual size_t
1869 
1870  virtual size_t
1872 
1873  virtual size_t
1875 
1876  scopes&
1878 
1879  const scopes&
1880  get_member_scopes() const;
1881 
1882  bool
1883  is_empty() const;
1884 
1885  bool
1886  find_iterator_for_member(const decl_base*, declarations::iterator&);
1887 
1888  bool
1889  find_iterator_for_member(const decl_base_sptr, declarations::iterator&);
1890 
1891  void
1892  insert_member_type(type_base_sptr t,
1893  declarations::iterator before);
1894 
1895  void
1896  add_member_type(type_base_sptr t);
1897 
1898  type_base_sptr
1899  add_member_type(type_base_sptr t, access_specifier a);
1900 
1901  void
1902  remove_member_type(type_base_sptr t);
1903 
1904  const type_base_sptrs_type&
1905  get_member_types() const;
1906 
1907  const type_base_sptrs_type&
1908  get_sorted_member_types() const;
1909 
1910  type_base_sptr
1911  find_member_type(const string& name) const;
1912 
1913  virtual bool
1915 
1916  virtual ~scope_decl();
1917 
1918  friend decl_base_sptr
1919  add_decl_to_scope(decl_base_sptr decl, scope_decl* scope);
1920 
1921  friend decl_base_sptr
1922  insert_decl_into_scope(decl_base_sptr decl,
1923  scope_decl::declarations::iterator before,
1924  scope_decl* scope);
1925 
1926  friend void
1927  remove_decl_from_scope(decl_base_sptr decl);
1928 };//end class scope_decl
1929 
1930 bool
1932 
1933 bool
1935 
1936 /// Hasher for the @ref scope_decl type.
1938 {
1939  size_t
1940  operator()(const scope_decl& d) const;
1941 
1942  size_t
1943  operator()(const scope_decl* d) const;
1944 };
1945 
1946 /// This abstracts the global scope of a given translation unit.
1947 ///
1948 /// Only one instance of this class must be present in a given
1949 /// translation_unit. That instance is implicitely created the first
1950 /// time translatin_unit::get_global_scope is invoked.
1951 class global_scope : public scope_decl
1952 {
1953  translation_unit* translation_unit_;
1954 
1956 
1957 public:
1958 
1959  friend class translation_unit;
1960 
1962  get_translation_unit() const
1963  {return translation_unit_;}
1964 
1965  virtual ~global_scope();
1966 };
1967 
1968 bool
1969 equals(const type_base&, const type_base&, change_kind*);
1970 
1971 /// An abstraction helper for type declarations
1972 class type_base : public virtual type_or_decl_base
1973 {
1974  struct priv;
1975 
1976 public:
1977  // This priv pointer is not handled by a shared_ptr because
1978  // accessing the data members of the priv struct for this type_base
1979  // shows up on performance profiles when dealing with big binaries
1980  // with a lot of types; dereferencing the shared_ptr involves
1981  // locking of some sort and that is slower than just dereferencing a
1982  // pointer likere here. There are other types for which the priv
1983  // pointer is managed using shared_ptr just fine, because those
1984  // didn't show up during our performance profiling.
1985  priv* priv_;
1986 
1987 private:
1988  // Forbid this.
1989  type_base();
1990 
1991  static type_base_sptr
1992  get_canonical_type_for(type_base_sptr);
1993 
1994 protected:
1995  virtual void
1997 
1998 public:
1999 
2000  /// A hasher for type_base types.
2001  struct hash;
2002 
2003  /// A hasher for types. It gets the dynamic type of the current
2004  /// instance of type and hashes it accordingly. Note that the hashing
2005  /// function of this hasher must be updated each time a new kind of
2006  /// type is added to the IR.
2007  struct dynamic_hash;
2008 
2009  /// A hasher for shared_ptr<type_base> that will hash it based on the
2010  /// runtime type of the type pointed to.
2011  struct shared_ptr_hash;
2012 
2013  type_base(const environment& e, size_t s, size_t a);
2014 
2015  friend type_base_sptr canonicalize(type_base_sptr);
2016 
2017  type_base_sptr
2018  get_canonical_type() const;
2019 
2020  type_base*
2021  get_naked_canonical_type() const;
2022 
2023  const interned_string&
2024  get_cached_pretty_representation(bool internal = false) const;
2025 
2026  virtual bool
2027  operator==(const type_base&) const;
2028 
2029  virtual bool
2030  operator!=(const type_base&) const;
2031 
2032  virtual bool
2034 
2035  virtual ~type_base();
2036 
2037  virtual void
2038  set_size_in_bits(size_t);
2039 
2040  virtual size_t
2041  get_size_in_bits() const;
2042 
2043  virtual void
2044  set_alignment_in_bits(size_t);
2045 
2046  virtual size_t
2047  get_alignment_in_bits() const;
2048 };//end class type_base
2049 
2050 /// Hash functor for instances of @ref type_base.
2052 {
2053  size_t
2054  operator()(const type_base& t) const;
2055 
2056  size_t
2057  operator()(const type_base* t) const;
2058 
2059  size_t
2060  operator()(const type_base_sptr t) const;
2061 }; // end struct type_base::hash
2062 
2063 /// A predicate for deep equality of instances of
2064 /// type_base*
2066 {
2067  bool
2068  operator()(const type_base* l, const type_base* r) const
2069  {
2070  if (!!l != !!r)
2071  return false;
2072 
2073  if (l == r)
2074  return true;
2075 
2076  if (l)
2077  return *l == *r;
2078 
2079  return true;
2080  }
2081 };
2082 
2083 /// A predicate for deep equality of instances of
2084 /// shared_ptr<type_base>
2086 {
2087  bool
2088  operator()(const type_base_sptr l, const type_base_sptr r) const
2089  {
2090  if (!!l != !!r)
2091  return false;
2092 
2093  if (l.get() == r.get())
2094  return true;
2095 
2096  if (l)
2097  return *l == *r;
2098 
2099  return true;
2100  }
2101 };
2102 
2103 bool
2104 equals(const type_decl&, const type_decl&, change_kind*);
2105 
2106 /// A basic type declaration that introduces no scope.
2107 class type_decl : public virtual decl_base, public virtual type_base
2108 {
2109  // Forbidden.
2110  type_decl();
2111 
2112 public:
2113 
2114  /// Facility to hash instance of type_decl
2115  struct hash;
2116 
2117  type_decl(const environment& env,
2118  const string& name,
2119  size_t size_in_bits,
2120  size_t alignment_in_bits,
2121  const location& locus,
2122  const string& mangled_name = "",
2123  visibility vis = VISIBILITY_DEFAULT);
2124 
2125  virtual bool
2126  operator==(const type_base&) const;
2127 
2128  virtual bool
2129  operator==(const decl_base&) const;
2130 
2131  virtual bool
2132  operator==(const type_decl&) const;
2133 
2134  virtual bool
2135  operator!=(const type_base&)const;
2136 
2137  virtual bool
2138  operator!=(const decl_base&)const;
2139 
2140  virtual bool
2141  operator!=(const type_decl&)const;
2142 
2143  virtual void
2144  get_qualified_name(interned_string& qualified_name,
2145  bool internal = false) const;
2146 
2147  virtual const interned_string&
2148  get_qualified_name(bool internal = false) const;
2149 
2150  virtual string
2151  get_pretty_representation(bool internal = false,
2152  bool qualified_name = true) const;
2153 
2154  virtual bool
2156 
2157  virtual ~type_decl();
2158 };// end class type_decl.
2159 
2160 bool
2162 
2163 bool
2164 operator==(const type_decl_sptr&, const type_decl_sptr&);
2165 
2166 bool
2167 operator!=(const type_decl_sptr&, const type_decl_sptr&);
2168 
2169 /// A type that introduces a scope.
2170 class scope_type_decl : public scope_decl, public virtual type_base
2171 {
2172  scope_type_decl();
2173 
2174 public:
2175 
2176  /// Hasher for instances of scope_type_decl
2177  struct hash;
2178 
2179  scope_type_decl(const environment& env, const string& name,
2180  size_t size_in_bits, size_t alignment_in_bits,
2181  const location& locus, visibility vis = VISIBILITY_DEFAULT);
2182 
2183  virtual bool
2184  operator==(const decl_base&) const;
2185 
2186  virtual bool
2187  operator==(const type_base&) const;
2188 
2189  virtual bool
2191 
2192  virtual ~scope_type_decl();
2193 };
2194 
2195 /// The abstraction of a namespace declaration
2197 {
2198 public:
2199 
2200  namespace_decl(const environment& env, const string& name,
2201  const location& locus, visibility vis = VISIBILITY_DEFAULT);
2202 
2203  virtual string
2204  get_pretty_representation(bool internal = false,
2205  bool qualified_name = true) const;
2206 
2207  virtual bool
2208  operator==(const decl_base&) const;
2209 
2210  virtual bool
2212 
2213  virtual ~namespace_decl();
2214 
2216 };// end class namespace_decl
2217 
2218 /// A convenience typedef for vectors of @ref namespace_decl_sptr
2219 typedef vector<namespace_decl_sptr> namespaces_type;
2220 
2221 bool
2223 
2224 /// The abstraction of a qualified type.
2225 class qualified_type_def : public virtual type_base, public virtual decl_base
2226 {
2227  class priv;
2228  std::unique_ptr<priv> priv_;
2229 
2230  // Forbidden.
2232 
2233 protected:
2234  string build_name(bool, bool internal = false) const;
2235  virtual void on_canonical_type_set();
2236 
2237 public:
2238 
2239  /// A Hasher for instances of qualified_type_def
2240  struct hash;
2241 
2242  /// Bit field values representing the cv qualifiers of the
2243  /// underlying type.
2244  enum CV
2245  {
2246  CV_NONE = 0,
2247  CV_CONST = 1,
2248  CV_VOLATILE = 1 << 1,
2249  CV_RESTRICT = 1 << 2
2250  };
2251 
2252  qualified_type_def(type_base_sptr type, CV quals, const location& locus);
2253 
2254  qualified_type_def(const environment& env, CV quals, const location& locus);
2255 
2256  virtual size_t
2257  get_size_in_bits() const;
2258 
2259  virtual bool
2260  operator==(const decl_base&) const;
2261 
2262  virtual bool
2263  operator==(const type_base&) const;
2264 
2265  virtual bool
2266  operator==(const qualified_type_def&) const;
2267 
2268  CV
2269  get_cv_quals() const;
2270 
2271  void
2272  set_cv_quals(CV cv_quals);
2273 
2274  string
2276 
2277  type_base_sptr
2278  get_underlying_type() const;
2279 
2280  void
2281  set_underlying_type(const type_base_sptr&);
2282 
2283  virtual void
2284  get_qualified_name(interned_string& qualified_name,
2285  bool internal = false) const;
2286 
2287  virtual const interned_string&
2288  get_qualified_name(bool internal = false) const;
2289 
2290  virtual bool
2292 
2293  virtual ~qualified_type_def();
2294 }; // end class qualified_type_def.
2295 
2296 bool
2297 operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2298 
2299 bool
2300 operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
2301 
2304 
2307 
2310 
2313 
2316 
2317 std::ostream&
2318 operator<<(std::ostream&, qualified_type_def::CV);
2319 
2320 string
2322 
2324 get_name_of_qualified_type(const type_base_sptr& underlying_type,
2325  qualified_type_def::CV quals,
2326  bool qualified = true, bool internal = false);
2327 
2328 qualified_type_def_sptr
2329 lookup_qualified_type(const type_base_sptr&,
2331  const translation_unit&);
2332 bool
2334 
2335 /// The abstraction of a pointer type.
2336 class pointer_type_def : public virtual type_base, public virtual decl_base
2337 {
2338  struct priv;
2339  std::unique_ptr<priv> priv_;
2340 
2341  // Forbidden.
2342  pointer_type_def();
2343 
2344 protected:
2345  virtual void on_canonical_type_set();
2346 
2347 public:
2348 
2349  /// A hasher for instances of pointer_type_def
2350  struct hash;
2351 
2352  pointer_type_def(const type_base_sptr& pointed_to_type, size_t size_in_bits,
2353  size_t alignment_in_bits, const location& locus);
2354 
2355  pointer_type_def(const environment& env, size_t size_in_bits,
2356  size_t alignment_in_bits, const location& locus);
2357 
2358  void
2359  set_pointed_to_type(const type_base_sptr&);
2360 
2361  virtual bool
2362  operator==(const decl_base&) const;
2363 
2364  virtual bool
2365  operator==(const type_base&) const;
2366 
2367  bool
2368  operator==(const pointer_type_def&) const;
2369 
2370  const type_base_sptr
2371  get_pointed_to_type() const;
2372 
2373  type_base*
2374  get_naked_pointed_to_type() const;
2375 
2376  virtual void
2377  get_qualified_name(interned_string&, bool internal = false) const;
2378 
2379  virtual const interned_string&
2380  get_qualified_name(bool internal = false) const;
2381 
2382  virtual bool
2384 
2385  virtual ~pointer_type_def();
2386 }; // end class pointer_type_def
2387 
2388 bool
2390 
2391 bool
2393 
2394 bool
2396 
2397 
2398 /// Abstracts a reference type.
2399 class reference_type_def : public virtual type_base, public virtual decl_base
2400 {
2401  struct priv;
2402  std::unique_ptr<priv> priv_;
2403 
2404  // Forbidden.
2406 
2407 protected:
2408  virtual void on_canonical_type_set();
2409 
2410 public:
2411 
2412  /// Hasher for intances of reference_type_def.
2413  struct hash;
2414 
2415  reference_type_def(const type_base_sptr pointed_to_type,
2416  bool lvalue, size_t size_in_bits,
2417  size_t alignment_in_bits, const location& locus);
2418 
2419  reference_type_def(const environment& env, bool lvalue, size_t size_in_bits,
2420  size_t alignment_in_bits, const location& locus);
2421 
2422  void
2423  set_pointed_to_type(type_base_sptr& pointed_to_type);
2424 
2425  virtual bool
2426  operator==(const decl_base&) const;
2427 
2428  virtual bool
2429  operator==(const type_base&) const;
2430 
2431  bool
2432  operator==(const reference_type_def&) const;
2433 
2434  type_base_sptr
2435  get_pointed_to_type() const;
2436 
2437  bool
2438  is_lvalue() const;
2439 
2440  virtual void
2441  get_qualified_name(interned_string& qualified_name,
2442  bool internal = false) const;
2443 
2444  virtual const interned_string&
2445  get_qualified_name(bool internal = false) const;
2446 
2447  virtual string
2448  get_pretty_representation(bool internal = false,
2449  bool qualified_name = true) const;
2450 
2451  virtual bool
2453 
2454  virtual ~reference_type_def();
2455 }; // end class reference_type_def
2456 
2457 bool
2459 
2460 bool
2462 
2463 /// The abstraction of a pointer-to-member type.
2464 class ptr_to_mbr_type : public virtual type_base,
2465  public virtual decl_base
2466 {
2467  struct priv;
2468  std::unique_ptr<priv> priv_;
2469 
2470  // Forbidden
2471  ptr_to_mbr_type() = delete;
2472 
2473  public:
2474  ptr_to_mbr_type(const environment& env,
2475  const type_base_sptr& member_type,
2476  const type_base_sptr& containing_type,
2477  size_t size_in_bits,
2478  size_t alignment_in_bits,
2479  const location& locus);
2480 
2481  const type_base_sptr&
2482  get_member_type() const;
2483 
2484  const type_base_sptr&
2485  get_containing_type() const;
2486 
2487  bool
2488  operator==(const ptr_to_mbr_type&) const;
2489 
2490  virtual bool
2491  operator==(const type_base&) const;
2492 
2493  virtual bool
2494  operator==(const decl_base&) const;
2495 
2496  virtual void
2497  get_qualified_name(interned_string& qualified_name,
2498  bool internal = false) const;
2499 
2500  virtual const interned_string&
2501  get_qualified_name(bool internal = false) const;
2502 
2503  virtual bool
2505 
2506  virtual ~ptr_to_mbr_type();
2507 }; // end class ptr_to_mbr_type
2508 
2509 bool
2510 equals(const ptr_to_mbr_type&,
2511  const ptr_to_mbr_type&,
2512  change_kind*);
2513 
2514 bool
2516 
2517 /// The abstraction of an array type.
2518 class array_type_def : public virtual type_base, public virtual decl_base
2519 {
2520  struct priv;
2521  std::unique_ptr<priv> priv_;
2522 
2523  // Forbidden.
2524  array_type_def();
2525 
2526  void update_size();
2527 
2528 public:
2529 
2530  /// Hasher for intances of array_type_def.
2531  struct hash;
2532 
2533  class subrange_type;
2534 
2535  /// Convenience typedef for a shared pointer on a @ref
2536  /// function_decl::subrange
2537  typedef shared_ptr<subrange_type> subrange_sptr;
2538 
2539  /// Convenience typedef for a vector of @ref subrange_sptr
2540  typedef std::vector<subrange_sptr> subranges_type;
2541 
2542  /// Abstraction for an array range type, like in Ada, or just for an
2543  /// array dimension like in C or C++.
2544  class subrange_type : public virtual type_base, public virtual decl_base
2545  {
2546  struct priv;
2547  std::unique_ptr<priv> priv_;
2548 
2549  // Forbidden.
2550  subrange_type();
2551  public:
2552 
2553  virtual ~subrange_type();
2554  /// This class is to hold the value of the bound of a subrange.
2555  /// The value can be either signed or unsigned, at least when it
2556  /// comes from DWARF. The class keeps the sign information, but
2557  /// allows users to access the value as signed or unsigned as they
2558  /// see fit.
2560  {
2561  public:
2562  enum signedness
2563  {
2564  UNSIGNED_SIGNEDNESS,
2565  SIGNED_SIGNEDNESS
2566  };
2567 
2568  private:
2569  signedness s_;
2570 
2571  public:
2572  union
2573  {
2574  uint64_t unsigned_;
2575  int64_t signed_;
2576  } v_;
2577  bound_value();
2578  bound_value(uint64_t);
2579  bound_value(int64_t);
2580  enum signedness get_signedness() const;
2581  void set_signedness(enum signedness s);
2582  int64_t get_signed_value() const;
2583  uint64_t get_unsigned_value();
2584  void set_unsigned(uint64_t v);
2585  void set_signed(int64_t v);
2586  bool operator==(const bound_value&) const;
2587  }; //end class bound_value
2588 
2589  /// Hasher for an instance of array::subrange
2590  struct hash;
2591 
2592  subrange_type(const environment& env,
2593  const string& name,
2594  bound_value lower_bound,
2595  bound_value upper_bound,
2596  const type_base_sptr& underlying_type,
2597  const location& loc,
2598  translation_unit::language l = translation_unit::LANG_C11);
2599 
2600  subrange_type(const environment& env,
2601  const string& name,
2602  bound_value lower_bound,
2603  bound_value upper_bound,
2604  const location& loc,
2605  translation_unit::language l = translation_unit::LANG_C11);
2606 
2607  subrange_type(const environment& env,
2608  const string& name,
2609  bound_value upper_bound,
2610  const location& loc,
2611  translation_unit::language l = translation_unit::LANG_C11);
2612 
2613  type_base_sptr
2614  get_underlying_type() const;
2615 
2616  void
2617  set_underlying_type(const type_base_sptr &);
2618 
2619  int64_t
2620  get_upper_bound() const;
2621 
2622  int64_t
2623  get_lower_bound() const;
2624 
2625  void
2626  set_upper_bound(int64_t ub);
2627 
2628  void
2629  set_lower_bound(int64_t lb);
2630 
2631  uint64_t
2632  get_length() const;
2633 
2634  bool
2635  is_non_finite() const;
2636 
2637  void
2638  is_non_finite(bool);
2639 
2641  get_language() const;
2642 
2643  virtual bool
2644  operator==(const decl_base&) const;
2645 
2646  virtual bool
2647  operator==(const type_base&) const;
2648 
2649  bool
2650  operator==(const subrange_type& o) const;
2651 
2652  bool
2653  operator!=(const decl_base& o) const;
2654 
2655  bool
2656  operator!=(const type_base& o) const;
2657 
2658  bool
2659  operator!=(const subrange_type& o) const;
2660 
2661  string
2662  as_string() const;
2663 
2664  static string
2665  vector_as_string(const vector<subrange_sptr>&);
2666 
2667  virtual string
2668  get_pretty_representation(bool internal = false,
2669  bool qualified_name = true) const;
2670 
2671  virtual bool
2673  }; // end class subrange_type
2674 
2675  array_type_def(const type_base_sptr type,
2676  const std::vector<subrange_sptr>& subs,
2677  const location& locus);
2678 
2679  array_type_def(const environment& env,
2680  const std::vector<subrange_sptr>& subs,
2681  const location& locus);
2682 
2684  get_language() const;
2685 
2686  virtual bool
2687  operator==(const decl_base&) const;
2688 
2689  virtual bool
2690  operator==(const type_base&) const;
2691 
2692  virtual void
2693  get_qualified_name(interned_string& qualified_name,
2694  bool internal = false) const;
2695 
2696  virtual const interned_string&
2697  get_qualified_name(bool internal = false) const;
2698 
2699  const type_base_sptr
2700  get_element_type() const;
2701 
2702  void
2703  set_element_type(const type_base_sptr& element_type);
2704 
2705  virtual void
2706  append_subranges(const std::vector<subrange_sptr>& subs);
2707 
2708  virtual int
2709  get_dimension_count() const;
2710 
2711  virtual bool
2712  is_non_finite() const;
2713 
2714  virtual string
2715  get_pretty_representation(bool internal = false,
2716  bool qualified_name = true) const;
2717 
2718  virtual string
2719  get_subrange_representation() const;
2720 
2721  virtual bool
2723 
2724  const location&
2725  get_location() const;
2726 
2727  const std::vector<subrange_sptr>&
2728  get_subranges() const;
2729 
2730  virtual ~array_type_def();
2731 
2732 }; // end class array_type_def
2733 
2735 is_subrange_type(const type_or_decl_base *type);
2736 
2739 
2740 bool
2743  change_kind*);
2744 
2745 bool
2747 
2748 /// Abstracts a declaration for an enum type.
2749 class enum_type_decl : public virtual type_base, public virtual decl_base
2750 {
2751  class priv;
2752  std::unique_ptr<priv> priv_;
2753 
2754  // Forbidden
2755  enum_type_decl();
2756 
2757 public:
2758 
2759  /// A hasher for an enum_type_decl.
2760  struct hash;
2761 
2762  /// Enumerator Datum.
2763  class enumerator;
2764 
2765  /// Convenience typedef for a list of @ref enumerator.
2766  typedef std::vector<enumerator> enumerators;
2767 
2768  /// Constructor of an enum type declaration.
2769  ///
2770  /// @param name the name of the enum
2771  ///
2772  /// @param locus the locus at which the enum appears in the source
2773  /// code.
2774  ///
2775  /// @param underlying_type the underlying type of the enum
2776  ///
2777  /// @param enms a list of enumerators for this enum.
2778  ///
2779  /// @param mangled_name the mangled name of the enum type.
2780  ///
2781  /// @param vis the visibility of instances of this type.
2782  enum_type_decl(const string& name,
2783  const location& locus,
2784  type_base_sptr underlying_type,
2785  enumerators& enms,
2786  const string& mangled_name = "",
2787  visibility vis = VISIBILITY_DEFAULT);
2788 
2789  type_base_sptr
2790  get_underlying_type() const;
2791 
2792  const enumerators&
2793  get_enumerators() const;
2794 
2795  const enumerators&
2796  get_sorted_enumerators() const;
2797 
2798  enumerators&
2799  get_enumerators();
2800 
2801  virtual string
2802  get_pretty_representation(bool internal = false,
2803  bool qualified_name = true) const;
2804 
2805  virtual bool
2806  operator==(const decl_base&) const;
2807 
2808  virtual bool
2809  operator==(const type_base&) const;
2810 
2811  virtual bool
2813 
2814  virtual ~enum_type_decl();
2815 
2816  friend bool
2818  const enum_type_decl& r,
2819  change_kind* k);
2820 }; // end class enum_type_decl
2821 
2822 bool
2824 
2825 bool
2827 
2828 bool
2830  const enum_type_decl& r,
2831  change_kind* k);
2832 
2833 /// The abstraction of an enumerator
2835 {
2836  class priv;
2837  std::unique_ptr<priv> priv_;
2838 
2839 public:
2840 
2841  enumerator();
2842 
2843  ~enumerator();
2844 
2845  enumerator(const string& name, int64_t value);
2846 
2847  enumerator(const enumerator&);
2848 
2849  enumerator&
2850  operator=(const enumerator&);
2851 
2852  bool
2853  operator==(const enumerator& other) const;
2854 
2855  bool
2856  operator!=(const enumerator& other) const;
2857 
2858  const string&
2859  get_name() const;
2860 
2861  const string&
2862  get_qualified_name(bool internal = false) const;
2863 
2864  void
2865  set_name(const string& n);
2866 
2867  int64_t
2868  get_value() const;
2869 
2870  void
2871  set_value(int64_t v);
2872 
2874  get_enum_type() const;
2875 
2876  void
2878 }; // end class enum_type_def::enumerator
2879 
2880 bool
2882  const enum_type_decl &enom);
2883 
2884 bool
2885 equals(const typedef_decl&, const typedef_decl&, change_kind*);
2886 
2887 /// The abstraction of a typedef declaration.
2888 class typedef_decl : public virtual type_base, public virtual decl_base
2889 {
2890  struct priv;
2891  std::unique_ptr<priv> priv_;
2892 
2893  // Forbidden
2894  typedef_decl();
2895 
2896 public:
2897 
2898  /// Hasher for the typedef_decl type.
2899  struct hash;
2900 
2901  typedef_decl(const string& name,
2902  const type_base_sptr underlying_type,
2903  const location& locus,
2904  const string& mangled_name = "",
2905  visibility vis = VISIBILITY_DEFAULT);
2906 
2907  typedef_decl(const string& name,
2908  const environment& env,
2909  const location& locus,
2910  const string& mangled_name = "",
2911  visibility vis = VISIBILITY_DEFAULT);
2912 
2913  virtual size_t
2914  get_size_in_bits() const;
2915 
2916  virtual size_t
2917  get_alignment_in_bits() const;
2918 
2919  virtual bool
2920  operator==(const decl_base&) const;
2921 
2922  virtual bool
2923  operator==(const type_base&) const;
2924 
2925  virtual string
2926  get_pretty_representation(bool internal = false,
2927  bool qualified_name = true) const;
2928 
2929  type_base_sptr
2930  get_underlying_type() const;
2931 
2932  void
2933  set_underlying_type(const type_base_sptr&);
2934 
2935  virtual void
2936  get_qualified_name(interned_string& qualified_name,
2937  bool internal = false) const;
2938 
2939  virtual const interned_string&
2940  get_qualified_name(bool internal = false) const;
2941 
2942  virtual bool
2944 
2945  virtual ~typedef_decl();
2946 };// end class typedef_decl
2947 
2948 /// The abstraction for a data member context relationship. This
2949 /// relates a data member to its parent class.
2950 ///
2951 /// The relationship carries properties like the offset of the data
2952 /// member, if applicable.
2954 {
2955 protected:
2956  struct priv;
2957  std::unique_ptr<priv> priv_;
2958 
2959 public:
2960  dm_context_rel();
2961 
2963  bool is_laid_out,
2964  size_t offset_in_bits,
2965  access_specifier a,
2966  bool is_static);
2967 
2969 
2970  bool
2971  get_is_laid_out() const;
2972 
2973  void
2974  set_is_laid_out(bool f);
2975 
2976  size_t
2977  get_offset_in_bits() const;
2978 
2979  void
2980  set_offset_in_bits(size_t o);
2981 
2982  const var_decl*
2983  get_anonymous_data_member() const;
2984 
2985  void
2987 
2988  bool
2989  operator==(const dm_context_rel& o) const;
2990 
2991  bool
2992  operator!=(const dm_context_rel& o) const;
2993 
2994  virtual ~dm_context_rel();
2995 };// end class class_decl::dm_context_rel
2996 
2997 bool
2998 equals(const var_decl&, const var_decl&, change_kind*);
2999 
3000 bool
3002 
3003 bool
3005 
3006 /// Abstracts a variable declaration.
3007 class var_decl : public virtual decl_base
3008 {
3009  struct priv;
3010  std::unique_ptr<priv> priv_;
3011 
3012  // Forbidden
3013  var_decl();
3014 
3015  virtual void
3016  set_scope(scope_decl*);
3017 
3018 public:
3019 
3020  /// Hasher for a var_decl type.
3021  struct hash;
3022 
3023  /// Equality functor to compare pointers to variable_decl.
3024  struct ptr_equal;
3025 
3026  var_decl(const string& name,
3027  type_base_sptr type,
3028  const location& locus,
3029  const string& mangled_name,
3030  visibility vis = VISIBILITY_DEFAULT,
3031  binding bind = BINDING_NONE);
3032 
3033  virtual bool
3034  operator==(const decl_base&) const;
3035 
3036  const type_base_sptr
3037  get_type() const;
3038 
3039  void
3040  set_type(type_base_sptr&);
3041 
3042  const type_base*
3043  get_naked_type() const;
3044 
3045  binding
3046  get_binding() const;
3047 
3048  void
3049  set_binding(binding b);
3050 
3051  void
3052  set_symbol(const elf_symbol_sptr& sym);
3053 
3054  const elf_symbol_sptr&
3055  get_symbol() const;
3056 
3058  clone() const;
3059 
3061  get_id() const;
3062 
3063  virtual const interned_string&
3064  get_qualified_name(bool internal = false) const;
3065 
3066  virtual size_t
3067  get_hash() const;
3068 
3069  virtual string
3070  get_pretty_representation(bool internal = false,
3071  bool qualified_name = true) const;
3072 
3073  string
3074  get_anon_dm_reliable_name(bool qualified = true) const;
3075 
3076  virtual bool
3078 
3079  virtual ~var_decl();
3080 
3081  friend void
3082  set_data_member_offset(var_decl_sptr m, uint64_t o);
3083 
3084  friend uint64_t
3086 
3087  friend uint64_t
3088  get_data_member_offset(const var_decl& m);
3089 
3090  friend uint64_t
3092 
3093  friend uint64_t
3095 
3096  friend void
3098 
3099  friend bool
3101 
3102  friend bool
3104 }; // end class var_decl
3105 
3106 bool
3107 equals(const function_decl&, const function_decl&, change_kind*);
3108 
3109 /// Abstraction for a function declaration.
3110 class function_decl : public virtual decl_base
3111 {
3112  struct priv;
3113  // This priv pointer is not handled by a shared_ptr because
3114  // accessing the data members of the priv struct for this
3115  // function_decl shows up on performance profiles when dealing with
3116  // big binaries with a lot of types; dereferencing the shared_ptr
3117  // involves locking of some sort and that is slower than just
3118  // dereferencing a pointer likere here. There are other types for
3119  // which the priv pointer is managed using shared_ptr just fine,
3120  // because those didn't show up during our performance profiling.
3121  priv* priv_;
3122 
3123 public:
3124  /// Hasher for function_decl
3125  struct hash;
3126 
3127  /// Equality functor to compare pointers to function_decl
3128  struct ptr_equal;
3129 
3130  /// Abstraction for the parameter of a function.
3131  class parameter;
3132 
3133  /// Convenience typedef for a shared pointer on a @ref
3134  /// function_decl::parameter
3135  typedef shared_ptr<parameter> parameter_sptr;
3136 
3137  /// Convenience typedef for a vector of @ref parameter_sptr
3138  typedef std::vector<parameter_sptr> parameters;
3139 
3140  function_decl(const string& name,
3142  bool declared_inline,
3143  const location& locus,
3144  const string& mangled_name,
3145  visibility vis,
3146  binding bind);
3147 
3148  function_decl(const string& name,
3149  type_base_sptr fn_type,
3150  bool declared_inline,
3151  const location& locus,
3152  const string& mangled_name = "",
3153  visibility vis = VISIBILITY_DEFAULT,
3154  binding bind = BINDING_GLOBAL);
3155 
3156  virtual string
3157  get_pretty_representation(bool internal = false,
3158  bool qualified_name = true) const;
3159 
3160  string
3161  get_pretty_representation_of_declarator (bool internal = false) const;
3162 
3163  const std::vector<parameter_sptr >&
3164  get_parameters() const;
3165 
3166  void
3168 
3169  void
3170  append_parameters(std::vector<parameter_sptr >& parms);
3171 
3172  parameters::const_iterator
3174 
3175  const function_type_sptr
3176  get_type() const;
3177 
3178  const function_type*
3179  get_naked_type() const;
3180 
3181  const type_base_sptr
3182  get_return_type() const;
3183 
3184  void
3185  set_type(const function_type_sptr& fn_type);
3186 
3187  void
3188  set_symbol(const elf_symbol_sptr& sym);
3189 
3190  const elf_symbol_sptr&
3191  get_symbol() const;
3192 
3193  bool
3194  is_declared_inline() const;
3195 
3196  void
3197  is_declared_inline(bool);
3198 
3199  binding
3200  get_binding() const;
3201 
3203  clone() const;
3204 
3205  virtual bool
3206  operator==(const decl_base& o) const;
3207 
3208  /// Return true iff the function takes a variable number of
3209  /// parameters.
3210  ///
3211  /// @return true if the function taks a variable number
3212  /// of parameters.
3213  bool
3214  is_variadic() const;
3215 
3216  virtual size_t
3217  get_hash() const;
3218 
3220  get_id() const;
3221 
3222  virtual bool
3224 
3225  virtual ~function_decl();
3226 }; // end class function_decl
3227 
3228 bool
3230 
3231 bool
3233 
3234 bool
3235 function_decls_alias(const function_decl& f1, const function_decl& f2);
3236 
3237 bool
3239  const function_decl::parameter&,
3240  change_kind*);
3241 
3242 /// A comparison functor to compare pointer to instances of @ref
3243 /// type_or_decl_base.
3245 {
3246  /// Comparison operator for ABI artifacts.
3247  ///
3248  /// @param f the first ABI artifact to consider for the comparison.
3249  ///
3250  /// @param s the second ABI artifact to consider for the comparison.
3251  ///
3252  /// @return true iff @p f is lexicographically less than than @p s.
3253  bool
3255  const type_or_decl_base *s)
3256  {
3257  function_decl *f_fn = is_function_decl(f), *s_fn = is_function_decl(s);
3258  if (f_fn && s_fn)
3259  return function_decl_is_less_than(*f_fn, *s_fn);
3260 
3261  var_decl *f_var = is_var_decl(f), *s_var = is_var_decl(s);
3262  if (f_var && s_var)
3263  return get_name(f_var) < get_name(s_var);
3264 
3265  string l_repr = get_pretty_representation(f),
3266  r_repr = get_pretty_representation(s);
3267 
3268  return l_repr < r_repr;
3269  }
3270 
3271  /// Comparison operator for ABI artifacts.
3272  ///
3273  /// @param f the first ABI artifact to consider for the comparison.
3274  ///
3275  /// @param s the second ABI artifact to consider for the comparison.
3276  ///
3277  /// @return true iff @p f is lexicographically less than than @p s.
3278  bool
3280  const type_or_decl_base_sptr& s)
3281  {return operator()(f.get(), s.get());}
3282 }; // end struct type_or_decl_base_comp
3283 
3284 /// Abstraction of a function parameter.
3286 {
3287  struct priv;
3288  std::unique_ptr<priv> priv_;
3289 
3290 public:
3291 
3292  /// Hasher for an instance of function::parameter
3293  struct hash;
3294 
3295  parameter(const type_base_sptr type,
3296  unsigned index,
3297  const string& name,
3298  const location& loc,
3299  bool variadic_marker = false);
3300 
3301  parameter(const type_base_sptr type,
3302  unsigned index,
3303  const string& name,
3304  const location& loc,
3305  bool variadic_marker,
3306  bool is_artificial);
3307 
3308  parameter(const type_base_sptr type,
3309  const string& name,
3310  const location& loc,
3311  bool variadic_marker = false,
3312  bool is_artificial = false);
3313 
3314  parameter(const type_base_sptr type,
3315  unsigned index = 0,
3316  bool variadic_marker = false);
3317 
3318  virtual ~parameter();
3319 
3320  const type_base_sptr
3321  get_type()const;
3322 
3324  get_type_name() const;
3325 
3326  const string
3328 
3330  get_name_id() const;
3331 
3332  unsigned
3333  get_index() const;
3334 
3335  void
3336  set_index(unsigned i);
3337 
3338  bool
3339  get_variadic_marker() const;
3340 
3341  bool
3342  operator==(const parameter& o) const;
3343 
3344  virtual bool
3345  operator==(const decl_base&) const;
3346 
3347  virtual bool
3349 
3350  virtual size_t
3351  get_hash() const;
3352 
3353  virtual void
3354  get_qualified_name(interned_string& qualified_name,
3355  bool internal = false) const;
3356 
3357  virtual string
3358  get_pretty_representation(bool internal = false,
3359  bool qualified_name = true) const;
3360 }; // end class function_decl::parameter
3361 
3362 bool
3365 
3366 /// A hashing functor for a function_decl::parameter.
3368 {
3369  size_t
3370  operator()(const function_decl::parameter&) const;
3371 
3372  size_t
3373  operator()(const function_decl::parameter*) const;
3374 
3375  size_t
3376  operator()(const function_decl::parameter_sptr) const;
3377 }; // end struct function_decl::parameter::hash
3378 
3381 
3384 
3385 bool
3386 equals(const function_type&, const function_type&, change_kind*);
3387 
3388 /// Abstraction of a function type.
3389 class function_type : public virtual type_base
3390 {
3391 protected:
3392  virtual void on_canonical_type_set();
3393 
3394 public:
3395  /// Hasher for an instance of function_type
3396  struct hash;
3397 
3398  /// Convenience typedef for a shared pointer on a @ref
3399  /// function_decl::parameter
3400  typedef shared_ptr<function_decl::parameter> parameter_sptr;
3401  /// Convenience typedef for a vector of @ref parameter_sptr
3402  typedef std::vector<parameter_sptr> parameters;
3403 
3404  struct priv;
3405  std::unique_ptr<priv> priv_;
3406 
3407 private:
3408  function_type();
3409 
3410 public:
3411 
3412  function_type(type_base_sptr return_type,
3413  const parameters& parms,
3414  size_t size_in_bits,
3415  size_t alignment_in_bits);
3416 
3417  function_type(type_base_sptr return_type,
3418  size_t size_in_bits,
3419  size_t alignment_in_bits);
3420 
3421  function_type(const environment& env,
3422  size_t size_in_bits,
3423  size_t alignment_in_bits);
3424 
3425  type_base_sptr
3426  get_return_type() const;
3427 
3428  void
3429  set_return_type(type_base_sptr t);
3430 
3431  const parameters&
3432  get_parameters() const;
3433 
3434  const parameter_sptr
3436 
3437  void
3438  set_parameters(const parameters &p);
3439 
3440  void
3442 
3443  bool
3444  is_variadic() const;
3445 
3446  parameters::const_iterator
3448 
3449  parameters::const_iterator
3450  get_first_parm() const;
3451 
3452  const interned_string&
3453  get_cached_name(bool internal = false) const;
3454 
3455  virtual bool
3456  operator==(const type_base&) const;
3457 
3458  virtual string
3459  get_pretty_representation(bool internal = false,
3460  bool qualified_name = true) const;
3461 
3462  virtual bool
3464 
3465  virtual ~function_type();
3466 
3467  friend bool
3468  equals(const function_type&, const function_type&, change_kind*);
3469 };//end class function_type
3470 
3471 /// The hashing functor for @ref function_type.
3473 {
3474  size_t
3475  operator()(const function_type& t) const;
3476 
3477  size_t
3478  operator()(const function_type* t) const;
3479 
3480  size_t
3481  operator()(const function_type_sptr t) const;
3482 };// end struct function_type::hash
3483 
3484 /// Abstracts the type of a class member function.
3486 {
3487  struct priv;
3488  std::unique_ptr<priv> priv_;
3489 
3490  method_type();
3491 
3492 public:
3493 
3494  /// Hasher for intances of method_type
3495  struct hash;
3496 
3497  method_type(type_base_sptr return_type,
3498  class_or_union_sptr class_type,
3499  const std::vector<function_decl::parameter_sptr>& parms,
3500  bool is_const,
3501  size_t size_in_bits,
3502  size_t alignment_in_bits);
3503 
3504  method_type(type_base_sptr return_type,
3505  type_base_sptr class_type,
3506  const std::vector<function_decl::parameter_sptr>& parms,
3507  bool is_const,
3508  size_t size_in_bits,
3509  size_t alignment_in_bits);
3510 
3511  method_type(class_or_union_sptr class_type,
3512  bool is_const,
3513  size_t size_in_bits,
3514  size_t alignment_in_bits);
3515 
3516  method_type(const environment& env,
3517  size_t size_in_bits,
3518  size_t alignment_in_bits);
3519 
3520  class_or_union_sptr
3521  get_class_type() const;
3522 
3523  void
3524  set_class_type(const class_or_union_sptr& t);
3525 
3526  void set_is_const(bool);
3527 
3528  bool get_is_const() const;
3529 
3530  virtual ~method_type();
3531 
3532  virtual string
3533  get_pretty_representation(bool internal = false,
3534  bool qualified_name = true) const;
3535 
3536  friend interned_string
3537  get_method_type_name(const method_type& fn_type, bool internal);
3538 };// end class method_type.
3539 
3540 /// The base class of templates.
3541 class template_decl : public virtual decl_base
3542 {
3543  class priv;
3544  std::unique_ptr<priv> priv_;
3545 
3546  template_decl();
3547 
3548 public:
3549 
3550  /// Hasher.
3551  struct hash;
3552 
3553  template_decl(const environment& env,
3554  const string& name,
3555  const location& locus,
3556  visibility vis = VISIBILITY_DEFAULT);
3557 
3558  void
3560 
3561  const std::list<template_parameter_sptr>&
3562  get_template_parameters() const;
3563 
3564  virtual bool
3565  operator==(const decl_base& o) const;
3566 
3567  virtual bool
3568  operator==(const template_decl& o) const;
3569 
3570  virtual ~template_decl();
3571 };//end class template_decl
3572 
3573 /// Base class for a template parameter. Client code should use the
3574 /// more specialized type_template_parameter,
3575 /// non_type_template_parameter and template_template_parameter below.
3577 {
3578  class priv;
3579  std::unique_ptr<priv> priv_;
3580 
3581  // Forbidden
3583 
3584  public:
3585 
3586  /// Hashers.
3587  struct hash;
3588  struct dynamic_hash;
3589  struct shared_ptr_hash;
3590 
3591  template_parameter(unsigned index,
3592  template_decl_sptr enclosing_tdecl);
3593 
3594  virtual bool
3595  operator==(const template_parameter&) const;
3596 
3597  bool
3598  operator!=(const template_parameter&) const;
3599 
3600  unsigned
3601  get_index() const;
3602 
3603  const template_decl_sptr
3604  get_enclosing_template_decl() const;
3605 
3606  bool
3607  get_hashing_has_started() const;
3608 
3609  void
3610  set_hashing_has_started(bool f) const;
3611 
3612  virtual ~template_parameter();
3613 };//end class template_parameter
3614 
3616 {
3617  size_t
3618  operator()(const template_decl& t) const;
3619 };// end struct template_decl::hash
3620 
3621 /// Abstracts a type template parameter.
3622 class type_tparameter : public template_parameter, public virtual type_decl
3623 {
3624  class priv;
3625  std::unique_ptr<priv> priv_;
3626 
3627  // Forbidden
3628  type_tparameter();
3629 
3630 public:
3631 
3632  /// Hasher.
3633  struct hash;
3634 
3635  type_tparameter(unsigned index,
3636  template_decl_sptr enclosing_tdecl,
3637  const string& name,
3638  const location& locus);
3639 
3640  virtual bool
3641  operator==(const type_base&) const;
3642 
3643  virtual bool
3644  operator==(const type_decl&) const;
3645 
3646  virtual bool
3647  operator==(const decl_base&) const;
3648 
3649  virtual bool
3650  operator==(const template_parameter&) const;
3651 
3652  virtual bool
3653  operator==(const type_tparameter&) const;
3654 
3655  virtual ~type_tparameter();
3656 };// end class type_tparameter.
3657 
3658 /// Abstracts non type template parameters.
3659 class non_type_tparameter : public template_parameter, public virtual decl_base
3660 {
3661  class priv;
3662  std::unique_ptr<priv> priv_;
3663 
3664  type_base_wptr type_;
3665 
3666  // Forbidden
3668 
3669 public:
3670  /// Hasher.
3671  struct hash;
3672 
3673  non_type_tparameter(unsigned index,
3674  template_decl_sptr enclosing_tdecl,
3675  const string& name,
3676  type_base_sptr type,
3677  const location& locus);
3678  virtual size_t
3679  get_hash() const;
3680 
3681  virtual bool
3682  operator==(const decl_base&) const;
3683 
3684  virtual bool
3685  operator==(const template_parameter&) const;
3686 
3687  const type_base_sptr
3688  get_type() const;
3689 
3690  virtual ~non_type_tparameter();
3691 };// end class non_type_tparameter
3692 
3693 /// Hasher for the @ref non_type_tparameter type.
3695 {
3696  size_t
3697  operator()(const non_type_tparameter& t) const;
3698 
3699  size_t
3700  operator()(const non_type_tparameter* t) const;
3701 };
3702 
3703 class template_tparameter;
3704 
3705 /// Abstracts a template template parameter.
3707 {
3708  class priv;
3709  std::unique_ptr<priv> priv_;
3710 
3711  // Forbidden
3713 
3714 public:
3715 
3716  /// A hasher for instances of template_tparameter
3717  struct hash;
3718 
3719  template_tparameter(unsigned index,
3720  template_decl_sptr enclosing_tdecl,
3721  const string& name,
3722  const location& locus);
3723 
3724  virtual bool
3725  operator==(const type_base&) const;
3726 
3727  virtual bool
3728  operator==(const decl_base&) const;
3729 
3730  virtual bool
3731  operator==(const template_parameter&) const;
3732 
3733  virtual bool
3734  operator==(const template_decl&) const;
3735 
3736  virtual ~template_tparameter();
3737 };
3738 
3739 /// This abstracts a composition of types based on template type
3740 /// parameters. The result of the composition is a type that can be
3741 /// referred to by a template non-type parameter. Instances of this
3742 /// type can appear at the same level as template parameters, in the
3743 /// scope of a template_decl.
3744 class type_composition : public template_parameter, public virtual decl_base
3745 {
3746  class priv;
3747  std::unique_ptr<priv> priv_;
3748 
3749  type_composition();
3750 
3751 public:
3752  struct hash;
3753 
3754  type_composition(unsigned index,
3755  template_decl_sptr tdecl,
3756  type_base_sptr composed_type);
3757 
3758  const type_base_sptr
3759  get_composed_type() const;
3760 
3761  void
3762  set_composed_type(type_base_sptr t);
3763 
3764  virtual size_t
3765  get_hash() const;
3766 
3767  virtual ~type_composition();
3768 };
3769 
3770 /// Hasher for the @ref type_composition type.
3772 {
3773  size_t
3774  operator()(const type_composition& t) const;
3775 
3776  size_t
3777  operator()(const type_composition* t) const;
3778 
3779 }; //struct type_composition::hash
3780 
3781 /// Abstract a function template declaration.
3783 {
3784  class priv;
3785  std::unique_ptr<priv> priv_;
3786 
3787  // Forbidden
3788  function_tdecl();
3789 
3790 public:
3791 
3792  /// Hash functor for function templates.
3793  struct hash;
3794  struct shared_ptr_hash;
3795 
3796  function_tdecl(const environment& env,
3797  const location& locus,
3798  visibility vis = VISIBILITY_DEFAULT,
3799  binding bind = BINDING_NONE);
3800 
3802  const location& locus,
3803  visibility vis = VISIBILITY_DEFAULT,
3804  binding bind = BINDING_NONE);
3805 
3806  virtual bool
3807  operator==(const decl_base&) const;
3808 
3809  virtual bool
3810  operator==(const template_decl&) const;
3811 
3812  virtual bool
3813  operator==(const function_tdecl&) const;
3814 
3815  void
3816  set_pattern(shared_ptr<function_decl> p);
3817 
3818  shared_ptr<function_decl>
3819  get_pattern() const;
3820 
3821  binding
3822  get_binding() const;
3823 
3824  virtual bool
3826 
3827  virtual ~function_tdecl();
3828 }; // end class function_tdecl.
3829 
3830 /// Abstract a class template.
3831 class class_tdecl : public template_decl, public scope_decl
3832 {
3833  class priv;
3834  std::unique_ptr<priv> priv_;
3835 
3836  // Forbidden
3837  class_tdecl();
3838 
3839 public:
3840 
3841  /// Hashers.
3842  struct hash;
3843  struct shared_ptr_hash;
3844 
3845  class_tdecl(const environment& env, const location& locus,
3846  visibility vis = VISIBILITY_DEFAULT);
3847 
3848  class_tdecl(class_decl_sptr pattern,
3849  const location& locus,
3850  visibility vis = VISIBILITY_DEFAULT);
3851 
3852  virtual bool
3853  operator==(const decl_base&) const;
3854 
3855  virtual bool
3856  operator==(const template_decl&) const;
3857 
3858  virtual bool
3859  operator==(const class_tdecl&) const;
3860 
3861  void
3863 
3864  shared_ptr<class_decl>
3865  get_pattern() const;
3866 
3867  virtual bool
3869 
3870  virtual ~class_tdecl();
3871 };// end class class_tdecl
3872 
3873 /// The base class for member types, data members and member
3874 /// functions. Its purpose is mainly to carry the access specifier
3875 /// (and possibly other properties that might be shared by all class
3876 /// members) for the member.
3878 {
3879 protected:
3880  enum access_specifier access_;
3881  bool is_static_;
3882 
3883 private:
3884  // Forbidden
3885  member_base();
3886 
3887 public:
3888  /// Hasher.
3889  struct hash;
3890 
3891  member_base(access_specifier a, bool is_static = false)
3892  : access_(a), is_static_(is_static)
3893  {}
3894 
3895  /// Getter for the access specifier of this member.
3896  ///
3897  /// @return the access specifier for this member.
3900  {return access_;}
3901 
3902  /// Setter for the access specifier of this member.
3903  ///
3904  /// @param a the new access specifier.
3905  void
3907  {access_ = a;}
3908 
3909  /// @return true if the member is static, false otherwise.
3910  bool
3912  {return is_static_;}
3913 
3914  /// Set a flag saying if the parameter is static or not.
3915  ///
3916  /// @param f set to true if the member is static, false otherwise.
3917  void
3919  {is_static_ = f;}
3920 
3921  virtual bool
3922  operator==(const member_base& o) const;
3923 };// end class member_base
3924 
3925 /// Abstraction of the declaration of a method.
3927 {
3928  method_decl();
3929 
3930  virtual void
3931  set_scope(scope_decl*);
3932 
3933 public:
3934 
3935  method_decl(const string& name, method_type_sptr type,
3936  bool declared_inline, const location& locus,
3937  const string& mangled_name = "",
3938  visibility vis = VISIBILITY_DEFAULT,
3939  binding bind = BINDING_GLOBAL);
3940 
3941  method_decl(const string& name,
3942  function_type_sptr type,
3943  bool declared_inline,
3944  const location& locus,
3945  const string& mangled_name = "",
3946  visibility vis = VISIBILITY_DEFAULT,
3947  binding bind = BINDING_GLOBAL);
3948 
3949  method_decl(const string& name, type_base_sptr type,
3950  bool declared_inline, const location& locus,
3951  const string& mangled_name = "",
3952  visibility vis = VISIBILITY_DEFAULT,
3953  binding bind = BINDING_GLOBAL);
3954 
3955  virtual void
3956  set_linkage_name(const string&);
3957 
3958  /// @return the type of the current instance of the
3959  /// method_decl.
3960  const method_type_sptr
3961  get_type() const;
3962 
3963  void
3964  set_type(const method_type_sptr fn_type)
3965  {function_decl::set_type(fn_type);}
3966 
3967  friend bool
3969 
3970  friend void
3972 
3973  friend void
3975 
3976  friend bool
3978 
3979  friend void
3981 
3982  friend void
3984 
3985  friend bool
3986  get_member_function_is_static(const function_decl&);
3987 
3988  friend void
3989  set_member_function_is_static(const function_decl&, bool);
3990 
3991  friend bool
3993 
3994  friend void
3996 
3997  friend void
3999 
4000  friend bool
4002 
4003  friend ssize_t
4005 
4006  friend void
4008 
4009  friend void
4011 
4012  friend bool
4014 
4015  friend void
4017 
4018  virtual ~method_decl();
4019 };// end class method_decl
4020 
4021 bool
4022 operator==(const method_decl_sptr& l, const method_decl_sptr& r);
4023 
4024 bool
4025 operator!=(const method_decl_sptr& l, const method_decl_sptr& r);
4026 
4027 /// The base type of @ref class_decl and @ref union_decl
4029 {
4030 public:
4031  struct priv;
4032  priv *priv_;
4033 
4034 private:
4035  // Forbidden
4036  class_or_union();
4037 
4038 protected:
4039 
4040  virtual decl_base_sptr
4041  add_member_decl(const decl_base_sptr&);
4042 
4043  decl_base_sptr
4044  insert_member_decl(decl_base_sptr member);
4045 
4046  virtual void
4047  remove_member_decl(decl_base_sptr);
4048 
4049  void
4051 
4052 public:
4053  /// Hasher.
4054  struct hash;
4055 
4056  /// Convenience typedef
4057  /// @{
4058  typedef vector<type_base_sptr> member_types;
4059  typedef vector<var_decl_sptr> data_members;
4060  typedef vector<method_decl_sptr> member_functions;
4061  typedef unordered_map<ssize_t, member_functions> virtual_mem_fn_map_type;
4062  typedef unordered_map<string, method_decl*> string_mem_fn_ptr_map_type;
4063  typedef unordered_map<string, method_decl_sptr> string_mem_fn_sptr_map_type;
4064  /// @}
4065 
4066  class_or_union(const environment& env, const string& name,
4067  size_t size_in_bits, size_t align_in_bits,
4068  const location& locus, visibility vis,
4069  member_types& mbrs, data_members& data_mbrs,
4070  member_functions& member_fns);
4071 
4072  class_or_union(const environment& env, const string& name,
4073  size_t size_in_bits, size_t align_in_bits,
4074  const location& locus, visibility vis);
4075 
4076  class_or_union(const environment& env, const string& name,
4077  bool is_declaration_only = true);
4078 
4079  virtual void
4080  set_size_in_bits(size_t);
4081 
4082  virtual size_t
4083  get_size_in_bits() const;
4084 
4085  virtual size_t
4086  get_alignment_in_bits() const;
4087 
4088  virtual void
4089  set_alignment_in_bits(size_t);
4090 
4091  virtual size_t
4093 
4094  virtual size_t
4096 
4097  virtual size_t
4099 
4100  void
4102  bool is_laid_out, bool is_static,
4103  size_t offset_in_bits);
4104 
4105  const data_members&
4106  get_data_members() const;
4107 
4108  const var_decl_sptr
4109  find_data_member(const string&) const;
4110 
4111  const var_decl_sptr
4112  find_data_member(const var_decl_sptr&) const;
4113 
4114  const var_decl_sptr
4116 
4117  const data_members&
4119 
4120  void
4121  add_member_function(method_decl_sptr f,
4122  access_specifier a,
4123  bool is_static, bool is_ctor,
4124  bool is_dtor, bool is_const);
4125 
4126  void
4127  add_member_function(method_decl_sptr f,
4128  access_specifier a,
4129  bool is_virtual,
4130  size_t vtable_offset,
4131  bool is_static, bool is_ctor,
4132  bool is_dtor, bool is_const);
4133 
4134  const member_functions&
4135  get_member_functions() const;
4136 
4137  const method_decl*
4138  find_member_function(const string& mangled_name) const;
4139 
4140  method_decl*
4141  find_member_function(const string& mangled_name);
4142 
4143  method_decl_sptr
4144  find_member_function_sptr(const string& mangled_name);
4145 
4146  const method_decl*
4147  find_member_function_from_signature(const string& s) const;
4148 
4149  method_decl*
4150  find_member_function_from_signature(const string& s);
4151 
4152  void
4153  add_member_function_template(member_function_template_sptr);
4154 
4155  const member_function_templates&
4157 
4158  void
4159  add_member_class_template(member_class_template_sptr m);
4160 
4161  const member_class_templates&
4163 
4164  bool
4165  has_no_member() const;
4166 
4167  virtual bool
4168  operator==(const decl_base&) const;
4169 
4170  virtual bool
4171  operator==(const type_base&) const;
4172 
4173  virtual bool
4174  operator==(const class_or_union&) const;
4175 
4176  virtual bool
4178 
4179  virtual ~class_or_union();
4180 
4181  friend method_decl_sptr
4182  copy_member_function(class_or_union_sptr& t,
4183  const method_decl*m);
4184 
4185  friend method_decl_sptr
4186  copy_member_function(class_or_union_sptr& t,
4187  const method_decl_sptr& m);
4188 
4189  friend void
4190  fixup_virtual_member_function(method_decl_sptr method);
4191 
4192  friend void
4193  set_member_is_static(decl_base& d, bool s);
4194 
4195  friend bool
4196  equals(const class_or_union&, const class_or_union&, change_kind*);
4197 
4198  friend bool
4199  equals(const class_decl&, const class_decl&, change_kind*);
4200 
4201  friend class method_decl;
4202  friend class class_decl;
4203 }; // end class class_or_union
4204 
4205 method_decl_sptr
4206 copy_member_function(const class_or_union_sptr& clazz,
4207  const method_decl_sptr& f);
4208 
4209 method_decl_sptr
4210 copy_member_function(const class_or_union_sptr& clazz,
4211  const method_decl* f);
4212 
4213 bool
4214 operator==(const class_or_union_sptr& l, const class_or_union_sptr& r);
4215 
4216 bool
4217 operator!=(const class_or_union_sptr& l, const class_or_union_sptr& r);
4218 
4219 /// Hasher for the @ref class_or_union type
4221 {
4222  size_t
4223  operator()(const class_or_union& t) const;
4224 
4225  size_t
4226  operator()(const class_or_union* t) const;
4227 }; // end struct class_decl::hash
4228 
4229 /// Abstracts a class declaration.
4231 {
4232  // Forbidden
4233  class_decl();
4234 
4235 protected:
4236 
4237  decl_base_sptr
4238  insert_member_decl(decl_base_sptr member);
4239 
4240 public:
4241  /// Hasher.
4242  struct hash;
4243 
4244  /// Forward declarations.
4245  class base_spec;
4246 
4247  /// Convenience typedef
4248  /// @{
4249  typedef shared_ptr<base_spec> base_spec_sptr;
4250  typedef vector<base_spec_sptr> base_specs;
4251 
4252  /// @}
4253 
4254 protected:
4255  virtual void
4257 
4258 private:
4259  struct priv;
4260  // This priv it's not handled by a shared_ptr because accessing the
4261  // data members of the priv struct for this class_decl shows up on
4262  // performance profiles when dealing with big binaries with a lot of
4263  // types; dereferencing the shared_ptr involves locking of some sort
4264  // and that is slower than just dereferencing a pointer likere here.
4265  // There are other types for which the priv pointer is managed using
4266  // shared_ptr just fine, because those didn't show up during our
4267  // performance profiling.
4268  priv * priv_;
4269 
4270 public:
4271 
4272  class_decl(const environment& env, const string& name,
4273  size_t size_in_bits, size_t align_in_bits,
4274  bool is_struct, const location& locus,
4275  visibility vis, base_specs& bases,
4276  member_types& mbrs, data_members& data_mbrs,
4277  member_functions& member_fns);
4278 
4279  class_decl(const environment& env, const string& name,
4280  size_t size_in_bits, size_t align_in_bits,
4281  bool is_struct, const location& locus,
4282  visibility vis, base_specs& bases,
4283  member_types& mbrs, data_members& data_mbrs,
4284  member_functions& member_fns, bool is_anonymous);
4285 
4286  class_decl(const environment& env, const string& name,
4287  size_t size_in_bits, size_t align_in_bits,
4288  bool is_struct, const location& locus, visibility vis);
4289 
4290  class_decl(const environment& env, const string& name,
4291  size_t size_in_bits, size_t align_in_bits,
4292  bool is_struct, const location& locus,
4293  visibility vis, bool is_anonymous);
4294 
4295  class_decl(const environment& env, const string& name, bool is_struct,
4296  bool is_declaration_only = true);
4297 
4298  virtual string
4299  get_pretty_representation(bool internal = false,
4300  bool qualified_name = true) const;
4301 
4302  void
4303  is_struct(bool f);
4304 
4305  bool
4306  is_struct() const;
4307 
4308  void
4309  add_base_specifier(shared_ptr<base_spec> b);
4310 
4311  const base_specs&
4312  get_base_specifiers() const;
4313 
4315  find_base_class(const string&) const;
4316 
4317  const member_functions&
4318  get_virtual_mem_fns() const;
4319 
4321  get_virtual_mem_fns_map() const;
4322 
4323  void
4325 
4326  bool
4327  has_no_base_nor_member() const;
4328 
4329  bool
4331 
4332  bool
4333  has_virtual_bases() const;
4334 
4335  bool
4336  has_vtable() const;
4337 
4338  ssize_t
4339  get_biggest_vtable_offset() const;
4340 
4341  virtual size_t
4342  get_hash() const;
4343 
4344  virtual bool
4345  operator==(const decl_base&) const;
4346 
4347  virtual bool
4348  operator==(const type_base&) const;
4349 
4350  virtual bool
4351  operator==(const class_or_union&) const;
4352 
4353  virtual bool
4354  operator==(const class_decl&) const;
4355 
4356  virtual bool
4358 
4359  virtual ~class_decl();
4360 
4361  friend void
4362  fixup_virtual_member_function(method_decl_sptr method);
4363 
4364  friend void
4365  set_member_is_static(decl_base& d, bool s);
4366 
4367  friend bool
4368  equals(const class_decl&, const class_decl&, change_kind*);
4369 
4370  friend class method_decl;
4371  friend class class_or_union;
4372 };// end class class_decl
4373 
4374 bool
4375 equals(const class_decl&, const class_decl&, change_kind*);
4376 
4377 method_decl_sptr
4379  const method_decl_sptr& f);
4380 
4381 method_decl_sptr
4383  const method_decl* f);
4384 void
4385 fixup_virtual_member_function(method_decl_sptr method);
4386 
4387 /// Hasher for the @ref class_decl type
4389 {
4390  size_t
4391  operator()(const class_decl& t) const;
4392 
4393  size_t
4394  operator()(const class_decl* t) const;
4395 }; // end struct class_decl::hash
4396 
4397 enum access_specifier
4399 
4400 enum access_specifier
4401 get_member_access_specifier(const decl_base_sptr&);
4402 
4403 void
4406 
4407 void
4408 set_member_access_specifier(const decl_base_sptr&,
4410 
4411 std::ostream&
4412 operator<<(std::ostream&, access_specifier);
4413 
4414 bool
4415 operator==(const class_decl_sptr& l, const class_decl_sptr& r);
4416 
4417 bool
4418 operator!=(const class_decl_sptr& l, const class_decl_sptr& r);
4419 
4420 bool
4422  const class_decl::base_spec&,
4423  change_kind*);
4424 
4425 /// Abstraction of a base specifier in a class declaration.
4427  public virtual decl_base
4428 {
4429  struct priv;
4430  std::unique_ptr<priv> priv_;
4431 
4432  // Forbidden
4433  base_spec();
4434 
4435 public:
4436 
4437  /// Hasher.
4438  struct hash;
4439 
4441  long offset_in_bits = -1, bool is_virtual = false);
4442 
4443  base_spec(const type_base_sptr& base, access_specifier a,
4444  long offset_in_bits = -1, bool is_virtual = false);
4445 
4446  virtual ~base_spec();
4447 
4449  get_base_class() const;
4450 
4451  bool
4452  get_is_virtual() const;
4453 
4454  long
4455  get_offset_in_bits() const;
4456 
4457  virtual bool
4458  operator==(const decl_base&) const;
4459 
4460  virtual bool
4461  operator==(const member_base&) const;
4462 
4463  virtual size_t
4464  get_hash() const;
4465 
4466  virtual bool
4468 };// end class class_decl::base_spec
4469 
4470 bool
4472  const class_decl::base_spec_sptr& r);
4473 
4474 bool
4476  const class_decl::base_spec_sptr& r);
4477 
4480 
4483 
4484 /// Abstracts a union type declaration.
4486 {
4487  // Forbid
4488  union_decl();
4489 
4490 public:
4491 
4492  union_decl(const environment& env, const string& name,
4493  size_t size_in_bits, const location& locus,
4494  visibility vis, member_types& mbrs,
4495  data_members& data_mbrs, member_functions& member_fns);
4496 
4497  union_decl(const environment& env, const string& name,
4498  size_t size_in_bits, const location& locus,
4499  visibility vis, member_types& mbrs,
4500  data_members& data_mbrs, member_functions& member_fns,
4501  bool is_anonymous);
4502 
4503  union_decl(const environment& env, const string& name,
4504  size_t size_in_bits, const location& locus,
4505  visibility vis);
4506 
4507  union_decl(const environment& env, const string& name,
4508  size_t size_in_bits, const location& locus,
4509  visibility vis, bool is_anonymous);
4510 
4511  union_decl(const environment& env, const string& name,
4512  bool is_declaration_only = true);
4513 
4514  virtual string
4515  get_pretty_representation(bool internal = false,
4516  bool qualified_name = true) const;
4517 
4518  virtual bool
4519  operator==(const decl_base&) const;
4520 
4521  virtual bool
4522  operator==(const type_base&) const;
4523 
4524  virtual bool
4525  operator==(const class_or_union&) const;
4526 
4527  virtual bool
4528  operator==(const union_decl&) const;
4529 
4530  virtual bool
4532 
4533  virtual ~union_decl();
4534 }; // union_decl
4535 
4536 bool
4537 equals(const union_decl&, const union_decl&, change_kind*);
4538 
4539 method_decl_sptr
4540 copy_member_function(const union_decl_sptr& union_type,
4541  const method_decl_sptr& f);
4542 
4543 method_decl_sptr
4544 copy_member_function(const union_decl_sptr& union_type,
4545  const method_decl* f);
4546 
4547 bool
4548 operator==(const union_decl_sptr& l, const union_decl_sptr& r);
4549 
4550 bool
4551 operator!=(const union_decl_sptr& l, const union_decl_sptr& r);
4552 
4553 /// Abstraction of a member function context relationship. This
4554 /// relates a member function to its parent class.
4556 {
4557 protected:
4558  bool is_virtual_;
4559  ssize_t vtable_offset_in_bits_;
4560  bool is_constructor_;
4561  bool is_destructor_;
4562  bool is_const_;
4563 
4564 public:
4566  : context_rel(),
4567  is_virtual_(false),
4568  vtable_offset_in_bits_(-1),
4569  is_constructor_(false),
4570  is_destructor_(false),
4571  is_const_(false)
4572  {}
4573 
4575  : context_rel(s),
4576  is_virtual_(false),
4577  vtable_offset_in_bits_(-1),
4578  is_constructor_(false),
4579  is_destructor_(false),
4580  is_const_(false)
4581  {}
4582 
4584  bool is_constructor,
4585  bool is_destructor,
4586  bool is_const,
4587  bool is_virtual,
4588  size_t vtable_offset_in_bits,
4589  access_specifier access,
4590  bool is_static)
4591  : context_rel(s, access, is_static),
4592  is_virtual_(is_virtual),
4593  vtable_offset_in_bits_(vtable_offset_in_bits),
4594  is_constructor_(is_constructor),
4595  is_destructor_(is_destructor),
4596  is_const_(is_const)
4597  {}
4598 
4599  bool
4600  is_virtual() const
4601  {return is_virtual_;}
4602 
4603  void
4604  is_virtual(bool is_virtual)
4605  {is_virtual_ = is_virtual;}
4606 
4607  /// Getter for the vtable offset property.
4608  ///
4609  /// This is the vtable offset of the member function of this
4610  /// relation.
4611  ///
4612  /// @return the vtable offset property of the relation.
4613  size_t
4615  {return vtable_offset_in_bits_;}
4616 
4617  /// Setter for the vtable offset property.
4618  ///
4619  /// This is the vtable offset of the member function of this
4620  /// relation.
4621  ///
4622  /// @partam s the new vtable offset.
4623  void
4624  vtable_offset(size_t s)
4625  {vtable_offset_in_bits_ = s;}
4626 
4627  /// Getter for the 'is-constructor' property.
4628  ///
4629  /// This tells if the member function of this relation is a
4630  /// constructor.
4631  ///
4632  /// @return the is-constructor property of the relation.
4633  bool
4635  {return is_constructor_;}
4636 
4637  /// Setter for the 'is-constructor' property.
4638  ///
4639  /// @param f the new value of the the property. Is true if this is
4640  /// for a constructor, false otherwise.
4641  void
4643  {is_constructor_ = f;}
4644 
4645  /// Getter for the 'is-destructor' property.
4646  ///
4647  /// Tells if the member function of this relation is a destructor.
4648  ///
4649  /// @return the is-destructor property of the relation;
4650  bool
4652  {return is_destructor_;}
4653 
4654  /// Setter for the 'is-destructor' property.
4655  ///
4656  /// @param f the new value of the property. Is true if this is for
4657  /// a destructor, false otherwise.
4658  void
4660  {is_destructor_ = f;}
4661 
4662  /// Getter for the 'is-const' property.
4663  ///
4664  /// Tells if the member function of this relation is a const member
4665  /// function.
4666  ///
4667  /// @return the 'is-const' property of the relation.
4668  bool
4669  is_const() const
4670  {return is_const_;}
4671 
4672  /// Setter for the 'is-const' property.
4673  ///
4674  /// @param f the new value of the property. Is true if this is for
4675  /// a const entity, false otherwise.
4676  void
4677  is_const(bool f)
4678  {is_const_ = f;}
4679 
4680  virtual ~mem_fn_context_rel();
4681 }; // end class mem_fn_context_rel
4682 
4683 method_decl*
4685 
4686 method_decl*
4688 
4689 method_decl_sptr
4691 
4692 const var_decl*
4693 lookup_data_member(const type_base* type,
4694  const char* dm_name);
4695 
4696 const var_decl_sptr
4697 lookup_data_member(const type_base_sptr& type,
4698  const var_decl_sptr& dm);
4699 
4702  unsigned parm_num);
4703 
4704 /// Abstract a member function template.
4705 class member_function_template : public member_base, public virtual decl_base
4706 {
4707  bool is_constructor_;
4708  bool is_const_;
4709  shared_ptr<function_tdecl> fn_tmpl_;
4710 
4711  // Forbiden
4713 
4714 public:
4715  /// Hasher.
4716  struct hash;
4717 
4719  access_specifier access, bool is_static,
4720  bool is_constructor, bool is_const)
4721  : type_or_decl_base(f->get_environment()),
4722  decl_base(f->get_environment(), f->get_name(), location()),
4723  member_base(access, is_static), is_constructor_(is_constructor),
4724  is_const_(is_const), fn_tmpl_(f)
4725  {}
4726 
4727  bool
4728  is_constructor() const
4729  {return is_constructor_;}
4730 
4731  bool
4732  is_const() const
4733  {return is_const_;}
4734 
4735  operator const function_tdecl& () const
4736  {return *fn_tmpl_;}
4737 
4739  as_function_tdecl() const
4740  {return fn_tmpl_;}
4741 
4742  virtual bool
4743  operator==(const member_base& o) const;
4744 
4745  virtual bool
4747 };// end class member_function_template
4748 
4749 bool
4750 operator==(const member_function_template_sptr& l,
4751  const member_function_template_sptr& r);
4752 
4753 bool
4754 operator!=(const member_function_template_sptr& l,
4755  const member_function_template_sptr& r);
4756 
4757 /// Abstracts a member class template template
4759  : public member_base,
4760  public virtual decl_base
4761 {
4762  shared_ptr<class_tdecl> class_tmpl_;
4763 
4764  // Forbidden
4766 
4767 public:
4768 
4769  /// Hasher.
4770  struct hash;
4771 
4773  access_specifier access, bool is_static)
4774  : type_or_decl_base(c->get_environment()),
4775  decl_base(c->get_environment(), c->get_name(), location()),
4776  member_base(access, is_static),
4777  class_tmpl_(c)
4778  {}
4779 
4780  operator const class_tdecl& () const
4781  { return *class_tmpl_; }
4782 
4784  as_class_tdecl() const
4785  {return class_tmpl_;}
4786 
4787  virtual bool
4788  operator==(const member_base& o) const;
4789 
4790  virtual bool
4791  operator==(const decl_base&) const;
4792 
4793  virtual bool
4794  operator==(const member_class_template&) const;
4795 
4796  virtual bool
4798 };// end class member_class_template
4799 
4800 bool
4801 operator==(const member_class_template_sptr& l,
4802  const member_class_template_sptr& r);
4803 
4804 bool
4805 operator!=(const member_class_template_sptr& l,
4806  const member_class_template_sptr& r);
4807 
4808 // Forward declarations for select nested hashers.
4810 {
4811  size_t
4812  operator()(const shared_ptr<type_base> t) const;
4813 };
4814 
4816 {
4817  size_t
4818  operator()(const type_base* t) const;
4819 };
4820 
4821 /// A hashing functor for instances and pointers of @ref var_decl.
4823 {
4824  size_t
4825  operator()(const var_decl& t) const;
4826 
4827  size_t
4828  operator()(const var_decl* t) const;
4829 }; //end struct var_decl::hash
4830 
4831 /// A comparison functor for pointers to @ref var_decl.
4833 {
4834  /// Return true if the two instances of @ref var_decl are equal.
4835  ///
4836  /// @param l the first variable to compare.
4837  ///
4838  /// @param r the second variable to compare.
4839  ///
4840  /// @return true if @p l equals @p r.
4841  bool
4842  operator()(const var_decl* l, const var_decl* r) const
4843  {
4844  if (l == r)
4845  return true;
4846  if (!!l != !!r)
4847  return false;
4848  return (*l == *r);
4849  }
4850 };// end struct var_decl::ptr_equal
4851 
4852 /// A hashing functor fo instances and pointers of @ref function_decl.
4854 {
4855  size_t
4856  operator()(const function_decl& t) const;
4857 
4858  size_t
4859  operator()(const function_decl* t) const;
4860 };//end struct function_decl::hash
4861 
4862 /// Equality functor for instances of @ref function_decl
4864 {
4865  /// Tests if two pointers to @ref function_decl are equal.
4866  ///
4867  /// @param l the first pointer to @ref function_decl to consider in
4868  /// the comparison.
4869  ///
4870  /// @param r the second pointer to @ref function_decl to consider in
4871  /// the comparison.
4872  ///
4873  /// @return true if the two functions @p l and @p r are equal, false
4874  /// otherwise.
4875  bool
4876  operator()(const function_decl* l, const function_decl* r) const
4877  {
4878  if (l == r)
4879  return true;
4880  if (!!l != !!r)
4881  return false;
4882  return (*l == *r);
4883  }
4884 };// function_decl::ptr_equal
4885 
4886 /// The hashing functor for class_decl::base_spec.
4888 {
4889  size_t
4890  operator()(const base_spec& t) const;
4891 };
4892 
4893 /// The hashing functor for member_base.
4895 {
4896  size_t
4897  operator()(const member_base& m) const;
4898 };
4899 
4900 /// The hashing functor for member_function_template.
4902 {
4903  size_t
4904  operator()(const member_function_template& t) const;
4905 };
4906 
4907 /// The hashing functor for member_class_template
4909 {
4910  size_t
4911  operator()(const member_class_template& t) const;
4912 };
4913 
4915 {
4916  size_t
4917  operator()(const function_tdecl& t) const;
4918 };
4919 
4921 {
4922  size_t
4923  operator()(const shared_ptr<function_tdecl> f) const;
4924 };
4925 
4927 {
4928  size_t
4929  operator()(const class_tdecl& t) const;
4930 };
4931 
4933 {
4934  size_t
4935  operator()(const shared_ptr<class_tdecl> t) const;
4936 };
4937 
4938 /// The base class for the visitor type hierarchy used for traversing
4939 /// a translation unit.
4940 ///
4941 /// Client code willing to get notified for a certain kind of node
4942 /// during the IR traversal might want to define a visitor class that
4943 /// inherit ir_node_visitor, overload the ir_node_visitor::visit_begin()
4944 /// or ir_node_visitor::visit_end() method of its choice, and provide
4945 /// and implementation for it. If either
4946 /// ir_node_visitor::visit_begin() or ir_node_visitor::visit_end()
4947 /// return false, it means the traversal has to stop immediately after
4948 /// the methods' return. If the methods return true, it means the
4949 /// traversal keeps going.
4950 ///
4951 /// That new visitor class would then be passed to e.g,
4952 /// translation_unit::traverse or to the traverse method of any type
4953 /// where the traversal is supposed to start from.
4955 {
4956  struct priv;
4957  std::unique_ptr<priv> priv_;
4958 
4959 public:
4960 
4961  ir_node_visitor();
4962 
4963  virtual ~ir_node_visitor();
4964 
4970 
4971  virtual bool visit_begin(decl_base*);
4972  virtual bool visit_end(decl_base*);
4973 
4974  virtual bool visit_begin(scope_decl*);
4975  virtual bool visit_end(scope_decl*);
4976 
4977  virtual bool visit_begin(type_base*);
4978  virtual bool visit_end(type_base*);
4979 
4980  virtual bool visit_begin(scope_type_decl*);
4981  virtual bool visit_end(scope_type_decl*);
4982 
4983  virtual bool visit_begin(type_decl*);
4984  virtual bool visit_end(type_decl*);
4985 
4986  virtual bool visit_begin(namespace_decl*);
4987  virtual bool visit_end(namespace_decl*);
4988 
4989  virtual bool visit_begin(qualified_type_def*);
4990  virtual bool visit_end(qualified_type_def*);
4991 
4992  virtual bool visit_begin(pointer_type_def*);
4993  virtual bool visit_end(pointer_type_def*);
4994 
4995  virtual bool visit_begin(reference_type_def*);
4996  virtual bool visit_end(reference_type_def*);
4997 
4998  virtual bool visit_begin(ptr_to_mbr_type*);
4999  virtual bool visit_end(ptr_to_mbr_type*);
5000 
5001  virtual bool visit_begin(array_type_def*);
5002  virtual bool visit_end(array_type_def*);
5003 
5004  virtual bool visit_begin(array_type_def::subrange_type*);
5005  virtual bool visit_end(array_type_def::subrange_type*);
5006 
5007  virtual bool visit_begin(enum_type_decl*);
5008  virtual bool visit_end(enum_type_decl*);
5009 
5010  virtual bool visit_begin(typedef_decl*);
5011  virtual bool visit_end(typedef_decl*);
5012 
5013  virtual bool visit_begin(function_type*);
5014  virtual bool visit_end(function_type*);
5015 
5016  virtual bool visit_begin(var_decl*);
5017  virtual bool visit_end(var_decl*);
5018 
5019  virtual bool visit_begin(function_decl*);
5020  virtual bool visit_end(function_decl*);
5021 
5022  virtual bool visit_begin(function_decl::parameter*);
5023  virtual bool visit_end(function_decl::parameter*);
5024 
5025  virtual bool visit_begin(function_tdecl*);
5026  virtual bool visit_end(function_tdecl*);
5027 
5028  virtual bool visit_begin(class_tdecl*);
5029  virtual bool visit_end(class_tdecl*);
5030 
5031  virtual bool visit_begin(class_or_union *);
5032  virtual bool visit_end(class_or_union *);
5033 
5034  virtual bool visit_begin(class_decl*);
5035  virtual bool visit_end(class_decl*);
5036 
5037  virtual bool visit_begin(union_decl*);
5038  virtual bool visit_end(union_decl*);
5039 
5040  virtual bool visit_begin(class_decl::base_spec*);
5041  virtual bool visit_end(class_decl::base_spec*);
5042 
5043  virtual bool visit_begin(member_function_template*);
5044  virtual bool visit_end(member_function_template*);
5045 
5046  virtual bool visit_begin(member_class_template*);
5047  virtual bool visit_end(member_class_template*);
5048 }; // end struct ir_node_visitor
5049 
5050 // Debugging facility
5051 void
5052 fns_to_str(vector<function_decl*>::const_iterator a_begin,
5053  vector<function_decl*>::const_iterator a_end,
5054  vector<function_decl*>::const_iterator b_begin,
5055  vector<function_decl*>::const_iterator b_end,
5056  std::ostream& o);
5057 
5058 }// end namespace ir
5059 } // end namespace abigail
5060 #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:2560
void set_signed(int64_t v)
Setter of the bound value as signed.
Definition: abg-ir.cc:18796
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:18764
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
Definition: abg-ir.cc:18757
int64_t get_signed_value() const
Getter of the bound value as a signed value.
Definition: abg-ir.cc:18771
bool operator==(const bound_value &) const
Equality operator of the bound value.
Definition: abg-ir.cc:18808
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
Definition: abg-ir.cc:18779
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
Definition: abg-ir.cc:18729
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Definition: abg-ir.cc:18786
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
Definition: abg-ir.h:2545
void set_lower_bound(int64_t lb)
Setter of the lower bound.
Definition: abg-ir.cc:18972
bool is_non_finite() const
Test if the length of the subrange type is infinite.
Definition: abg-ir.cc:18999
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
Definition: abg-ir.cc:18965
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:18941
string as_string() const
Return a string representation of the sub range.
Definition: abg-ir.cc:19021
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19210
bool operator!=(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:19149
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
Definition: abg-ir.cc:18951
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:18933
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:19105
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
Definition: abg-ir.cc:18958
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:19188
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
Definition: abg-ir.cc:19044
uint64_t get_length() const
Getter of the length of the subrange type.
Definition: abg-ir.cc:18982
translation_unit::language get_language() const
Getter of the language that generated this type.
Definition: abg-ir.cc:19014
The abstraction of an array type.
Definition: abg-ir.h:2519
virtual bool is_non_finite() const
Definition: abg-ir.cc:19547
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:19577
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Definition: abg-ir.cc:19508
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
Definition: abg-ir.cc:19523
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition: abg-ir.h:2533
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19640
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
Definition: abg-ir.cc:19667
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:19486
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
Definition: abg-ir.h:2540
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:19356
translation_unit::language get_language() const
Get the language of the array.
Definition: abg-ir.cc:19475
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Definition: abg-ir.cc:19533
Abstraction of a base specifier in a class declaration.
Definition: abg-ir.h:4428
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
Definition: abg-ir.cc:24751
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
Definition: abg-ir.cc:24758
long get_offset_in_bits() const
Getter of the offset of the base.
Definition: abg-ir.cc:24765
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:24791
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Definition: abg-ir.cc:24885
virtual size_t get_hash() const
Calculate the hash value for a class_decl::base_spec.
Definition: abg-ir.cc:24772
Abstracts a class declaration.
Definition: abg-ir.h:4231
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:25289
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
Definition: abg-ir.cc:25342
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:24631
bool is_struct() const
Test if the class is a struct.
Definition: abg-ir.cc:24569
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
Definition: abg-ir.cc:24586
virtual ~class_decl()
Destructor of the class_decl type.
Definition: abg-ir.cc:25942
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:24547
bool has_vtable() const
Test if the current instance has a vtable.
Definition: abg-ir.cc:25370
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
Definition: abg-ir.cc:25384
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
Definition: abg-ir.cc:25351
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:25858
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition: abg-ir.h:4245
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
Definition: abg-ir.cc:24576
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
Definition: abg-ir.cc:24612
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
Definition: abg-ir.cc:24636
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
Definition: abg-ir.cc:25522
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
Definition: abg-ir.cc:25710
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:26245
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
Definition: abg-ir.cc:25333
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:25401
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:24596
vector< base_spec_sptr > base_specs
Convenience typedef.
Definition: abg-ir.h:4250
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:24657
The base type of class_decl and union_decl.
Definition: abg-ir.h:4029
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
Definition: abg-ir.cc:23405
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:23623
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:23556
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
Definition: abg-ir.cc:23651
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:25289
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
Definition: abg-ir.cc:23291
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
Definition: abg-ir.cc:23727
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
Definition: abg-ir.cc:23390
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Definition: abg-ir.cc:23423
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
Definition: abg-ir.cc:23741
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
Definition: abg-ir.h:4061
vector< method_decl_sptr > member_functions
Convenience typedef.
Definition: abg-ir.h:4060
const data_members & get_data_members() const
Get the data members of this class_or_union.
Definition: abg-ir.cc:23515
unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
Convenience typedef.
Definition: abg-ir.h:4062
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:23472
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:23702
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:23686
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
Definition: abg-ir.cc:23374
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
Definition: abg-ir.cc:23783
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:23279
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:23197
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
Definition: abg-ir.cc:23755
const data_members & get_non_static_data_members() const
Get the non-static data memebers of this class_or_union.
Definition: abg-ir.cc:23606
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:23660
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:23316
vector< var_decl_sptr > data_members
Convenience typedef.
Definition: abg-ir.h:4059
virtual ~class_or_union()
Destrcutor of the class_or_union type.
Definition: abg-ir.cc:23270
bool has_no_member() const
Definition: abg-ir.cc:23768
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:23817
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
Definition: abg-ir.cc:26245
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
Definition: abg-ir.cc:23342
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
Definition: abg-ir.cc:23734
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
Definition: abg-ir.cc:23358
vector< type_base_sptr > member_types
Convenience typedef.
Definition: abg-ir.h:4054
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
Definition: abg-ir.cc:23441
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:23526
friend bool equals(const class_or_union &, const class_or_union &, change_kind *)
Compares two instances of class_or_union.
Definition: abg-ir.cc:23887
unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
Convenience typedef.
Definition: abg-ir.h:4063
Abstract a class template.
Definition: abg-ir.h:3832
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
Definition: abg-ir.cc:27632
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
Definition: abg-ir.cc:27621
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:27681
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:27636
The abstraction of the relationship between an entity and its containing scope (its context)....
Definition: abg-ir.h:1247
bool operator!=(const context_rel &o) const
Inequality operator.
Definition: abg-ir.h:1313
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:1538
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
Definition: abg-ir.cc:15982
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:5203
virtual bool operator!=(const decl_base &) const
Inequality operator.
Definition: abg-ir.cc:5461
scope_decl * get_scope() const
Return the type containing the current decl, if any.
Definition: abg-ir.cc:5032
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
Definition: abg-ir.cc:4741
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:4825
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:5816
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
Definition: abg-ir.cc:5151
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
Definition: abg-ir.cc:5007
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:5187
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
Definition: abg-ir.cc:5063
void clear_qualified_name()
Clear the qualified name of this decl.
Definition: abg-ir.cc:4734
void set_name(const string &n)
Setter for the name of the decl.
Definition: abg-ir.cc:4895
const location & get_location() const
Get the location of a given declaration.
Definition: abg-ir.cc:4845
binding
ELF binding.
Definition: abg-ir.h:1589
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
Definition: abg-ir.cc:4955
const interned_string & get_name() const
Getter for the name of the current decl.
Definition: abg-ir.cc:5051
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
Definition: abg-ir.cc:5488
const interned_string & peek_qualified_name() const
Getter for the qualified name.
Definition: abg-ir.cc:4725
const context_rel * get_context_rel() const
Getter for the context relationship.
Definition: abg-ir.cc:4775
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6920
bool get_is_anonymous() const
Test if the current declaration is anonymous.
Definition: abg-ir.cc:4908
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scpe)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
Definition: abg-ir.cc:8625
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:26319
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
Definition: abg-ir.cc:5143
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:5171
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5785
friend void remove_decl_from_scope(decl_base_sptr)
Remove a given decl from its scope.
Definition: abg-ir.cc:8649
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
Definition: abg-ir.cc:4973
void set_location(const location &l)
Set the location for a given declaration.
Definition: abg-ir.cc:4883
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
Definition: abg-ir.cc:4918
void set_visibility(visibility v)
Setter for the visibility of the decl.
Definition: abg-ir.cc:5024
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4768
visibility get_visibility() const
Getter for the visibility of the decl.
Definition: abg-ir.cc:5017
visibility
ELF visibility.
Definition: abg-ir.h:1579
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
Definition: abg-ir.cc:5194
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:5477
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
Definition: abg-ir.cc:5159
const interned_string & get_linkage_name() const
Getter for the mangled name.
Definition: abg-ir.cc:5000
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5756
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
Definition: abg-ir.cc:6882
virtual ~decl_base()
Destructor of the decl_base type.
Definition: abg-ir.cc:5465
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:5450
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:5044
bool get_is_anonymous_or_has_anonymous_parent() const
Definition: abg-ir.cc:4941
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
Definition: abg-ir.cc:4930
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:4817
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
Definition: abg-ir.cc:5367
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:4794
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
Definition: abg-ir.cc:4754
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:5086
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:5267
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:20890
The abstraction for a data member context relationship. This relates a data member to its parent clas...
Definition: abg-ir.h:2954
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:3256
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
Definition: abg-ir.cc:3266
The abstraction of the version of an ELF symbol.
Definition: abg-ir.h:1194
version & operator=(const version &o)
Assign a version to the current one.
Definition: abg-ir.cc:3169
bool operator==(const version &o) const
Compares the current version against another one.
Definition: abg-ir.cc:3151
bool is_default() const
Getter for the 'is_default' property of the version.
Definition: abg-ir.cc:3131
const string & str() const
Getter for the version name.
Definition: abg-ir.cc:3117
bool operator!=(const version &o) const
Inequality operator.
Definition: abg-ir.cc:3160
Abstraction of an elf symbol.
Definition: abg-ir.h:923
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
Definition: abg-ir.cc:2254
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:2577
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
Definition: abg-ir.cc:2472
type get_type() const
Getter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2088
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
Definition: abg-ir.cc:2309
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2233
bool has_aliases() const
Check if the current elf_symbol has an alias.
Definition: abg-ir.cc:2338
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
Definition: abg-ir.cc:2078
bool is_suppressed() const
Getter for the 'is-suppressed' property.
Definition: abg-ir.cc:2270
binding
The binding of a symbol.
Definition: abg-ir.h:940
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
Definition: abg-ir.cc:2345
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:2598
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2123
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Definition: abg-ir.cc:2483
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
Definition: abg-ir.cc:2362
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
Definition: abg-ir.cc:2279
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
Definition: abg-ir.cc:2211
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
Definition: abg-ir.cc:2408
void set_size(size_t)
Setter of the size of the symbol.
Definition: abg-ir.cc:2109
const string & get_name() const
Getter for the name of the elf_symbol.
Definition: abg-ir.cc:2071
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
Definition: abg-ir.cc:2116
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:2664
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
Definition: abg-ir.cc:2202
type
The type of a symbol.
Definition: abg-ir.h:927
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
Definition: abg-ir.cc:2137
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
Definition: abg-ir.cc:2240
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2148
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
Definition: abg-ir.cc:2723
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
Definition: abg-ir.cc:2323
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
Definition: abg-ir.cc:2247
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:1994
visibility
The visibility of the symbol.
Definition: abg-ir.h:949
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Definition: abg-ir.cc:2130
bool is_common_symbol() const
Return true if the symbol is a common one.
Definition: abg-ir.cc:2441
void set_index(size_t)
Setter for the index.
Definition: abg-ir.cc:2064
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
Definition: abg-ir.cc:2156
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
Definition: abg-ir.cc:2457
size_t get_index() const
Getter for the index.
Definition: abg-ir.cc:2057
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
Definition: abg-ir.cc:2528
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:2555
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
Definition: abg-ir.cc:2050
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
Definition: abg-ir.cc:2095
bool is_public() const
Test if the current instance of elf_symbol is public or not.
Definition: abg-ir.cc:2186
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
Definition: abg-ir.cc:2225
size_t get_size() const
Getter of the size of the symbol.
Definition: abg-ir.cc:2102
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
Definition: abg-ir.cc:2164
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
Definition: abg-ir.cc:2261
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
Definition: abg-ir.cc:2330
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:2709
The abstraction of an enumerator.
Definition: abg-ir.h:2835
enumerator()
Default constructor of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:20261
bool operator!=(const enumerator &other) const
Inequality operator.
Definition: abg-ir.cc:20321
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
Definition: abg-ir.cc:20363
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
Definition: abg-ir.cc:20385
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
Definition: abg-ir.cc:20330
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
Definition: abg-ir.cc:20392
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:20378
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:20347
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
Definition: abg-ir.cc:20371
bool operator==(const enumerator &other) const
Equality operator.
Definition: abg-ir.cc:20308
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Definition: abg-ir.cc:20292
Abstracts a declaration for an enum type.
Definition: abg-ir.h:2750
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:19851
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
Definition: abg-ir.h:2763
virtual ~enum_type_decl()
Destructor for the enum type declaration.
Definition: abg-ir.cc:19839
const enumerators & get_enumerators() const
Definition: abg-ir.cc:19739
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
Definition: abg-ir.cc:19751
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:19817
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
Definition: abg-ir.cc:19734
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:20182
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:19792
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:3753
bool is_void_pointer_type(const type_base_sptr &) const
Test if a given type is the same as the void pointer type of the environment.
Definition: abg-ir.cc:3820
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:3900
const type_base_sptr & get_void_type() const
Get the unique type_decl that represents a "void" type for the current environment....
Definition: abg-ir.cc:3634
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:3852
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Definition: abg-ir.cc:3685
const type_base_sptr & get_void_pointer_type() const
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the o...
Definition: abg-ir.cc:3653
const config & get_config() const
Getter of the general configuration object.
Definition: abg-ir.cc:3890
environment()
Default constructor of the environment type.
Definition: abg-ir.cc:3281
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:4037
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
Definition: abg-ir.cc:3697
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:4060
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:3672
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:3789
virtual ~environment()
Destructor for the environment type.
Definition: abg-ir.cc:3286
interned_string intern(const string &) const
Do intern a string.
Definition: abg-ir.cc:3883
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:27820
bool do_on_the_fly_canonicalization() const
Getter for the "on-the-fly-canonicalization" flag.
Definition: abg-ir.cc:3720
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:3926
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Definition: abg-ir.cc:3294
Abstraction of a function parameter.
Definition: abg-ir.h:3286
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
Definition: abg-ir.cc:23030
interned_string get_type_name() const
Definition: abg-ir.cc:22819
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
Definition: abg-ir.cc:22857
const string get_type_pretty_representation() const
Definition: abg-ir.cc:22838
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
Definition: abg-ir.cc:22995
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:23015
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:23050
Abstraction for a function declaration.
Definition: abg-ir.h:3111
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3131
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:22208
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
Definition: abg-ir.cc:22279
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:22681
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
Definition: abg-ir.cc:22359
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Definition: abg-ir.cc:22584
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
Definition: abg-ir.cc:22245
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
Definition: abg-ir.cc:22264
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:22071
const type_base_sptr get_return_type() const
Definition: abg-ir.cc:22340
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
Definition: abg-ir.cc:22372
const std::vector< parameter_sptr > & get_parameters() const
Definition: abg-ir.cc:22345
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
Definition: abg-ir.cc:22352
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
Definition: abg-ir.cc:22301
virtual ~function_decl()
Destructor of the function_decl type.
Definition: abg-ir.cc:22697
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:22317
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
Definition: abg-ir.cc:22570
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3138
virtual size_t get_hash() const
The virtual implementation of 'get_hash' for a function_decl.
Definition: abg-ir.cc:22596
bool is_declared_inline() const
Test if the function was declared inline.
Definition: abg-ir.cc:22324
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:22140
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:22612
Abstract a function template declaration.
Definition: abg-ir.h:3783
binding get_binding() const
Get the binding of the function template.
Definition: abg-ir.cc:27469
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
Definition: abg-ir.cc:27451
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
Definition: abg-ir.cc:27462
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:27529
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Definition: abg-ir.cc:27478
Abstraction of a function type.
Definition: abg-ir.h:3390
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3396
friend bool equals(const function_type &, const function_type &, change_kind *)
Compare two function types.
Definition: abg-ir.cc:21501
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:21783
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
Definition: abg-ir.cc:21468
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:21679
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:21282
virtual bool operator==(const type_base &) const
Equality operator for function_type.
Definition: abg-ir.cc:21742
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:21453
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
Definition: abg-ir.cc:21430
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
Definition: abg-ir.cc:21699
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:21409
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
Definition: abg-ir.cc:21372
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
Definition: abg-ir.cc:21380
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
Definition: abg-ir.cc:21657
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
Definition: abg-ir.cc:21389
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
Definition: abg-ir.h:3402
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:21766
This abstracts the global scope of a given translation unit.
Definition: abg-ir.h:1952
The base class for the visitor type hierarchy used for traversing a translation unit.
Definition: abg-ir.h:4955
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:29364
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
Definition: abg-ir.cc:29408
void forget_visited_type_nodes()
Un-mark all visited type nodes.
Definition: abg-ir.cc:29398
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
Definition: abg-ir.cc:29343
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
Definition: abg-ir.cc:29374
The entry point to manage locations.
Definition: abg-ir.h:441
location create_new_location(const std::string &fle, size_t lne, size_t col)
Insert the triplet representing a source locus into our internal vector of location triplet....
Definition: abg-ir.cc:518
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:541
The source location of a token.
Definition: abg-ir.h:299
location()
Default constructor for the location type.
Definition: abg-ir.h:381
bool get_is_artificial() const
Test if the location is artificial.
Definition: abg-ir.h:340
location & operator=(const location &l)
Assignment operator of the location.
Definition: abg-ir.h:372
bool operator<(const location &other) const
"Less than" operator of the location type.
Definition: abg-ir.h:413
bool operator==(const location &other) const
Equality operator of the location type.
Definition: abg-ir.h:403
location(const location &l)
Copy constructor of the location.
Definition: abg-ir.h:362
unsigned get_value() const
Get the value of the location.
Definition: abg-ir.h:387
void set_is_artificial(bool f)
Set the artificial-ness of the location.
Definition: abg-ir.h:356
string expand(void) const
Expand the location into a string.
Definition: abg-ir.cc:483
Abstraction of a member function context relationship. This relates a member function to its parent c...
Definition: abg-ir.h:4556
bool is_constructor() const
Getter for the 'is-constructor' property.
Definition: abg-ir.h:4634
void vtable_offset(size_t s)
Setter for the vtable offset property.
Definition: abg-ir.h:4624
bool is_const() const
Getter for the 'is-const' property.
Definition: abg-ir.h:4669
void is_destructor(bool f)
Setter for the 'is-destructor' property.
Definition: abg-ir.h:4659
void is_const(bool f)
Setter for the 'is-const' property.
Definition: abg-ir.h:4677
size_t vtable_offset() const
Getter for the vtable offset property.
Definition: abg-ir.h:4614
void is_constructor(bool f)
Setter for the 'is-constructor' property.
Definition: abg-ir.h:4642
bool is_destructor() const
Getter for the 'is-destructor' property.
Definition: abg-ir.h:4651
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
Definition: abg-ir.h:3878
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
Definition: abg-ir.h:3899
bool get_is_static() const
Definition: abg-ir.h:3911
void set_access_specifier(access_specifier a)
Setter for the access specifier of this member.
Definition: abg-ir.h:3906
void set_is_static(bool f)
Set a flag saying if the parameter is static or not.
Definition: abg-ir.h:3918
Abstracts a member class template template.
Definition: abg-ir.h:4761
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
Definition: abg-ir.cc:26105
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26190
Abstract a member function template.
Definition: abg-ir.h:4706
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26084
Abstraction of the declaration of a method.
Definition: abg-ir.h:3927
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
Definition: abg-ir.cc:6779
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
Definition: abg-ir.cc:25032
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
Definition: abg-ir.cc:6920
friend void set_member_function_is_ctor(function_decl &, bool)
Setter for the is_ctor property of the member function.
Definition: abg-ir.cc:6666
friend ssize_t get_member_function_vtable_offset(const function_decl &)
Get the vtable offset of a member function.
Definition: abg-ir.cc:6819
friend bool get_member_function_is_ctor(const function_decl &)
Test whether a member function is a constructor.
Definition: abg-ir.cc:6636
friend void set_member_function_is_dtor(function_decl &, bool)
Set the destructor-ness property of a member function.
Definition: abg-ir.cc:6723
const method_type_sptr get_type() const
Definition: abg-ir.cc:25059
friend void set_member_function_vtable_offset(function_decl &, ssize_t)
Set the vtable offset of a member function.
Definition: abg-ir.cc:6852
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:6808
friend bool get_member_function_is_dtor(const function_decl &)
Test whether a member function is a destructor.
Definition: abg-ir.cc:6695
friend bool get_member_function_is_const(const function_decl &)
Test whether a member function is const.
Definition: abg-ir.cc:6751
friend bool get_member_function_is_virtual(const function_decl &)
Test if a given member function is virtual.
Definition: abg-ir.cc:6882
Abstracts the type of a class member function.
Definition: abg-ir.h:3486
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:21970
void set_is_const(bool)
Setter of the "is-const" property of method_type.
Definition: abg-ir.cc:22002
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:9411
virtual ~method_type()
The destructor of method_type.
Definition: abg-ir.cc:22013
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:21994
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
Definition: abg-ir.cc:21961
bool get_is_const() const
Getter of the "is-const" property of method_type.
Definition: abg-ir.cc:22009
The abstraction of a namespace declaration.
Definition: abg-ir.h:2197
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:17049
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17080
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
Definition: abg-ir.cc:16983
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
Definition: abg-ir.cc:17035
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:17021
Abstracts non type template parameters.
Definition: abg-ir.h:3660
const type_base_sptr get_type() const
Getter for the type of the template parameter.
Definition: abg-ir.cc:27148
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Definition: abg-ir.cc:27162
virtual size_t get_hash() const
Get the hash value of the current instance.
Definition: abg-ir.cc:27155
The abstraction of a pointer type.
Definition: abg-ir.h:2337
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
Definition: abg-ir.cc:17714
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:17849
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:17645
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17943
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
Definition: abg-ir.cc:17785
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
Definition: abg-ir.cc:17829
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
Definition: abg-ir.cc:17836
The abstraction of a pointer-to-member type.
Definition: abg-ir.h:2466
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Get the qualified name for the current ptr_to_mbr_type.
Definition: abg-ir.cc:18578
const type_base_sptr & get_containing_type() const
Getter of the type containing the member pointed-to by the current ptr_to_mbr_type.
Definition: abg-ir.cc:18521
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
Definition: abg-ir.cc:18562
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function for ptr_to_mbr_type.
Definition: abg-ir.cc:18629
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
Definition: abg-ir.cc:18512
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
Definition: abg-ir.cc:18654
The abstraction of a qualified type.
Definition: abg-ir.h:2226
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:17371
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
Definition: abg-ir.cc:17496
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
Definition: abg-ir.cc:17235
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:17484
CV
Bit field values representing the cv qualifiers of the underlying type.
Definition: abg-ir.h:2245
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:17175
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
Definition: abg-ir.cc:17475
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:17444
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
Definition: abg-ir.cc:17470
type_base_sptr get_underlying_type() const
Getter of the underlying type.
Definition: abg-ir.cc:17489
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
Definition: abg-ir.cc:17315
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Definition: abg-ir.cc:17152
Abstracts a reference type.
Definition: abg-ir.h:2400
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:18259
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
Definition: abg-ir.cc:18037
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:18381
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:18131
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
Definition: abg-ir.cc:18201
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:18360
A declaration that introduces a scope.
Definition: abg-ir.h:1809
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
Definition: abg-ir.cc:8112
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
Definition: abg-ir.cc:8315
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
Definition: abg-ir.cc:8274
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
Definition: abg-ir.cc:8290
friend void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
Definition: abg-ir.cc:8649
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
Definition: abg-ir.cc:8130
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
Definition: abg-ir.cc:8165
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
Definition: abg-ir.h:1820
bool is_empty() const
Test if the current scope is empty.
Definition: abg-ir.cc:8179
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:8595
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
Definition: abg-ir.cc:8249
std::vector< function_type_sptr > function_types
Convenience typedef for a vector of function_type_sptr.
Definition: abg-ir.h:1818
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:8361
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
Definition: abg-ir.h:1816
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:8668
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:8048
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:8547
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
Definition: abg-ir.cc:8386
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:8223
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:8260
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
Definition: abg-ir.cc:8072
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:8036
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
Definition: abg-ir.cc:8334
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
Definition: abg-ir.cc:8625
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:8501
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
Definition: abg-ir.cc:8090
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
Definition: abg-ir.cc:8148
virtual size_t get_hash() const
Return the hash value for the current instance of scope_decl.
Definition: abg-ir.cc:8426
A type that introduces a scope.
Definition: abg-ir.h:2171
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:16942
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
Definition: abg-ir.cc:16904
The base class of templates.
Definition: abg-ir.h:3542
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:26816
virtual ~template_decl()
Destructor.
Definition: abg-ir.cc:26841
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:26808
virtual bool operator==(const decl_base &o) const
Equality operator.
Definition: abg-ir.cc:26850
Base class for a template parameter. Client code should use the more specialized type_template_parame...
Definition: abg-ir.h:3577
virtual ~template_parameter()
Destructor.
Definition: abg-ir.cc:26977
bool operator!=(const template_parameter &) const
Inequality operator.
Definition: abg-ir.cc:26973
Abstracts a template template parameter.
Definition: abg-ir.h:3707
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:27235
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
Definition: abg-ir.h:686
void set_address_size(char)
Setter of the address size in this translation unit.
Definition: abg-ir.cc:1483
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:1398
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:1515
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
Definition: abg-ir.cc:1525
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
Definition: abg-ir.cc:1441
char get_address_size() const
Getter of the address size in this translation unit.
Definition: abg-ir.cc:1476
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:1379
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:15053
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
Definition: abg-ir.cc:1425
void set_language(language l)
Setter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1342
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:1551
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
Definition: abg-ir.cc:1278
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
Definition: abg-ir.cc:1465
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:1499
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:15136
const std::string & get_path() const
Get the path of the current translation unit.
Definition: abg-ir.cc:1355
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:1390
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
Definition: abg-ir.cc:1449
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
Definition: abg-ir.cc:1366
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
Definition: abg-ir.cc:1585
language
The language of the translation unit.
Definition: abg-ir.h:699
shared_ptr< scope_decl > global_scope_sptr
Convenience typedef for a shared pointer on a global_scope.
Definition: abg-ir.h:695
bool operator!=(const translation_unit &) const
Inequality operator.
Definition: abg-ir.cc:1540
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:1321
const environment & get_environment() const
Getter of the environment of the current translation_unit.
Definition: abg-ir.cc:1328
const type_maps & get_types() const
Getter of the types of the current translation_unit.
Definition: abg-ir.cc:1305
language get_language() const
Getter of the language of the source code of the translation unit.
Definition: abg-ir.cc:1335
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:1973
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
Definition: abg-ir.cc:16044
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
Definition: abg-ir.cc:16027
virtual size_t get_size_in_bits() const
Getter for the size of the type.
Definition: abg-ir.cc:16123
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:16149
friend type_base_sptr canonicalize(type_base_sptr)
Compute the canonical type of a given type.
Definition: abg-ir.cc:15880
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:15754
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
Definition: abg-ir.cc:16116
virtual bool operator!=(const type_base &) const
Inequality operator.
Definition: abg-ir.cc:16109
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
Definition: abg-ir.cc:16099
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
Definition: abg-ir.cc:16137
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
Definition: abg-ir.cc:16130
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
Definition: abg-ir.cc:16011
This abstracts a composition of types based on template type parameters. The result of the compositio...
Definition: abg-ir.h:3745
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
Definition: abg-ir.cc:27341
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
Definition: abg-ir.cc:27348
virtual size_t get_hash() const
Get the hash value for the current instance.
Definition: abg-ir.cc:27355
A basic type declaration that introduces no scope.
Definition: abg-ir.h:2108
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:16736
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:16815
virtual bool operator!=(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:16674
virtual bool operator==(const type_base &) const
Return true if both types equals.
Definition: abg-ir.cc:16630
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:16795
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Definition: abg-ir.h:593
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:662
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:765
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:716
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:620
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:634
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:730
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:648
bool empty() const
Test if the type_maps is empty.
Definition: abg-ir.cc:588
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:675
istring_type_base_wptrs_map_type & ptr_to_mbr_types()
Getter for the map that associates the name of a pointer-to-member type to the vector of instances of...
Definition: abg-ir.cc:695
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:1214
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:688
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:606
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:751
The base class of both types and declarations.
Definition: abg-ir.h:1368
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4498
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4312
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
Definition: abg-ir.cc:4301
location & get_artificial_location() const
Getter of the artificial location of the artifact.
Definition: abg-ir.cc:4458
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
Definition: abg-ir.cc:4465
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
Definition: abg-ir.cc:10678
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
Definition: abg-ir.cc:4490
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
Definition: abg-ir.cc:10956
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
Definition: abg-ir.cc:4335
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
Definition: abg-ir.cc:4324
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
Definition: abg-ir.cc:4523
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
Definition: abg-ir.cc:4355
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:4390
bool hashing_started() const
Getter for the 'hashing_started' property.
Definition: abg-ir.cc:4408
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
Definition: abg-ir.cc:4440
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:1382
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:4262
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:4282
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Definition: abg-ir.cc:4422
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:4252
friend type_or_decl_base::type_or_decl_kind operator&(type_or_decl_base::type_or_decl_kind, type_or_decl_base::type_or_decl_kind)
bitwise "AND" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
Definition: abg-ir.cc:4272
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
Definition: abg-ir.cc:10605
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Definition: abg-ir.cc:4515
Abstracts a type template parameter.
Definition: abg-ir.h:3623
virtual bool operator==(const type_base &) const
Equality operator.
Definition: abg-ir.cc:27019
The abstraction of a typedef declaration.
Definition: abg-ir.h:2889
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
Definition: abg-ir.cc:20638
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
Definition: abg-ir.cc:20623
virtual size_t get_size_in_bits() const
Return the size of the typedef.
Definition: abg-ir.cc:20473
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:20670
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
Definition: abg-ir.cc:20616
virtual bool operator==(const decl_base &) const
Equality operator.
Definition: abg-ir.cc:20553
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
Definition: abg-ir.cc:20490
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:20594
Abstracts a union type declaration.
Definition: abg-ir.h:4486
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:26610
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
Definition: abg-ir.cc:26550
virtual ~union_decl()
Destructor of the union_decl type.
Definition: abg-ir.cc:26683
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:26517
Abstracts a variable declaration.
Definition: abg-ir.h:3008
binding get_binding() const
Getter of the binding of the variable.
Definition: abg-ir.cc:20784
void set_type(type_base_sptr &)
Setter of the type of the variable.
Definition: abg-ir.cc:20766
void set_binding(binding b)
Setter of the binding of the variable.
Definition: abg-ir.cc:20791
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
Definition: abg-ir.cc:6440
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
Definition: abg-ir.cc:20829
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:21092
const type_base * get_naked_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:20777
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
Definition: abg-ir.cc:6585
const type_base_sptr get_type() const
Getter of the type of the variable.
Definition: abg-ir.cc:20759
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Definition: abg-ir.cc:21254
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:21231
friend uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
Definition: abg-ir.cc:6514
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
Definition: abg-ir.cc:20806
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:6408
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:6571
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:20822
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
Definition: abg-ir.cc:21017
virtual size_t get_hash() const
Return the hash value for the current instance.
Definition: abg-ir.cc:21059
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:21122
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:21036
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:233
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:19851
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
Definition: abg-fwd.h:219
unordered_map< string, type_base_sptr > string_type_base_sptr_map_type
A convenience typedef for a map which key is a string and which value is a type_base_sptr.
Definition: abg-ir.h:563
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:267
access_specifier
Access specifier for class members.
Definition: abg-ir.h:879
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
Definition: abg-ir.cc:22663
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:1770
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:25289
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:19436
unordered_set< type_or_decl_base_sptr, type_or_decl_hash, type_or_decl_equal > artifact_sptr_set_type
A convenience typedef for a hash set of type_or_decl_base_sptr.
Definition: abg-ir.h:550
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
Definition: abg-ir.cc:1597
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:16206
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:11997
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:886
unordered_set< const type_or_decl_base *, type_or_decl_hash, type_or_decl_equal > artifact_ptr_set_type
A convenience typedef for a hash set of const type_or_decl_base*.
Definition: abg-ir.h:555
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1323
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
Definition: abg-ir.h:1327
@ 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:1343
@ ALL_LOCAL_CHANGES_MASK
Testing (anding) against this mask means that a given IR artifact has local differences,...
Definition: abg-ir.h:1338
@ 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:1332
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:1780
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:9456
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:25999
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
Definition: abg-ir.h:904
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:191
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:2976
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:29768
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:8860
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
Definition: abg-ir.cc:5785
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition: abg-fwd.h:209
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition: abg-fwd.h:165
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:2848
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:20890
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:3614
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
Definition: abg-corpus.cc:1756
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:3057
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
Definition: abg-ir.cc:1743
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:896
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:28110
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
Definition: abg-ir.cc:2779
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:254
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
Definition: abg-corpus.cc:1784
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition: abg-fwd.h:262
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:3009
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:913
shared_ptr< context_rel > context_rel_sptr
A convenience typedef for shared pointers to context_rel.
Definition: abg-ir.h:1235
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:901
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
Definition: abg-ir.cc:1757
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10582
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
Definition: abg-ir.cc:5367
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:3034
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
Definition: abg-ir.h:891
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition: abg-fwd.h:224
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
Definition: abg-ir.cc:19932
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:1667
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:28431
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
Definition: abg-ir.cc:11841
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
Definition: abg-ir.cc:1729
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:25121
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
Definition: abg-ir.cc:5756
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition: abg-fwd.h:173
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:8940
unordered_map< interned_string, type_base_wptr, hash_interned_string > istring_type_base_wptr_map_type
A convenience typedef for a map which key is an interned_string and which value is a type_base_wptr.
Definition: abg-ir.h:568
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:8668
vector< namespace_decl_sptr > namespaces_type
A convenience typedef for vectors of namespace_decl_sptr.
Definition: abg-ir.h:2219
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:9236
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:8830
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:851
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:28388
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition: abg-fwd.h:160
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:12450
translation_unit * get_translation_unit(const decl_base &decl)
Return the translation unit a declaration belongs to.
Definition: abg-ir.cc:10381
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:1766
unordered_map< interned_string, type_or_decl_base_sptr, hash_interned_string > istring_type_or_decl_base_sptr_map_type
A convenience typedef for a map which key is an interned_string and which value is a type_base_wptr.
Definition: abg-ir.h:575
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
Definition: abg-corpus.cc:1798
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:1799
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
Definition: abg-ir.cc:10553
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:3067
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:909
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:24119
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:559
bool maybe_compare_as_member_decls(const decl_base &l, const decl_base &r, change_kind *k)
Compare the properties that belong to the "is-a-member-relation" of a decl.
Definition: abg-ir.cc:5267
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
Definition: abg-ir.cc:153
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:7975
The hashing functor for class_decl::base_spec.
Definition: abg-ir.h:4888
Hasher for the class_decl type.
Definition: abg-ir.h:4389
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:4221
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:4854
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:3368
Equality functor for instances of function_decl.
Definition: abg-ir.h:4864
bool operator()(const function_decl *l, const function_decl *r) const
Tests if two pointers to function_decl are equal.
Definition: abg-ir.h:4876
The hashing functor for function_type.
Definition: abg-ir.h:3473
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:1538
The base of an entity of the intermediate representation that is to be traversed.
Definition: abg-ir.h:462
virtual bool traverse(ir_node_visitor &v)
Traverse a given IR node and its children, calling an visitor on each node.
Definition: abg-ir.cc:29326
The hashing functor for member_base.
Definition: abg-ir.h:4895
The hashing functor for member_class_template.
Definition: abg-ir.h:4909
The hashing functor for member_function_template.
Definition: abg-ir.h:4902
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:3695
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:1938
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:834
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:843
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:2052
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:3772
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:3245
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:3279
bool operator()(const type_or_decl_base *f, const type_or_decl_base *s)
Comparison operator for ABI artifacts.
Definition: abg-ir.h:3254
The comparison functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:508
bool operator()(const type_or_decl_base_sptr &l, const type_or_decl_base_sptr &r) const
The function-call operator to compare the string representations of two ABI artifacts.
Definition: abg-ir.h:542
bool operator()(const type_or_decl_base *l, const type_or_decl_base *r) const
The function-call operator to compare the string representations of two ABI artifacts.
Definition: abg-ir.h:522
The hashing functor for using instances of type_or_decl_base as values in a hash map or set.
Definition: abg-ir.h:476
size_t operator()(const type_or_decl_base *artifact) const
Function-call Operator to hash the string representation of an ABI artifact.
Definition: abg-ir.h:486
size_t operator()(const type_or_decl_base_sptr &artifact) const
Function-call Operator to hash the string representation of an ABI artifact.
Definition: abg-ir.h:501
A predicate for deep equality of instances of type_base*.
Definition: abg-ir.h:2066
A predicate for deep equality of instances of shared_ptr<type_base>
Definition: abg-ir.h:2086
A hashing functor for instances and pointers of var_decl.
Definition: abg-ir.h:4823
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:4833
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:4842