1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 // -*- Mode: C++ -*- 3 // 4 // Copyright (C) 2013-2020 Red Hat, Inc. 5 6 /// @file 7 8 #ifndef __ABG_IRFWD_H__ 9 #define __ABG_IRFWD_H__ 10 11 #include <stdint.h> 12 #include <cstddef> 13 #include <cstdlib> 14 #include <list> 15 #include <memory> 16 #include <ostream> 17 #include <string> 18 #include <typeinfo> 19 #include <unordered_map> 20 #include <utility> // for std::rel_ops, at least. 21 #include <vector> 22 #include "abg-interned-str.h" 23 #include "abg-hash.h" 24 25 /// Toplevel namespace for libabigail. 26 namespace abigail 27 { 28 /** 29 @mainpage libabigail 30 31 This is the API documentation of the Application Binary 32 Interface Generic Analysis and Instrumentation Library, aka, 33 <em>libabigail</em>. 34 35 Check out <a href="http://sourceware.org/libabigail"> the project 36 homepage</a>! 37 38 The current libabigail source code can be browsed at 39 http://sourceware.org/git/gitweb.cgi?p=libabigail.git 40 41 It can be checked out with: 42 <em>git clone git://sourceware.org/git/libabigail.git</em> 43 44 The mailing list to send messages and patches to is 45 libabigail@sourceware.org. 46 47 You can hang out with libabigail developers and users on irc at 48 irc://irc.oftc.net\#libabigail. 49 */ 50 51 // Inject some types. 52 using std::shared_ptr; 53 using std::weak_ptr; 54 using std::unordered_map; 55 using std::string; 56 using std::vector; 57 58 // Pull in relational operators. 59 using namespace std::rel_ops; 60 61 namespace ir 62 { 63 64 // Forward declarations for corpus. 65 66 class corpus; 67 typedef shared_ptr<corpus> corpus_sptr; 68 69 class corpus_group; 70 typedef shared_ptr<corpus_group> corpus_group_sptr; 71 72 // Forward declarations for ir. 73 74 class ir_node_visitor; 75 76 struct ir_traversable_base; 77 78 /// Convenience typedef for a shared pointer to @ref 79 /// ir_traversable_base. 80 typedef shared_ptr<ir_traversable_base> ir_traversable_base_sptr; 81 82 class environment; 83 /// Convenience typedef for a shared pointer to an @ref environment 84 typedef shared_ptr<environment> environment_sptr; 85 86 class location; 87 class location_manager; 88 89 class type_or_decl_base; 90 /// A convenience typedef for a shared_ptr to @ref type_or_decl_base. 91 typedef shared_ptr<type_or_decl_base> type_or_decl_base_sptr; 92 93 class type_base; 94 95 // Convenience typedef for a shared pointer on a @ref type_base 96 typedef shared_ptr<type_base> type_base_sptr; 97 98 /// Convenience typedef for a weak pointer on a @ref type_base 99 typedef weak_ptr<type_base> type_base_wptr; 100 101 /// Convenience typedef for a weak pointer to a @ref corpus. 102 typedef weak_ptr<corpus> corpus_wptr; 103 104 class translation_unit; 105 /// Convenience typedef for a shared pointer on a @ref 106 /// translation_unit type. 107 typedef shared_ptr<translation_unit> translation_unit_sptr; 108 /// Convenience typedef for a map that associates a string to a 109 /// translation unit. 110 typedef unordered_map<string, translation_unit_sptr> string_tu_map_type; 111 112 /// A convenience typedef for a vector of type_base_wptr. 113 typedef vector<type_base_wptr> type_base_wptrs_type; 114 115 /// A convenience typedef for a map which key is an interned_string 116 /// and which value is a vector of type_base_wptr. 117 typedef unordered_map<interned_string, 118 type_base_wptrs_type, 119 hash_interned_string> istring_type_base_wptrs_map_type; 120 121 class decl_base; 122 123 // Convenience typedef for a smart pointer on @ref decl_base. 124 typedef shared_ptr<decl_base> decl_base_sptr; 125 126 class type_decl; 127 /// Convenience typedef for a shared pointer on a @ref type_decl. 128 typedef shared_ptr<type_decl> type_decl_sptr; 129 130 131 class typedef_decl; 132 133 /// Convenience typedef for a shared pointer on a @ref typedef_decl. 134 typedef shared_ptr<typedef_decl> typedef_decl_sptr; 135 136 /// Convenience typedef for a weak pointer on a @ref typedef_decl. 137 typedef weak_ptr<typedef_decl> typedef_decl_wptr; 138 139 class enum_type_decl; 140 141 /// Convenience typedef for shared pointer to a @ref enum_type_decl. 142 typedef shared_ptr<enum_type_decl> enum_type_decl_sptr; 143 144 /// Convenience typedef for a vector of @ref enum_type_decl_sptr 145 typedef vector<enum_type_decl_sptr> enums_type; 146 147 /// Convenience typedef for a weak pointer to a @ref decl_base. 148 typedef weak_ptr<decl_base> decl_base_wptr; 149 150 class class_or_union; 151 152 typedef shared_ptr<class_or_union> class_or_union_sptr; 153 typedef weak_ptr<class_or_union> class_or_union_wptr; 154 155 class scope_type_decl; 156 157 class class_decl; 158 159 /// Convenience typedef for a shared pointer on a @ref class_decl 160 typedef shared_ptr<class_decl> class_decl_sptr; 161 162 /// Convenience typedef for a vector of @ref class_decl_sptr 163 typedef vector<class_decl_sptr> classes_type; 164 165 /// Convenience typedef for a weak pointer on a @ref class_decl. 166 typedef weak_ptr<class_decl> class_decl_wptr; 167 168 class union_decl; 169 170 typedef shared_ptr<union_decl> union_decl_sptr; 171 172 class function_type; 173 /// Convenience typedef for a shared pointer on a @ref function_type 174 typedef shared_ptr<function_type> function_type_sptr; 175 176 /// Convenience typedef fo a vector of @ref function_type_sptr 177 typedef vector<function_type_sptr> function_types_type; 178 179 /// Convenience typedef for a weak pointer on a @ref function_type 180 typedef weak_ptr<function_type> function_type_wptr; 181 182 class method_type; 183 184 /// Convenience typedef for shared pointer to @ref method_type. 185 typedef shared_ptr<method_type> method_type_sptr; 186 187 class pointer_type_def; 188 189 /// Convenience typedef for a shared pointer on a @ref pointer_type_def 190 typedef shared_ptr<pointer_type_def> pointer_type_def_sptr; 191 192 class qualified_type_def; 193 194 typedef shared_ptr<qualified_type_def> qualified_type_def_sptr; 195 196 class reference_type_def; 197 198 /// Convenience typedef for a shared pointer on a @ref reference_type_def 199 typedef shared_ptr<reference_type_def> reference_type_def_sptr; 200 201 class array_type_def; 202 203 /// Convenience typedef for a shared pointer on a @ref array_type_def 204 typedef shared_ptr<array_type_def> array_type_def_sptr; 205 206 class subrange_type; 207 208 class dm_context_rel; 209 210 /// A convenience typedef for a shared pointer to dm_context_rel. 211 typedef shared_ptr<dm_context_rel> dm_context_rel_sptr; 212 213 class var_decl; 214 215 /// Convenience typedef for a shared pointer on a @ref var_decl 216 typedef shared_ptr<var_decl> var_decl_sptr; 217 218 /// Convenience typedef for a weak pointer on a @ref var_decl 219 typedef weak_ptr<var_decl> var_decl_wptr; 220 221 typedef unordered_map<interned_string, 222 var_decl*, 223 hash_interned_string> istring_var_decl_ptr_map_type; 224 225 class scope_decl; 226 227 /// Convenience typedef for a shared pointer on a @ref scope_decl. 228 typedef shared_ptr<scope_decl> scope_decl_sptr; 229 230 class function_decl; 231 232 /// Convenience typedef for a shared pointer on a @ref function_decl 233 typedef shared_ptr<function_decl> function_decl_sptr; 234 235 typedef unordered_map<interned_string, 236 function_decl*, 237 hash_interned_string> istring_function_decl_ptr_map_type; 238 239 class method_decl; 240 241 typedef shared_ptr<method_decl> method_decl_sptr; 242 243 class mem_fn_context_rel; 244 245 /// A convenience typedef for a shared pointer to @ref 246 /// mem_fn_context_rel. 247 typedef shared_ptr<mem_fn_context_rel> mem_fn_context_rel_sptr; 248 249 class namespace_decl; 250 251 /// Convenience typedef for a shared pointer on namespace_decl. 252 typedef shared_ptr<namespace_decl> namespace_decl_sptr; 253 254 class class_tdecl; 255 256 /// Convenience typedef for a shared pointer on a @ref class_tdecl 257 typedef shared_ptr<class_tdecl> class_tdecl_sptr; 258 259 class function_tdecl; 260 261 /// Convenience typedef for a shared pointer on a @ref function_tdecl 262 typedef shared_ptr<function_tdecl> function_tdecl_sptr; 263 264 class global_scope; 265 266 /// Convenience typedef for shared pointer on @ref global_scope. 267 typedef shared_ptr<global_scope> global_scope_sptr; 268 269 class node_visitor; 270 271 class template_decl; 272 273 /// Convenience typedef for a shared pointer to @ref template_decl 274 typedef shared_ptr<template_decl> template_decl_sptr; 275 276 /// Convenience typedef for a weak pointer to template_decl 277 typedef weak_ptr<template_decl> template_decl_wptr; 278 279 class template_parameter; 280 281 /// Convenience typedef for shared pointer to template parameter 282 typedef shared_ptr<template_parameter> template_parameter_sptr; 283 284 class non_type_tparameter; 285 286 /// Convenience typedef for shared pointer to @ref 287 /// non_type_template_parameter 288 typedef shared_ptr<non_type_tparameter> non_type_tparameter_sptr; 289 290 class type_tparameter; 291 292 class template_tparameter; 293 294 /// Convenience typedef for a shared_ptr to @ref template_tparameter. 295 typedef shared_ptr<template_tparameter> template_tparameter_sptr; 296 297 /// Convenience typedef for a shared pointer to @ref type_tparameter. 298 typedef shared_ptr<type_tparameter> type_tparameter_sptr; 299 300 class type_composition; 301 302 class member_function_template; 303 typedef shared_ptr<member_function_template> member_function_template_sptr; 304 typedef vector<member_function_template_sptr> member_function_templates; 305 306 class member_class_template; 307 typedef shared_ptr<member_class_template> member_class_template_sptr; 308 typedef vector<member_class_template_sptr> member_class_templates; 309 310 /// Convenience typedef for shared pointer to type_composition 311 typedef shared_ptr<type_composition> type_composition_sptr; 312 313 decl_base_sptr 314 add_decl_to_scope(decl_base_sptr, scope_decl*); 315 316 decl_base_sptr 317 add_decl_to_scope(decl_base_sptr, const scope_decl_sptr&); 318 319 const global_scope* 320 get_global_scope(const decl_base&); 321 322 const global_scope* 323 get_global_scope(const decl_base*); 324 325 const global_scope* 326 get_global_scope(const decl_base_sptr); 327 328 translation_unit* 329 get_translation_unit(const decl_base&); 330 331 translation_unit* 332 get_translation_unit(const decl_base*); 333 334 translation_unit* 335 get_translation_unit(const decl_base_sptr); 336 337 bool 338 is_global_scope(const scope_decl&); 339 340 const global_scope* 341 is_global_scope(const scope_decl*); 342 343 bool 344 is_global_scope(const scope_decl_sptr); 345 346 bool 347 is_at_global_scope(const decl_base&); 348 349 bool 350 is_at_global_scope(const decl_base_sptr); 351 352 class_or_union* 353 is_at_class_scope(const decl_base_sptr); 354 355 class_or_union* 356 is_at_class_scope(const decl_base*); 357 358 class_or_union* 359 is_at_class_scope(const decl_base&); 360 361 bool 362 is_at_template_scope(const decl_base_sptr); 363 364 bool 365 is_template_parameter(const decl_base_sptr); 366 367 function_decl* 368 is_function_decl(const type_or_decl_base*); 369 370 function_decl_sptr 371 is_function_decl(const type_or_decl_base_sptr&); 372 373 bool 374 is_function_decl(const type_or_decl_base&); 375 376 decl_base* 377 is_decl(const type_or_decl_base*); 378 379 decl_base_sptr 380 is_decl(const type_or_decl_base_sptr&); 381 382 decl_base* 383 is_decl_slow(const type_or_decl_base*); 384 385 decl_base_sptr 386 is_decl_slow(const type_or_decl_base_sptr&); 387 388 bool 389 is_type(const type_or_decl_base&); 390 391 type_base* 392 is_type(const type_or_decl_base*); 393 394 type_base_sptr 395 is_type(const type_or_decl_base_sptr& tod); 396 397 bool 398 is_anonymous_type(type_base*); 399 400 bool 401 is_anonymous_type(const type_base_sptr&); 402 403 const type_decl* 404 is_type_decl(const type_or_decl_base*); 405 406 type_decl_sptr 407 is_type_decl(const type_or_decl_base_sptr&); 408 409 typedef_decl_sptr 410 is_typedef(const type_or_decl_base_sptr); 411 412 const typedef_decl* 413 is_typedef(const type_base*); 414 415 typedef_decl* 416 is_typedef(type_base*); 417 418 enum_type_decl_sptr 419 is_compatible_with_enum_type(const type_base_sptr&); 420 421 enum_type_decl_sptr 422 is_compatible_with_enum_type(const decl_base_sptr&); 423 424 enum_type_decl_sptr 425 is_enum_type(const type_or_decl_base_sptr&); 426 427 const enum_type_decl* 428 is_enum_type(const type_or_decl_base*); 429 430 bool 431 is_class_type(const type_or_decl_base&); 432 433 class_decl* 434 is_class_type(const type_or_decl_base*); 435 436 class_decl_sptr 437 is_class_type(const type_or_decl_base_sptr&); 438 439 bool 440 is_declaration_only_class_or_union_type(const type_base *t); 441 442 bool 443 is_declaration_only_class_or_union_type(const type_base_sptr&); 444 445 class_or_union* 446 is_class_or_union_type(const type_or_decl_base*); 447 448 class_or_union_sptr 449 is_class_or_union_type(const type_or_decl_base_sptr&); 450 451 bool 452 is_union_type(const type_or_decl_base&); 453 454 union_decl* 455 is_union_type(const type_or_decl_base*); 456 457 union_decl_sptr 458 is_union_type(const type_or_decl_base_sptr&); 459 460 class_decl_sptr 461 is_compatible_with_class_type(const type_base_sptr&); 462 463 class_decl_sptr 464 is_compatible_with_class_type(const decl_base_sptr&); 465 466 pointer_type_def* 467 is_pointer_type(type_or_decl_base*); 468 469 const pointer_type_def* 470 is_pointer_type(const type_or_decl_base*); 471 472 pointer_type_def_sptr 473 is_pointer_type(const type_or_decl_base_sptr&); 474 475 reference_type_def* 476 is_reference_type(type_or_decl_base*); 477 478 const reference_type_def* 479 is_reference_type(const type_or_decl_base*); 480 481 reference_type_def_sptr 482 is_reference_type(const type_or_decl_base_sptr&); 483 484 const type_base* 485 is_void_pointer_type(const type_base*); 486 487 qualified_type_def* 488 is_qualified_type(const type_or_decl_base*); 489 490 qualified_type_def_sptr 491 is_qualified_type(const type_or_decl_base_sptr&); 492 493 type_base_sptr 494 look_through_no_op_qualified_type(const shared_ptr<type_base>& t); 495 496 function_type_sptr 497 is_function_type(const type_or_decl_base_sptr&); 498 499 function_type* 500 is_function_type(type_or_decl_base*); 501 502 const function_type* 503 is_function_type(const type_or_decl_base*); 504 505 method_type_sptr 506 is_method_type(const type_or_decl_base_sptr&); 507 508 const method_type* 509 is_method_type(const type_or_decl_base*); 510 511 method_type* 512 is_method_type(type_or_decl_base*); 513 514 class_or_union_sptr 515 look_through_decl_only_class(const class_or_union&); 516 517 class_or_union_sptr 518 look_through_decl_only_class(class_or_union_sptr); 519 520 class_or_union* 521 look_through_decl_only_class(class_or_union*); 522 523 enum_type_decl_sptr 524 look_through_decl_only_enum(const enum_type_decl&); 525 526 enum_type_decl_sptr 527 look_through_decl_only_enum(enum_type_decl_sptr); 528 529 decl_base_sptr 530 look_through_decl_only(const decl_base&); 531 532 decl_base* 533 look_through_decl_only(decl_base*); 534 535 decl_base_sptr 536 look_through_decl_only(const decl_base_sptr&); 537 538 var_decl* 539 is_var_decl(const type_or_decl_base*); 540 541 var_decl_sptr 542 is_var_decl(const type_or_decl_base_sptr&); 543 544 namespace_decl_sptr 545 is_namespace(const decl_base_sptr&); 546 547 namespace_decl* 548 is_namespace(const decl_base*); 549 550 bool 551 is_template_parm_composition_type(const decl_base_sptr); 552 553 bool 554 is_template_decl(const decl_base_sptr); 555 556 bool 557 is_function_template_pattern(const decl_base_sptr); 558 559 560 decl_base_sptr 561 insert_decl_into_scope(decl_base_sptr, 562 vector<decl_base_sptr >::iterator, 563 scope_decl*); 564 565 decl_base_sptr 566 insert_decl_into_scope(decl_base_sptr, 567 vector<decl_base_sptr >::iterator, 568 scope_decl_sptr); 569 570 bool 571 has_scope(const decl_base&); 572 573 bool 574 has_scope(const decl_base_sptr); 575 576 bool 577 is_member_decl(const decl_base_sptr); 578 579 bool 580 is_member_decl(const decl_base*); 581 582 bool 583 is_member_decl(const decl_base&); 584 585 scope_decl* 586 is_scope_decl(decl_base*); 587 588 scope_decl_sptr 589 is_scope_decl(const decl_base_sptr&); 590 591 bool 592 is_member_type(const type_base_sptr&); 593 594 bool 595 is_user_defined_type(const type_base*); 596 597 bool 598 is_user_defined_type(const type_base_sptr&); 599 600 void 601 remove_decl_from_scope(decl_base_sptr); 602 603 bool 604 get_member_is_static(const decl_base&); 605 606 bool 607 get_member_is_static(const decl_base*); 608 609 bool 610 get_member_is_static(const decl_base_sptr&); 611 612 void 613 set_member_is_static(decl_base&, bool); 614 615 void 616 set_member_is_static(const decl_base_sptr&, bool); 617 618 bool 619 is_data_member(const var_decl&); 620 621 var_decl* 622 is_data_member(const type_or_decl_base*); 623 624 bool 625 is_data_member(const var_decl*); 626 627 var_decl_sptr 628 is_data_member(const type_or_decl_base_sptr&); 629 630 bool 631 is_data_member(const var_decl_sptr); 632 633 var_decl_sptr 634 is_data_member(const decl_base_sptr&); 635 636 var_decl* 637 is_data_member(const decl_base *); 638 639 var_decl* 640 is_data_member(const decl_base *); 641 642 const var_decl_sptr 643 get_next_data_member(const class_or_union_sptr&, const var_decl_sptr&); 644 645 bool 646 is_anonymous_data_member(const decl_base&); 647 648 const var_decl* 649 is_anonymous_data_member(const type_or_decl_base*); 650 651 const var_decl* 652 is_anonymous_data_member(const decl_base*); 653 654 var_decl_sptr 655 is_anonymous_data_member(const type_or_decl_base_sptr&); 656 657 var_decl_sptr 658 is_anonymous_data_member(const decl_base_sptr&); 659 660 var_decl_sptr 661 is_anonymous_data_member(const var_decl_sptr&); 662 663 const var_decl* 664 is_anonymous_data_member(const var_decl*); 665 666 bool 667 is_anonymous_data_member(const var_decl&); 668 669 const var_decl_sptr 670 get_first_non_anonymous_data_member(const var_decl_sptr); 671 672 var_decl_sptr 673 find_data_member_from_anonymous_data_member(const var_decl_sptr&, 674 const string&); 675 676 class_or_union* 677 anonymous_data_member_to_class_or_union(const var_decl*); 678 679 class_or_union_sptr 680 anonymous_data_member_to_class_or_union(const var_decl_sptr&); 681 682 const class_or_union_sptr 683 data_member_has_anonymous_type(const var_decl& d); 684 685 const class_or_union_sptr 686 data_member_has_anonymous_type(const var_decl* d); 687 688 const class_or_union_sptr 689 data_member_has_anonymous_type(const var_decl_sptr& d); 690 691 array_type_def* 692 is_array_type(const type_or_decl_base* decl); 693 694 array_type_def_sptr 695 is_array_type(const type_or_decl_base_sptr& decl); 696 697 array_type_def_sptr 698 is_array_of_qualified_element(const type_base_sptr&); 699 700 qualified_type_def_sptr 701 is_array_of_qualified_element(const array_type_def_sptr&); 702 703 array_type_def_sptr 704 is_typedef_of_array(const type_base_sptr&); 705 706 void 707 set_data_member_offset(var_decl_sptr, uint64_t); 708 709 uint64_t 710 get_data_member_offset(const var_decl&); 711 712 uint64_t 713 get_data_member_offset(const var_decl_sptr); 714 715 uint64_t 716 get_data_member_offset(const decl_base_sptr); 717 718 uint64_t 719 get_absolute_data_member_offset(const var_decl&); 720 721 uint64_t 722 get_var_size_in_bits(const var_decl_sptr&); 723 724 void 725 set_data_member_is_laid_out(var_decl_sptr, bool); 726 727 bool 728 get_data_member_is_laid_out(const var_decl&); 729 730 bool 731 get_data_member_is_laid_out(const var_decl_sptr); 732 733 bool 734 is_member_function(const function_decl&); 735 736 bool 737 is_member_function(const function_decl*); 738 739 bool 740 is_member_function(const function_decl_sptr&); 741 742 bool 743 get_member_function_is_ctor(const function_decl&); 744 745 bool 746 get_member_function_is_ctor(const function_decl_sptr&); 747 748 void 749 set_member_function_is_ctor(const function_decl&, bool); 750 751 void 752 set_member_function_is_ctor(const function_decl_sptr&, bool); 753 754 bool 755 get_member_function_is_dtor(const function_decl&); 756 757 bool 758 get_member_function_is_dtor(const function_decl_sptr&); 759 760 void 761 set_member_function_is_dtor(function_decl&, bool); 762 763 void 764 set_member_function_is_dtor(const function_decl_sptr&, bool); 765 766 bool 767 get_member_function_is_const(const function_decl&); 768 769 bool 770 get_member_function_is_const(const function_decl_sptr&); 771 772 void 773 set_member_function_is_const(function_decl&, bool); 774 775 void 776 set_member_function_is_const(const function_decl_sptr&, bool); 777 778 bool 779 member_function_has_vtable_offset(const function_decl&); 780 781 ssize_t 782 get_member_function_vtable_offset(const function_decl&); 783 784 ssize_t 785 get_member_function_vtable_offset(const function_decl_sptr&); 786 787 void 788 set_member_function_vtable_offset(const function_decl& f, 789 ssize_t s); 790 791 void 792 set_member_function_vtable_offset(const function_decl_sptr &f, 793 ssize_t s); 794 795 bool 796 get_member_function_is_virtual(const function_decl&); 797 798 bool 799 get_member_function_is_virtual(const function_decl_sptr&); 800 801 bool 802 get_member_function_is_virtual(const function_decl*); 803 804 void 805 set_member_function_is_virtual(function_decl&, bool); 806 807 void 808 set_member_function_is_virtual(const function_decl_sptr&, bool); 809 810 type_base_sptr 811 strip_typedef(const type_base_sptr); 812 813 type_base_sptr 814 peel_typedef_type(const type_base_sptr&); 815 816 const type_base* 817 peel_typedef_type(const type_base*); 818 819 type_base_sptr 820 peel_pointer_type(const type_base_sptr&); 821 822 const type_base* 823 peel_pointer_type(const type_base*); 824 825 type_base_sptr 826 peel_reference_type(const type_base_sptr&); 827 828 const type_base* 829 peel_reference_type(const type_base*); 830 831 const type_base_sptr 832 peel_array_type(const type_base_sptr&); 833 834 const type_base* 835 peel_array_type(const type_base*); 836 837 const type_base* 838 peel_qualified_type(const type_base*); 839 840 const type_base_sptr 841 peel_qualified_type(const type_base_sptr&); 842 843 type_base* 844 peel_qualified_or_typedef_type(const type_base* type); 845 846 type_base_sptr 847 peel_qualified_or_typedef_type(const type_base_sptr &type); 848 849 type_base_sptr 850 peel_typedef_pointer_or_reference_type(const type_base_sptr); 851 852 type_base* 853 peel_typedef_pointer_or_reference_type(const type_base* type); 854 855 type_base* 856 peel_pointer_or_reference_type(const type_base *type, 857 bool peel_qualified_type = true); 858 859 array_type_def_sptr 860 clone_array(const array_type_def_sptr& array); 861 862 typedef_decl_sptr 863 clone_typedef(const typedef_decl_sptr& t); 864 865 qualified_type_def_sptr 866 clone_qualified_type(const qualified_type_def_sptr& t); 867 868 type_base_sptr 869 clone_array_tree(const type_base_sptr t); 870 871 string 872 get_name(const type_or_decl_base*, bool qualified = true); 873 874 string 875 get_name(const type_or_decl_base_sptr&, 876 bool qualified = true); 877 878 location 879 get_location(const type_base_sptr& type); 880 881 location 882 get_location(const decl_base_sptr& decl); 883 884 string 885 build_qualified_name(const scope_decl* scope, const string& name); 886 887 string 888 build_qualified_name(const scope_decl* scope, 889 const type_base_sptr& type); 890 891 scope_decl* 892 get_type_scope(type_base*); 893 894 scope_decl* 895 get_type_scope(const type_base_sptr&); 896 897 interned_string 898 get_type_name(const type_base_sptr&, 899 bool qualified = true, 900 bool internal = false); 901 902 interned_string 903 get_type_name(const type_base*, 904 bool qualified = true, 905 bool internal = false); 906 907 interned_string 908 get_type_name(const type_base&, 909 bool qualified = true, 910 bool internal = false); 911 912 interned_string 913 get_name_of_pointer_to_type(const type_base& pointed_to_type, 914 bool qualified = true, 915 bool internal = false); 916 917 interned_string 918 get_name_of_reference_to_type(const type_base& pointed_to_type, 919 bool lvalue_reference = false, 920 bool qualified = true, 921 bool internal = false); 922 923 interned_string 924 get_function_type_name(const function_type_sptr&, 925 bool internal = false); 926 927 interned_string 928 get_function_type_name(const function_type*, bool internal = false); 929 930 interned_string 931 get_function_type_name(const function_type&, bool internal = false); 932 933 interned_string 934 get_method_type_name(const method_type_sptr&, bool internal = false); 935 936 interned_string 937 get_method_type_name(const method_type*, bool internal = false); 938 939 interned_string 940 get_method_type_name(const method_type&, bool internal = false); 941 942 string 943 get_pretty_representation(const decl_base*, bool internal = false); 944 945 string 946 get_pretty_representation(const type_base*, bool internal = false); 947 948 string 949 get_pretty_representation(const type_or_decl_base*, bool internal = false); 950 951 string 952 get_pretty_representation(const type_or_decl_base_sptr&, 953 bool internal = false); 954 955 string 956 get_pretty_representation(const decl_base_sptr&, bool internal = false); 957 958 string 959 get_pretty_representation(const type_base_sptr&, bool internal = false); 960 961 string 962 get_pretty_representation(const function_type&, bool internal = false); 963 964 string 965 get_pretty_representation(const function_type*, bool internal = false); 966 967 string 968 get_pretty_representation(const function_type_sptr&, 969 bool internal = false); 970 971 string 972 get_pretty_representation(const method_type&, bool internal = false); 973 974 string 975 get_pretty_representation(const method_type*, bool internal = false); 976 977 string 978 get_pretty_representation(const method_type_sptr&, 979 bool internal = false); 980 981 string 982 get_class_or_union_flat_representation(const class_or_union& cou, 983 const string& indent, 984 bool one_line, 985 bool internal, 986 bool qualified_name = true); 987 988 string 989 get_class_or_union_flat_representation(const class_or_union* cou, 990 const string& indent, 991 bool one_line, 992 bool internal, 993 bool qualified_name = true); 994 995 string 996 get_class_or_union_flat_representation(const class_or_union_sptr& cou, 997 const string& indent, 998 bool one_line, 999 bool internal, 1000 bool qualified_name = true); 1001 1002 bool 1003 odr_is_relevant(const type_or_decl_base&); 1004 1005 const decl_base* 1006 get_type_declaration(const type_base*); 1007 1008 decl_base* 1009 get_type_declaration(type_base*); 1010 1011 decl_base_sptr 1012 get_type_declaration(const type_base_sptr); 1013 1014 bool 1015 types_are_compatible(const type_base_sptr, 1016 const type_base_sptr); 1017 1018 bool 1019 types_are_compatible(const decl_base_sptr, 1020 const decl_base_sptr); 1021 1022 const scope_decl* 1023 get_top_most_scope_under(const decl_base*, 1024 const scope_decl*); 1025 1026 const scope_decl* 1027 get_top_most_scope_under(const decl_base_sptr, 1028 const scope_decl*); 1029 1030 const scope_decl* 1031 get_top_most_scope_under(const decl_base_sptr, 1032 const scope_decl_sptr); 1033 1034 void 1035 fqn_to_components(const std::string&, 1036 std::list<string>&); 1037 1038 string 1039 components_to_type_name(const std::list<string>&); 1040 1041 type_decl_sptr 1042 lookup_basic_type(const type_decl&, const translation_unit&); 1043 1044 type_decl_sptr 1045 lookup_basic_type(const interned_string&, const translation_unit&); 1046 1047 type_decl_sptr 1048 lookup_basic_type(const string&, const translation_unit&); 1049 1050 type_decl_sptr 1051 lookup_basic_type(const type_decl&, const corpus&); 1052 1053 type_decl_sptr 1054 lookup_basic_type(const string&, const corpus&); 1055 1056 type_decl_sptr 1057 lookup_basic_type(const interned_string&, const corpus&); 1058 1059 type_decl_sptr 1060 lookup_basic_type_per_location(const interned_string&, const corpus&); 1061 1062 type_decl_sptr 1063 lookup_basic_type_per_location(const string&, const corpus&); 1064 1065 class_decl_sptr 1066 lookup_class_type(const class_decl&, const translation_unit&); 1067 1068 class_decl_sptr 1069 lookup_class_type(const interned_string&, const translation_unit&); 1070 1071 class_decl_sptr 1072 lookup_class_type(const string&, const translation_unit&); 1073 1074 class_decl_sptr 1075 lookup_class_type(const class_decl&, const corpus&); 1076 1077 class_decl_sptr 1078 lookup_class_type(const interned_string&, const corpus&); 1079 1080 const type_base_wptrs_type* 1081 lookup_class_types(const interned_string&, const corpus&); 1082 1083 const type_base_wptrs_type* 1084 lookup_class_types(const string&, const corpus&); 1085 1086 class_decl_sptr 1087 lookup_class_type_per_location(const interned_string&, const corpus&); 1088 1089 class_decl_sptr 1090 lookup_class_type_per_location(const string&, const corpus&); 1091 1092 class_decl_sptr 1093 lookup_class_type(const string&, const corpus&); 1094 1095 class_decl_sptr 1096 lookup_class_type_through_scopes(const std::list<string>&, 1097 const translation_unit&); 1098 1099 union_decl_sptr 1100 lookup_union_type(const interned_string&, const translation_unit&); 1101 1102 union_decl_sptr 1103 lookup_union_type(const interned_string&, const corpus&); 1104 1105 union_decl_sptr 1106 lookup_union_type_per_location(const interned_string&, const corpus&); 1107 1108 union_decl_sptr 1109 lookup_union_type_per_location(const string&, const corpus&); 1110 1111 union_decl_sptr 1112 lookup_union_type(const string&, const corpus&); 1113 1114 enum_type_decl_sptr 1115 lookup_enum_type(const enum_type_decl&, const translation_unit&); 1116 1117 enum_type_decl_sptr 1118 lookup_enum_type(const string&, const translation_unit&); 1119 1120 enum_type_decl_sptr 1121 lookup_enum_type(const enum_type_decl&, const corpus&); 1122 1123 enum_type_decl_sptr 1124 lookup_enum_type(const string&, const corpus&); 1125 1126 enum_type_decl_sptr 1127 lookup_enum_type(const interned_string&, const corpus&); 1128 1129 const type_base_wptrs_type* 1130 lookup_enum_types(const interned_string&, const corpus&); 1131 1132 const type_base_wptrs_type* 1133 lookup_enum_types(const string&, const corpus&); 1134 1135 enum_type_decl_sptr 1136 lookup_enum_type_per_location(const interned_string&, const corpus&); 1137 1138 enum_type_decl_sptr 1139 lookup_enum_type_per_location(const string&, const corpus&); 1140 1141 typedef_decl_sptr 1142 lookup_typedef_type(const typedef_decl&, const translation_unit&); 1143 1144 typedef_decl_sptr 1145 lookup_typedef_type(const typedef_decl&, const corpus&); 1146 1147 typedef_decl_sptr 1148 lookup_typedef_type(const interned_string& type_name, 1149 const translation_unit& tu); 1150 1151 typedef_decl_sptr 1152 lookup_typedef_type(const string& type_name, const translation_unit& tu); 1153 1154 typedef_decl_sptr 1155 lookup_typedef_type(const interned_string&, const corpus&); 1156 1157 typedef_decl_sptr 1158 lookup_typedef_type_per_location(const interned_string&, const corpus &); 1159 1160 typedef_decl_sptr 1161 lookup_typedef_type_per_location(const string&, const corpus &); 1162 1163 typedef_decl_sptr 1164 lookup_typedef_type(const string&, const corpus&); 1165 1166 type_base_sptr 1167 lookup_class_or_typedef_type(const string&, const translation_unit&); 1168 1169 type_base_sptr 1170 lookup_class_typedef_or_enum_type(const string&, const translation_unit&); 1171 1172 type_base_sptr 1173 lookup_class_or_typedef_type(const string&, const corpus&); 1174 1175 type_base_sptr 1176 lookup_class_typedef_or_enum_type(const string&, const corpus&); 1177 1178 qualified_type_def_sptr 1179 lookup_qualified_type(const qualified_type_def&, const translation_unit&); 1180 1181 qualified_type_def_sptr 1182 lookup_qualified_type(const string&, const translation_unit&); 1183 1184 qualified_type_def_sptr 1185 lookup_qualified_type(const qualified_type_def&, const corpus&); 1186 1187 qualified_type_def_sptr 1188 lookup_qualified_type(const interned_string&, const corpus&); 1189 1190 pointer_type_def_sptr 1191 lookup_pointer_type(const pointer_type_def&, const translation_unit&); 1192 1193 pointer_type_def_sptr 1194 lookup_pointer_type(const string&, const translation_unit&); 1195 1196 pointer_type_def_sptr 1197 lookup_pointer_type(const type_base_sptr& pointed_to_type, 1198 const translation_unit& tu); 1199 1200 pointer_type_def_sptr 1201 lookup_pointer_type(const pointer_type_def&, const corpus&); 1202 1203 pointer_type_def_sptr 1204 lookup_pointer_type(const interned_string&, const corpus&); 1205 1206 const reference_type_def_sptr 1207 lookup_reference_type(const reference_type_def&, const translation_unit&); 1208 1209 const reference_type_def_sptr 1210 lookup_reference_type(const string&, const translation_unit&); 1211 1212 const reference_type_def_sptr 1213 lookup_reference_type(const type_base_sptr& pointed_to_type, 1214 bool lvalue_reference, 1215 const translation_unit& tu); 1216 1217 reference_type_def_sptr 1218 lookup_reference_type(const reference_type_def&, const corpus&); 1219 1220 reference_type_def_sptr 1221 lookup_reference_type(const interned_string&, const corpus&); 1222 1223 array_type_def_sptr 1224 lookup_array_type(const array_type_def&, const translation_unit&); 1225 1226 array_type_def_sptr 1227 lookup_array_type(const string&, const translation_unit&); 1228 1229 array_type_def_sptr 1230 lookup_array_type(const array_type_def&, const corpus&); 1231 1232 array_type_def_sptr 1233 lookup_array_type(const interned_string&, const corpus&); 1234 1235 function_type_sptr 1236 lookup_function_type(const string&, 1237 const translation_unit&); 1238 1239 function_type_sptr 1240 lookup_function_type(const interned_string&, 1241 const translation_unit&); 1242 1243 function_type_sptr 1244 lookup_function_type(const function_type&, 1245 const translation_unit&); 1246 1247 function_type_sptr 1248 lookup_function_type(const function_type_sptr&, 1249 const translation_unit&); 1250 1251 function_type_sptr 1252 lookup_function_type(const function_type&, const corpus&); 1253 1254 function_type_sptr 1255 lookup_function_type(const function_type_sptr&, const corpus&); 1256 1257 function_type_sptr 1258 lookup_function_type(const function_type&, const corpus&); 1259 1260 function_type_sptr 1261 lookup_function_type(const interned_string&, const corpus&); 1262 1263 type_base_sptr 1264 lookup_type(const string&, const translation_unit&); 1265 1266 const type_base_sptr 1267 lookup_type(const type_base_sptr, const translation_unit&); 1268 1269 type_base_sptr 1270 lookup_type(const interned_string&, const corpus&); 1271 1272 type_base_sptr 1273 lookup_type_per_location(const interned_string&, const corpus&); 1274 1275 type_base_sptr 1276 lookup_type(const type_base&, const corpus&); 1277 1278 type_base_sptr 1279 lookup_type(const type_base_sptr&, const corpus&); 1280 1281 type_base_sptr 1282 lookup_type_through_scopes(const std::list<string>&, 1283 const translation_unit&); 1284 1285 type_base_sptr 1286 lookup_type_through_translation_units(const string&, const corpus&); 1287 1288 type_base_sptr 1289 lookup_type_from_translation_unit(const string& type_name, 1290 const string& tu_path, 1291 const corpus& corp); 1292 1293 function_type_sptr 1294 lookup_or_synthesize_fn_type(const function_type_sptr&, 1295 const corpus&); 1296 1297 type_base_sptr 1298 synthesize_type_from_translation_unit(const type_base_sptr&, 1299 translation_unit&); 1300 1301 function_type_sptr 1302 synthesize_function_type_from_translation_unit(const function_type&, 1303 translation_unit&); 1304 1305 const type_base_sptr 1306 lookup_type_in_scope(const string&, 1307 const scope_decl_sptr&); 1308 1309 const type_base_sptr 1310 lookup_type_in_scope(const std::list<string>&, 1311 const scope_decl_sptr&); 1312 1313 const decl_base_sptr 1314 lookup_var_decl_in_scope(const string&, 1315 const scope_decl_sptr&); 1316 1317 const decl_base_sptr 1318 lookup_var_decl_in_scope(const std::list<string>&, 1319 const scope_decl_sptr&); 1320 1321 string 1322 demangle_cplus_mangled_name(const string&); 1323 1324 type_base_sptr 1325 type_or_void(const type_base_sptr, const environment*); 1326 1327 type_base_sptr 1328 canonicalize(type_base_sptr); 1329 1330 type_base* 1331 type_has_non_canonicalized_subtype(type_base_sptr t); 1332 1333 bool 1334 type_has_sub_type_changes(type_base_sptr t_v1, 1335 type_base_sptr t_v2); 1336 1337 void 1338 keep_type_alive(type_base_sptr t); 1339 1340 size_t 1341 hash_type(const type_base *t); 1342 1343 size_t 1344 hash_type_or_decl(const type_or_decl_base *); 1345 1346 size_t 1347 hash_type_or_decl(const type_or_decl_base_sptr &); 1348 1349 bool 1350 function_decl_is_less_than(const function_decl&f, const function_decl &s); 1351 1352 bool 1353 types_have_similar_structure(const type_base_sptr& first, 1354 const type_base_sptr& second, 1355 bool indirect_type = false); 1356 1357 bool 1358 types_have_similar_structure(const type_base* first, 1359 const type_base* second, 1360 bool indirect_type = false); 1361 1362 } // end namespace ir 1363 1364 using namespace abigail::ir; 1365 1366 namespace suppr 1367 { 1368 class suppression_base; 1369 1370 /// Convenience typedef for a shared pointer to a @ref suppression. 1371 typedef shared_ptr<suppression_base> suppression_sptr; 1372 1373 /// Convenience typedef for a vector of @ref suppression_sptr 1374 typedef vector<suppression_sptr> suppressions_type; 1375 1376 } // end namespace suppr 1377 1378 namespace symtab_reader 1379 { 1380 1381 class symtab; 1382 /// Convenience typedef for a shared pointer to a @ref symtab 1383 typedef std::shared_ptr<symtab> symtab_sptr; 1384 1385 } // end namespace symtab_reader 1386 1387 void 1388 dump(const decl_base_sptr, std::ostream&); 1389 1390 void 1391 dump(const decl_base_sptr); 1392 1393 void 1394 dump(const type_base_sptr, std::ostream&); 1395 1396 void 1397 dump(const type_base_sptr); 1398 1399 void 1400 dump(const var_decl_sptr, std::ostream&); 1401 1402 void 1403 dump(const var_decl_sptr); 1404 1405 void 1406 dump(const translation_unit&, std::ostream&); 1407 1408 void 1409 dump(const translation_unit&); 1410 1411 void 1412 dump(const translation_unit_sptr, std::ostream&); 1413 1414 void 1415 dump(const translation_unit_sptr); 1416 1417 void 1418 dump_decl_location(const decl_base&); 1419 1420 void 1421 dump_decl_location(const decl_base*); 1422 1423 void 1424 dump_decl_location(const decl_base_sptr&); 1425 1426 #ifndef ABG_ASSERT 1427 /// This is a wrapper around the 'assert' glibc call. It allows for 1428 /// its argument to have side effects, so that it keeps working when 1429 /// the code of libabigail is compiled with the NDEBUG macro defined. 1430 #define ABG_ASSERT(cond) do {({bool __abg_cond__ = bool(cond); assert(__abg_cond__); !!__abg_cond__;});} while (false) 1431 #endif 1432 1433 } // end namespace abigail 1434 #endif // __ABG_IRFWD_H__ 1435