1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 // -*- Mode: C++ -*- 3 // 4 // Copyright (C) 2016-2023 Red Hat, Inc. 5 // 6 // Author: Dodji Seketeli 7 8 #ifndef __ABG_SUPPRESSION_H__ 9 #define __ABG_SUPPRESSION_H__ 10 11 #include <unordered_set> 12 13 #include "abg-ini.h" 14 #include "abg-ir.h" 15 16 namespace abigail 17 { 18 19 class fe_iface; 20 21 /// @brief an engine to suppress the parts of the result of comparing 22 /// two sets of ABI artifacts. 23 /// 24 /// The user specifies the kind of changes between ABI artefact she 25 /// wants to see suppressed. That suppression specification is done 26 /// in an INI format. 27 /// 28 /// That INI file is parsed and represented internally using the types 29 /// that are defined in this namespace. 30 namespace suppr 31 { 32 using std::unordered_set; 33 using std::string; 34 using std::shared_ptr; 35 using std::vector; 36 using comparison::diff; 37 using comparison::diff_context_sptr; 38 39 /// Base type of a direct suppression specifications types. 40 /// 41 /// This abstracts a suppression specification. It's a way to specify 42 /// how to drop reports about a particular diff node on the floor, if 43 /// it matches the supppression specification. 44 /// 45 /// Note that a direct suppression specification suppresses (for 46 /// reporting purposes) the diff node that it matches. A negated 47 /// suppression specification, however, suppresses a diff node that it 48 /// DOES NOT match. A Negated suppression specification is abstracted 49 /// by the class @ref negated_suppression_base. 50 class suppression_base 51 { 52 public: 53 class priv; // declare publicly to allow subclasses to reuse the priv 54 private: 55 // Forbid default constructor 56 suppression_base(); 57 58 public: 59 std::unique_ptr<priv> priv_; 60 61 suppression_base(const string& label); 62 63 suppression_base(const string& label, 64 const string& file_name_regex_str, 65 const string& file_name_not_regex_str); 66 67 bool 68 get_drops_artifact_from_ir() const; 69 70 void 71 set_drops_artifact_from_ir(bool); 72 73 bool 74 get_is_artificial() const; 75 76 void 77 set_is_artificial(bool); 78 79 const string 80 get_label() const; 81 82 void 83 set_label(const string&); 84 85 void 86 set_file_name_regex_str(const string& regexp); 87 88 const string& 89 get_file_name_regex_str() const; 90 91 void 92 set_file_name_not_regex_str(const string& regexp); 93 94 const string& 95 get_file_name_not_regex_str() const; 96 97 bool 98 has_file_name_related_property() const; 99 100 void 101 set_soname_regex_str(const string& regexp); 102 103 const string& 104 get_soname_regex_str() const; 105 106 void 107 set_soname_not_regex_str(const string& regexp); 108 109 const string& 110 get_soname_not_regex_str() const; 111 112 bool 113 has_soname_related_property() const; 114 115 virtual bool 116 suppresses_diff(const diff*) const = 0; 117 118 virtual ~suppression_base(); 119 120 friend bool 121 suppression_matches_soname(const string& soname, 122 const suppression_base& suppr); 123 124 friend bool 125 suppression_matches_soname_or_filename(const string& soname, 126 const string& filename, 127 const suppression_base& suppr); 128 }; // end class suppression_base 129 130 /// Convenience typedef for a shared pointer to a @ref suppression. 131 typedef shared_ptr<suppression_base> suppression_sptr; 132 133 /// Convenience typedef for a vector of @ref suppression_sptr 134 typedef vector<suppression_sptr> suppressions_type; 135 136 void 137 read_suppressions(std::istream& input, 138 suppressions_type& suppressions); 139 140 void 141 read_suppressions(const string& file_path, 142 suppressions_type& suppressions); 143 144 class type_suppression; 145 146 /// Convenience typedef for a shared pointer to type_suppression. 147 typedef shared_ptr<type_suppression> type_suppression_sptr; 148 149 /// Convenience typedef for vector of @ref type_suppression_sptr. 150 typedef vector<type_suppression_sptr> type_suppressions_type; 151 152 /// The base class of suppression specifications that are defined by 153 /// the negation of matching clauses. 154 /// 155 /// A direct suppression specification suppresses (for reporting 156 /// purposes) the diff node that it matches. A negated suppression 157 /// specification suppresses a diff node that it DOES NOT match. 158 class negated_suppression_base 159 { 160 public: 161 negated_suppression_base(); 162 163 virtual ~negated_suppression_base(); 164 }; // end class negated_suppression_base. 165 166 /// A convenience typedef for a shared pointer to @ref 167 /// negated_suppression_base. 168 typedef shared_ptr<negated_suppression_base> negated_suppression_sptr; 169 170 /// Convenience typedef for a vector of @ref negated_suppression_sptr 171 typedef vector<negated_suppression_sptr> negated_suppressions_type; 172 173 bool 174 is_negated_suppression(const suppression_base&); 175 176 const negated_suppression_base* 177 is_negated_suppression(const suppression_base*); 178 179 negated_suppression_sptr 180 is_negated_suppression(const suppression_sptr&); 181 182 /// Abstraction of a type suppression specification. 183 /// 184 /// Specifies under which condition reports about a type diff node 185 /// should be dropped on the floor. 186 class type_suppression : public suppression_base 187 { 188 class priv; 189 190 // Forbid this; 191 type_suppression(); 192 193 public: 194 std::unique_ptr<priv> priv_; 195 196 /// The kind of the type the current type suppression is supposed to 197 /// be about. 198 enum type_kind 199 { 200 UNKNOWN_TYPE_KIND, 201 CLASS_TYPE_KIND, 202 STRUCT_TYPE_KIND, 203 UNION_TYPE_KIND, 204 ENUM_TYPE_KIND, 205 ARRAY_TYPE_KIND, 206 TYPEDEF_TYPE_KIND, 207 BUILTIN_TYPE_KIND 208 }; // end enum type_kind 209 210 /// The different ways through which the type diff has been reached. 211 enum reach_kind 212 { 213 /// The type diff has been reached (from a function or variable 214 /// change) directly. 215 DIRECT_REACH_KIND = 0, 216 217 /// The type diff has been reached (from a function or variable 218 /// change) through a pointer. 219 POINTER_REACH_KIND, 220 221 /// The type diff has been reached (from a function or variable 222 /// change) through a reference; you know, like a c++ reference.. 223 REFERENCE_REACH_KIND, 224 225 /// The type diff has been reached (from a function or variable 226 /// change) through either a reference or a pointer. 227 REFERENCE_OR_POINTER_REACH_KIND 228 }; // end enum reach_kind 229 230 class insertion_range; 231 /// A convenience typedef for a shared pointer to @ref 232 /// insertion_range. 233 typedef shared_ptr<insertion_range> insertion_range_sptr; 234 /// A convenience typedef for a vector of @ref insertion_range_sptr. 235 typedef vector<insertion_range_sptr> insertion_ranges; 236 237 type_suppression(const string& label, 238 const string& type_name_regexp, 239 const string& type_name); 240 241 virtual ~type_suppression(); 242 243 void 244 set_type_name_regex_str(const string& name_regex_str); 245 246 const string& 247 get_type_name_regex_str() const; 248 249 void 250 set_type_name_not_regex_str(const string& name_regex_str); 251 252 const string& 253 get_type_name_not_regex_str() const; 254 255 void 256 set_type_name(const string& name); 257 258 const string& 259 get_type_name() const; 260 261 bool 262 get_consider_type_kind() const; 263 264 void 265 set_consider_type_kind(bool f); 266 267 void 268 set_type_kind(type_kind k); 269 270 type_kind 271 get_type_kind() const; 272 273 bool 274 get_consider_reach_kind() const; 275 276 void 277 set_consider_reach_kind(bool f); 278 279 reach_kind 280 get_reach_kind() const; 281 282 void 283 set_reach_kind(reach_kind k); 284 285 bool 286 get_has_size_change() const; 287 288 void 289 set_has_size_change(bool flag); 290 291 const string_set_type& 292 get_potential_data_member_names() const; 293 294 void 295 set_potential_data_member_names(const string_set_type&) const; 296 297 const string& 298 get_potential_data_member_names_regex_str() const; 299 300 void 301 set_potential_data_member_names_regex_str(const string&) const; 302 303 void 304 set_data_member_insertion_ranges(const insertion_ranges& r); 305 306 const insertion_ranges& 307 get_data_member_insertion_ranges() const; 308 309 insertion_ranges& 310 get_data_member_insertion_ranges(); 311 312 const unordered_set<string>& 313 get_source_locations_to_keep() const; 314 315 unordered_set<string>& 316 get_source_locations_to_keep(); 317 318 void 319 set_source_locations_to_keep(const unordered_set<string>&); 320 321 const string& 322 get_source_location_to_keep_regex_str() const; 323 324 void 325 set_source_location_to_keep_regex_str(const string&); 326 327 const vector<string>& 328 get_changed_enumerator_names() const; 329 330 void 331 set_changed_enumerator_names(const vector<string>&); 332 333 const vector<regex::regex_t_sptr>& 334 get_changed_enumerators_regexp() const; 335 336 void 337 set_changed_enumerators_regexp(const vector<regex::regex_t_sptr>&); 338 339 virtual bool 340 suppresses_diff(const diff* diff) const; 341 342 bool 343 suppresses_type(const type_base_sptr& type, 344 const diff_context_sptr& ctxt) const; 345 346 bool 347 suppresses_type(const type_base_sptr& type) const; 348 349 bool 350 suppresses_type(const type_base_sptr& type, 351 const scope_decl* type_scope) const; 352 }; // end type_suppression 353 354 type_suppression_sptr 355 is_type_suppression(const suppression_sptr); 356 357 /// The abstraction of a range of offsets in which a member of a type 358 /// might get inserted. 359 class type_suppression::insertion_range 360 { 361 struct priv; 362 std::unique_ptr<priv> priv_; 363 364 public: 365 366 class boundary; 367 class integer_boundary; 368 class fn_call_expr_boundary; 369 class named_boundary; 370 371 /// Convenience typedef for a shared_ptr to @ref boundary 372 typedef shared_ptr<boundary> boundary_sptr; 373 374 /// Convenience typedef for a shared_ptr to a @ref integer_boundary 375 typedef shared_ptr<integer_boundary> integer_boundary_sptr; 376 377 /// Convenience typedef for a shared_ptr to a @ref 378 /// fn_call_expr_boundary 379 typedef shared_ptr<fn_call_expr_boundary> fn_call_expr_boundary_sptr; 380 381 /// Convenience typedef for a shared_ptr to a @ref 382 /// named_boundary 383 typedef shared_ptr<named_boundary> named_boundary_sptr; 384 385 insertion_range(); 386 387 insertion_range(boundary_sptr begin, boundary_sptr end); 388 389 boundary_sptr 390 begin() const; 391 392 boundary_sptr 393 end() const; 394 395 static insertion_range::integer_boundary_sptr 396 create_integer_boundary(int value); 397 398 static insertion_range::fn_call_expr_boundary_sptr 399 create_fn_call_expr_boundary(ini::function_call_expr_sptr); 400 401 static insertion_range::fn_call_expr_boundary_sptr 402 create_fn_call_expr_boundary(const string&); 403 404 static insertion_range::named_boundary_sptr 405 create_named_boundary(const string&); 406 407 static bool 408 eval_boundary(const boundary_sptr boundary, 409 const class_or_union* context, 410 uint64_t& value); 411 412 static bool 413 boundary_value_is_end(uint64_t value); 414 }; // end class insertion_range 415 416 type_suppression::insertion_range::integer_boundary_sptr 417 is_integer_boundary(type_suppression::insertion_range::boundary_sptr); 418 419 type_suppression::insertion_range::fn_call_expr_boundary_sptr 420 is_fn_call_expr_boundary(type_suppression::insertion_range::boundary_sptr); 421 422 type_suppression::insertion_range::named_boundary_sptr 423 is_named_boundary(type_suppression::insertion_range::boundary_sptr); 424 425 /// The abstraction of the boundary of an @ref insertion_range, in the 426 /// context of a @ref type_suppression 427 class type_suppression::insertion_range::boundary 428 { 429 struct priv; 430 std::unique_ptr<priv> priv_; 431 432 public: 433 boundary(); 434 virtual ~boundary(); 435 };// end class type_suppression::insertion_range::boundary 436 437 /// An @ref insertion_range boundary that is expressed as an integer 438 /// value. That integer value is usually a bit offset. 439 class type_suppression::insertion_range::integer_boundary 440 : public type_suppression::insertion_range::boundary 441 { 442 struct priv; 443 std::unique_ptr<priv> priv_; 444 445 integer_boundary(); 446 447 public: 448 integer_boundary(uint64_t value); 449 uint64_t as_integer() const; 450 operator uint64_t () const; 451 ~integer_boundary(); 452 }; //end class type_suppression::insertion_range::integer_boundary 453 454 /// An @ref insertion_range boundary that is expressed as function 455 /// call expression. The (integer) value of that expression is 456 /// usually a bit offset. 457 class type_suppression::insertion_range::fn_call_expr_boundary 458 : public type_suppression::insertion_range::boundary 459 { 460 struct priv; 461 std::unique_ptr<priv> priv_; 462 463 fn_call_expr_boundary(); 464 465 public: 466 fn_call_expr_boundary(ini::function_call_expr_sptr expr); 467 ini::function_call_expr_sptr as_function_call_expr() const; 468 operator ini::function_call_expr_sptr () const; 469 ~fn_call_expr_boundary(); 470 }; //end class type_suppression::insertion_range::fn_call_expr_boundary 471 472 /// An @ref insertion_range boundary that is expressed as a named 473 /// constant that is to be evaluated later in the context of a given 474 /// type and resolved to a bit offset. 475 class type_suppression::insertion_range::named_boundary 476 : public type_suppression::insertion_range::boundary 477 { 478 struct priv; 479 std::unique_ptr<priv> priv_; 480 481 named_boundary(); 482 483 public: 484 named_boundary(const string& name); 485 const string& get_name() const; 486 }; //end class type_suppression::insertion_range::named_boundary 487 488 /// Abstraction of a negated type suppression specification. 489 /// 490 /// A negated type suppression suppresses a type if the negation of 491 /// the equivalent propositions for a @ref type_suppression are valid. 492 class negated_type_suppression : virtual public type_suppression, 493 virtual public negated_suppression_base 494 { 495 496 public: 497 498 negated_type_suppression(const string& label, 499 const string& type_name_regexp, 500 const string& type_name); 501 502 virtual bool 503 suppresses_diff(const diff* diff) const; 504 505 bool 506 suppresses_type(const type_base_sptr& type, 507 const diff_context_sptr& ctxt) const; 508 509 bool 510 suppresses_type(const type_base_sptr& type) const; 511 512 bool 513 suppresses_type(const type_base_sptr& type, 514 const scope_decl* type_scope) const; 515 516 virtual ~negated_type_suppression(); 517 };// end class negated_type_suppression 518 519 class function_suppression; 520 521 /// Convenience typedef for a shared pointer to function_suppression. 522 typedef shared_ptr<function_suppression> function_suppression_sptr; 523 524 /// Convenience typedef for a vector of @ref function_suppression_sptr. 525 typedef vector<function_suppression_sptr> function_suppressions_type; 526 527 /// Abstraction of a function suppression specification. 528 /// 529 /// Specifies under which condition reports about a @ref 530 /// function_decl_diff diff node should be dropped on the floor for 531 /// the purpose of reporting. 532 class function_suppression : public suppression_base 533 { 534 struct priv; 535 536 public: 537 538 std::unique_ptr<priv> priv_; 539 class parameter_spec; 540 541 /// Convenience typedef for shared_ptr of @ref parameter_spec. 542 typedef shared_ptr<parameter_spec> parameter_spec_sptr; 543 544 /// Convenience typedef for vector of @ref parameter_spec_sptr. 545 typedef vector<parameter_spec_sptr> parameter_specs_type; 546 547 /// The kind of change the current function suppression should apply 548 /// to. 549 enum change_kind 550 { 551 UNDEFINED_CHANGE_KIND, 552 /// A change in a sub-type of the function. 553 FUNCTION_SUBTYPE_CHANGE_KIND = 1, 554 /// The function was added to the second subject of the diff. 555 ADDED_FUNCTION_CHANGE_KIND = 1 << 1, 556 /// The function was deleted from the second subject of the diff. 557 DELETED_FUNCTION_CHANGE_KIND = 1 << 2, 558 /// This represents all the changes possibly described by this 559 /// enum. It's a logical 'OR' of all the change enumerators 560 /// above. 561 ALL_CHANGE_KIND = (FUNCTION_SUBTYPE_CHANGE_KIND 562 | ADDED_FUNCTION_CHANGE_KIND 563 | DELETED_FUNCTION_CHANGE_KIND) 564 }; 565 566 function_suppression(); 567 568 function_suppression(const string& label, 569 const string& name, 570 const string& name_regex, 571 const string& return_type_name, 572 const string& return_type_regex, 573 parameter_specs_type& parm_specs, 574 const string& symbol_name, 575 const string& symbol_name_regex, 576 const string& symbol_version, 577 const string& symbol_version_regex_str); 578 579 virtual ~function_suppression(); 580 581 static change_kind 582 parse_change_kind(const string&); 583 584 change_kind 585 get_change_kind() const; 586 587 void 588 set_change_kind(change_kind k); 589 590 const string& 591 get_name() const; 592 593 void 594 set_name(const string&); 595 596 const string& 597 get_name_regex_str() const; 598 599 void 600 set_name_regex_str(const string&); 601 602 const string& 603 get_name_not_regex_str() const; 604 605 void 606 set_name_not_regex_str(const string&); 607 608 const string& 609 get_return_type_name() const; 610 611 void 612 set_return_type_name(const string&); 613 614 const string& 615 get_return_type_regex_str() const; 616 617 void 618 set_return_type_regex_str(const string& r); 619 620 const parameter_specs_type& 621 get_parameter_specs() const; 622 623 void 624 set_parameter_specs(parameter_specs_type&); 625 626 void 627 append_parameter_specs(const parameter_spec_sptr); 628 629 const string& 630 get_symbol_name() const; 631 632 void 633 set_symbol_name(const string& n); 634 635 const string& 636 get_symbol_name_regex_str() const; 637 638 void 639 set_symbol_name_regex_str(const string&); 640 641 const string& 642 get_symbol_name_not_regex_str() const; 643 644 void 645 set_symbol_name_not_regex_str(const string&); 646 647 const string& 648 get_symbol_version() const; 649 650 void 651 set_symbol_version(const string&); 652 653 const string& 654 get_symbol_version_regex_str() const; 655 656 void 657 set_symbol_version_regex_str(const string&); 658 659 bool 660 get_allow_other_aliases() const; 661 662 void 663 set_allow_other_aliases(bool f); 664 665 virtual bool 666 suppresses_diff(const diff* diff) const; 667 668 bool 669 suppresses_function(const function_decl* fn, 670 change_kind k, 671 const diff_context_sptr ctxt) const; 672 673 bool 674 suppresses_function(const function_decl_sptr fn, 675 change_kind k, 676 const diff_context_sptr ctxt) const; 677 678 bool 679 suppresses_function_symbol(const elf_symbol* sym, 680 change_kind k, 681 const diff_context_sptr ctxt); 682 683 bool 684 suppresses_function_symbol(const elf_symbol_sptr sym, 685 change_kind k, 686 const diff_context_sptr ctxt); 687 }; // end class function_suppression. 688 689 function_suppression_sptr 690 is_function_suppression(const suppression_sptr); 691 692 function_suppression::change_kind 693 operator&(function_suppression::change_kind l, 694 function_suppression::change_kind r); 695 696 function_suppression::change_kind 697 operator|(function_suppression::change_kind l, 698 function_suppression::change_kind r); 699 700 /// Abstraction of the specification of a function parameter in a 701 /// function suppression specification. 702 class function_suppression::parameter_spec 703 { 704 friend class function_suppression; 705 706 class priv; 707 std::unique_ptr<priv> priv_; 708 709 // Forbid this. 710 parameter_spec(); 711 712 public: 713 parameter_spec(size_t index, 714 const string& type_name, 715 const string& type_name_regex); 716 717 size_t 718 get_index() const; 719 720 void 721 set_index(size_t); 722 723 const string& 724 get_parameter_type_name() const; 725 726 void 727 set_parameter_type_name(const string&); 728 729 const string& 730 get_parameter_type_name_regex_str() const; 731 732 void 733 set_parameter_type_name_regex_str(const string&); 734 };// end class function_suppression::parameter_spec 735 736 class variable_suppression; 737 738 /// A convenience typedef for a shared pointer to @ref 739 /// variable_suppression. 740 typedef shared_ptr<variable_suppression> variable_suppression_sptr; 741 742 /// A convenience typedef for a vector of @ref 743 /// variable_suppression_sptr. 744 typedef vector<variable_suppression_sptr> variable_suppressions_type; 745 746 /// The abstraction of a variable suppression specification. 747 /// 748 /// It specifies under which condition reports about a @ref var_diff 749 /// diff node should be dropped on the floor for the purpose of 750 /// reporting. 751 class variable_suppression : public suppression_base 752 { 753 public: 754 755 /// The kind of change the current variable suppression should apply 756 /// to. 757 enum change_kind 758 { 759 UNDEFINED_CHANGE_KIND, 760 /// A change in a sub-type of the variable. 761 VARIABLE_SUBTYPE_CHANGE_KIND = 1, 762 /// The variable was added to the second second subject of the 763 /// diff. 764 ADDED_VARIABLE_CHANGE_KIND = 1 << 1, 765 /// The variable was deleted from the second subject of the diff. 766 DELETED_VARIABLE_CHANGE_KIND = 1 << 2, 767 /// This represents all the changes possibly described by this 768 /// enum. It's a logical 'OR' of all the change enumerators 769 /// above. 770 ALL_CHANGE_KIND = (VARIABLE_SUBTYPE_CHANGE_KIND 771 | ADDED_VARIABLE_CHANGE_KIND 772 | DELETED_VARIABLE_CHANGE_KIND) 773 }; 774 775 private: 776 struct priv; 777 778 public: 779 std::unique_ptr<priv> priv_; 780 781 variable_suppression(const string& label = "", 782 const string& name = "", 783 const string& name_regex_str = "", 784 const string& symbol_name = "", 785 const string& symbol_name_regex_str = "", 786 const string& symbol_version = "", 787 const string& symbol_version_regex_str = "", 788 const string& type_name = "", 789 const string& type_name_regex_str = ""); 790 791 virtual ~variable_suppression(); 792 793 static change_kind 794 parse_change_kind(const string&); 795 796 change_kind 797 get_change_kind() const; 798 799 void 800 set_change_kind(change_kind k); 801 802 const string& 803 get_name() const; 804 805 void 806 set_name(const string&); 807 808 const string& 809 get_name_regex_str() const; 810 811 void 812 set_name_regex_str(const string&); 813 814 const string& 815 get_name_not_regex_str() const; 816 817 void 818 set_name_not_regex_str(const string&); 819 820 const string& 821 get_symbol_name() const; 822 823 void 824 set_symbol_name(const string&); 825 826 const string& 827 get_symbol_name_regex_str() const; 828 829 void 830 set_symbol_name_regex_str(const string&); 831 832 const string& 833 get_symbol_name_not_regex_str() const; 834 835 void 836 set_symbol_name_not_regex_str(const string&); 837 838 const string& 839 get_symbol_version() const; 840 841 void 842 set_symbol_version(const string&); 843 844 const string& 845 get_symbol_version_regex_str() const; 846 847 void 848 set_symbol_version_regex_str(const string&); 849 850 const string& 851 get_type_name() const; 852 853 void 854 set_type_name(const string&); 855 856 const string& 857 get_type_name_regex_str() const; 858 859 void 860 set_type_name_regex_str(const string&); 861 862 bool 863 suppresses_diff(const diff* d) const; 864 865 bool 866 suppresses_variable(const var_decl* var, 867 change_kind k, 868 const diff_context_sptr cxt) const; 869 870 bool 871 suppresses_variable(const var_decl_sptr var, 872 change_kind k, 873 const diff_context_sptr cxt) const; 874 875 bool 876 suppresses_variable_symbol(const elf_symbol* sym, 877 change_kind k, 878 const diff_context_sptr cxt) const; 879 880 bool 881 suppresses_variable_symbol(const elf_symbol_sptr fn, 882 change_kind k, 883 const diff_context_sptr cxt) const; 884 }; // end class variable_suppression 885 886 variable_suppression_sptr 887 is_variable_suppression(const suppression_sptr); 888 889 variable_suppression::change_kind 890 operator&(variable_suppression::change_kind l, 891 variable_suppression::change_kind r); 892 893 variable_suppression::change_kind 894 operator|(variable_suppression::change_kind l, 895 variable_suppression::change_kind r); 896 897 class file_suppression; 898 899 /// A convenience typedef for a shared_ptr to @ref file_suppression 900 typedef shared_ptr<file_suppression> file_suppression_sptr; 901 902 /// Abstraction of a suppression specification to avoid loading a 903 /// file. 904 /// 905 /// This can be used by a tool that loads (binary) files, to know 906 /// which file it has to avoid loading. 907 class file_suppression: public suppression_base 908 { 909 std::unique_ptr<priv> priv_; 910 911 // Forbid this 912 file_suppression(); 913 914 public: 915 916 file_suppression(const string& label, 917 const string& file_name_regex, 918 const string& file_name_not_regex); 919 920 virtual bool 921 suppresses_diff(const diff* diff) const; 922 923 bool 924 suppresses_file(const string& file_path); 925 926 virtual ~file_suppression(); 927 }; // end file_suppression 928 929 file_suppression_sptr 930 is_file_suppression(const suppression_sptr); 931 932 file_suppression_sptr 933 file_is_suppressed(const string& file_path, 934 const suppressions_type& suppressions); 935 936 bool 937 suppression_matches_soname(const string& soname, 938 const suppression_base& suppr); 939 940 bool 941 suppression_matches_soname_or_filename(const string& soname, 942 const string& filename, 943 const suppression_base& suppr); 944 945 const char* 946 get_private_types_suppr_spec_label(); 947 948 bool 949 is_private_type_suppr_spec(const type_suppression&); 950 951 bool 952 is_private_type_suppr_spec(const suppression_sptr& s); 953 954 bool 955 suppression_can_match(const fe_iface&, 956 const suppression_base&); 957 958 bool 959 suppression_matches_function_name(const fe_iface&, 960 const suppr::function_suppression&, 961 const string&); 962 963 bool 964 suppression_matches_function_sym_name(const fe_iface&, 965 const suppr::function_suppression& s, 966 const string& fn_linkage_name); 967 968 bool 969 suppression_matches_variable_name(const fe_iface&, 970 const suppr::variable_suppression& s, 971 const string& var_name); 972 973 bool 974 suppression_matches_variable_sym_name(const fe_iface&, 975 const suppr::variable_suppression&, 976 const string&); 977 978 bool 979 suppression_matches_type_name_or_location(const fe_iface&, 980 const suppr::type_suppression&, 981 const string&, 982 const location&); 983 984 bool 985 is_elf_symbol_suppressed(const fe_iface&, 986 const elf_symbol_sptr& symbol); 987 988 bool 989 is_elf_symbol_suppressed(const fe_iface&, 990 const string& sym_name, 991 elf_symbol::type sym_type); 992 993 bool 994 is_function_suppressed(const fe_iface& fe, 995 const string& fn_name, 996 const string& fn_linkage_name, 997 bool require_drop_property = false); 998 999 bool 1000 is_variable_suppressed(const fe_iface& fe, 1001 const string& var_name, 1002 const string& var_linkage_name, 1003 bool require_drop_property = false); 1004 1005 bool 1006 is_type_suppressed(const fe_iface& fe, 1007 const string& type_name, 1008 const location& type_location, 1009 bool& type_is_private, 1010 bool require_drop_property = false); 1011 1012 bool 1013 is_data_member_offset_in_range(const var_decl_sptr&, 1014 const type_suppression::insertion_range_sptr&, 1015 const class_or_union*); 1016 1017 } // end namespace suppr 1018 1019 1020 } // end namespace abigail 1021 1022 #endif //__ABG_SUPPRESSION_H__ 1023