Lines Matching defs:decl
3186 /// @param f the first decl to compare.
3188 /// @param s the second decl to compare.
3195 // If a decl has artificial location, then use that one over the
3234 /// @param f the first decl to be considered for the comparison.
3236 /// @param s the second decl to be considered for the comparison.
3256 // If a decl has artificial location, then use that one over the
3265 // The first decl is less than the second if it's the one not
3282 /// @param f the first decl to be considered for the comparison.
3284 /// @param s the second decl to be considered for the comparison.
3303 /// Test if a decl has an artificial or natural location.
3305 /// @param d the decl to consider
3554 /// Getter of the "decl-only-class-equals-definition" flag.
3567 /// unresolved decl-only class against a definition of the same name.
3573 /// @return the value of the "decl-only-class-equals-definition" flag.
3578 /// Setter of the "decl-only-class-equals-definition" flag.
3591 /// unresolved decl-only class against a definition of the same name.
3597 /// @param the new value of the "decl-only-class-equals-definition"
3957 // current instance is a decl). This is used by the is_decl() and
4135 /// the current instance if it's a decl.
4139 /// the current instance if it's a decl.
4146 /// the current instance if it's a decl.
4150 /// the current instance if it's a decl.
4354 // name before the type associated to this decl (if applicable) is
4358 // This is the fully qualified name of the decl. It contains the
4359 // name of the decl and the qualified name of its scope. So if in
4360 // the parent scopes of the decl, there is one anonymous struct,
4363 // the direct containing scope of this decl.
4368 // decl and the name of its scope; not the qualified name of the
4479 /// Clear the qualified name of this decl.
4482 /// the decl is refreshed right after type canonicalization, for
4540 /// Get the hash of a decl. If the hash hasn't been computed yet,
4543 /// @return the hash of the decl.
4562 /// Test if the decl is defined in a ELF symbol table as a public
4565 /// @return true iff the decl is defined in a ELF symbol table as a
4571 /// Set the flag saying if this decl is from a symbol that is in
4621 /// type_or_decl_base::has_artificial_location() method of this decl will
4642 /// Setter for the name of the decl.
4678 /// @return true iff the current decl has a direct or indirect scope
4695 /// Getter for the naming typedef of the current decl.
4718 /// After completion of this function, the decl will not be considered
4728 // Whe the typedef-named decl is saved into abixml, it's
4731 // apply the naming typedef to the decl.
4742 // Now that the qualified type of the decl has changed, let's update
4764 /// Getter for the visibility of the decl.
4771 /// Setter for the visibility of the decl.
4778 /// Return the type containing the current decl, if any.
4780 /// @return the type that contains the current decl, or NULL if there
4791 /// decl.
4793 /// @return the newly-built qualified name of the of the current decl.
4798 /// Getter for the name of the current decl.
4800 /// @return the name of the current decl.
4805 /// Compute the qualified name of the decl.
4821 /// representation of the decl (or type) for the purpose of canonical
4833 /// @return the default pretty representation for a decl. This is
4834 /// basically the fully qualified name of the decl optionally prefixed
4864 /// Return the qualified name of the decl.
4866 /// This is the fully qualified name of the decl. It's made of the
4867 /// concatenation of the name of the decl with the qualified name of
4871 /// update_qualified_name when the decl is added to its scope.
4883 /// Return the scoped name of the decl.
4885 /// This is made of the concatenation of the name of the decl with the
4890 /// update_qualified_name when the decl is added to its scope.
4892 /// @return the scoped name of the decl.
4920 /// @return the definition of this decl-only @ref decl_base.
4941 /// Test if a @ref decl_base is a declaration-only decl.
5000 /// of a decl.
5003 /// "is-a-member-relation" of a decl.
5005 /// This comparison however doesn't take decl names into account. So
5016 /// @return true iff @p l compare equals, as a member decl, to @p r.
5067 /// Get the name of a decl for the purpose of comparing two decl
5083 // The decl is anonymous. It should have the same name ass the
5173 // This is the slow path as we are comparing the decl qualified
5233 /// Setter of the scope of the current decl.
5235 /// Note that the decl won't hold a reference on the scope. It's
5625 /// Test if a decl is a data member.
5627 /// @param d the decl to consider.
5642 /// Test if a decl is a data member.
5644 /// @param d the decl to consider.
5659 /// Test if a decl is a data member.
5661 /// @param d the decl to consider.
5674 /// Test if a decl is a data member.
5676 /// @param d the decl to consider.
5761 /// Test if a decl is an anonymous data member.
5763 /// @param d the decl to consider.
5770 /// Test if a decl is an anonymous data member.
5772 /// @param d the decl to consider.
5787 /// Test if a decl is an anonymous data member.
5789 /// @param d the decl to consider.
5804 /// Test if a decl is an anonymous data member.
5806 /// @param d the decl to consider.
5821 /// Test if a decl is an anonymous data member.
5823 /// @param d the decl to consider.
5946 /// Test if the scope of a given decl is anonymous or anonymous with a
5949 /// @param d the decl consider.
5962 /// Test if a given decl is anonymous or has a naming typedef.
5964 /// @param d the decl to consider.
7503 /// @param the name of the scope decl.
7686 /// Add a member decl to this scope. Note that user code should not
7690 /// decl that is added. It also sets the scope of the member. Thus,
7694 /// @param member the new member decl to add to this scope.
7827 /// Insert a member decl to this scope, right before an element
7834 /// @param member the new member decl to add to this scope.
8020 /// @param decl the scope member to find.
8022 /// @param i the iterator to set to the member @p decl. This is set
8025 /// @return true if the member decl was found, false otherwise.
8027 scope_decl::find_iterator_for_member(const decl_base* decl,
8030 if (!decl)
8043 if ((*it).get() == decl)
8055 /// @param decl the scope member to find.
8057 /// @param i the iterator to set to the member @p decl. This is set
8060 /// @return true if the member decl was found, false otherwise.
8062 scope_decl::find_iterator_for_member(const decl_base_sptr decl,
8064 {return find_iterator_for_member(decl.get(), i);}
8100 /// @param decl the declaration to add to the scope
8104 add_decl_to_scope(decl_base_sptr decl, scope_decl* scope)
8108 if (scope && decl && !decl->get_scope())
8109 decl = scope->add_member_decl(decl);
8111 return decl;
8117 /// @param decl the declaration to add append to the scope
8119 /// @param scope the scope to append the decl to
8121 add_decl_to_scope(decl_base_sptr decl, const scope_decl_sptr& scope)
8122 {return add_decl_to_scope(decl, scope.get());}
8124 /// Remove a given decl from its scope
8126 /// @param decl the decl to remove from its scope.
8128 remove_decl_from_scope(decl_base_sptr decl)
8130 if (!decl)
8133 scope_decl* scope = decl->get_scope();
8134 scope->remove_member_decl(decl);
8135 decl->set_scope(0);
8141 /// @param decl the declaration to insert into the scope.
8148 insert_decl_into_scope(decl_base_sptr decl,
8152 if (scope && decl && !decl->get_scope())
8154 decl_base_sptr d = scope->insert_member_decl(decl, before);
8155 decl = d;
8157 return decl;
8163 /// @param decl the declaration to insert into the scope.
8170 insert_decl_into_scope(decl_base_sptr decl,
8173 {return insert_decl_into_scope(decl, before, scope.get());}
8192 /// @param decl the declaration to consider.
8194 /// @return the global scope of the decl, or a null pointer if the
8195 /// decl is not yet added to a translation_unit.
8197 get_global_scope(const decl_base& decl)
8199 if (const global_scope* s = dynamic_cast<const global_scope*>(&decl))
8202 scope_decl* scope = decl.get_scope();
8211 /// @param decl the declaration to consider.
8213 /// @return the global scope of the decl, or a null pointer if the
8214 /// decl is not yet added to a translation_unit.
8216 get_global_scope(const decl_base* decl)
8217 {return get_global_scope(*decl);}
8221 /// @param decl the declaration to consider.
8223 /// @return the global scope of the decl, or a null pointer if the
8224 /// decl is not yet added to a translation_unit.
8226 get_global_scope(const shared_ptr<decl_base> decl)
8227 {return get_global_scope(decl.get());}
8232 /// Note that @p scope must come before @p decl in topological
8235 /// @param decl the decl for which to find a scope.
8241 get_top_most_scope_under(const decl_base* decl,
8244 if (!decl)
8248 return get_global_scope(decl);
8250 // Handle the case where decl is a scope itself.
8251 const scope_decl* s = dynamic_cast<const scope_decl*>(decl);
8253 s = decl->get_scope();
8258 // Here, decl is in the scope 'scope', or decl and 'scope' are the
8267 // SCOPE must come before decl in topological order, but I don't
8278 /// @param decl the decl for which to find a scope.
8284 get_top_most_scope_under(const decl_base_sptr decl,
8286 {return get_top_most_scope_under(decl.get(), scope);}
8291 /// @param decl the decl for which to find a scope.
8297 get_top_most_scope_under(const decl_base_sptr decl,
8299 {return get_top_most_scope_under(decl, scope.get());}
8331 /// either a type or a decl.
8363 /// either a type of a decl.
8422 if (decl_base_sptr decl = get_type_declaration(type))
8423 return get_location(decl);
8429 /// @param decl the declaration to consider.
8431 /// @return the location of the declaration @p decl.
8433 get_location(const decl_base_sptr& decl)
8435 location loc = decl->get_location();
8438 if (class_or_union_sptr c = is_class_or_union_type(decl))
8492 /// Return true iff a decl is for a type type that has a generic
8495 /// @param d the decl to considier.
8915 /// artifact that could be either a type of a decl.
8925 /// that could be either a type of a decl.
8943 /// artifact that could be either a type of a decl.
8953 /// that could be either a type of a decl.
8958 /// Get a copy of the pretty representation of a decl.
8960 /// @param d the decl to consider.
8967 /// @return the pretty representation of the decl.
8999 /// Get a copy of the pretty representation of a decl.
9001 /// @param d the decl to consider.
9008 /// @return the pretty representation of the decl.
9417 /// Get the non-artificial (natural) location of a decl.
9419 /// If the decl doesn't have a natural location then return its
9422 /// @param decl the decl to consider.
9424 /// @return the natural location @p decl if it has one; otherwise,
9427 get_natural_or_artificial_location(const decl_base* decl)
9429 ABG_ASSERT(decl);
9431 if (decl->get_location())
9432 return decl->get_location();
9433 return decl->get_artificial_location();
9436 /// Get the artificial location of a decl.
9438 /// If the decl doesn't have an artificial location then return its
9441 /// @param decl the decl to consider.
9443 /// @return the artificial location @p decl if it has one; otherwise,
9446 get_artificial_or_natural_location(const decl_base* decl)
9448 ABG_ASSERT(decl);
9450 if (decl->has_artificial_location())
9451 return decl->get_artificial_location();
9452 return decl->get_location();
9633 /// @param decl the declaration to consider.
9635 /// @return the resulting translation unit, or null if the decl is not
9638 get_translation_unit(const decl_base& decl)
9639 {return const_cast<translation_unit*>(decl.get_translation_unit());}
9643 /// @param decl the declaration to consider.
9645 /// @return the resulting translation unit, or null if the decl is not
9648 get_translation_unit(const decl_base* decl)
9649 {return decl ? get_translation_unit(*decl) : 0;}
9653 /// @param decl the declaration to consider.
9655 /// @return the resulting translation unit, or null if the decl is not
9658 get_translation_unit(const shared_ptr<decl_base> decl)
9659 {return get_translation_unit(decl.get());}
9691 /// @param decl the decl to consider.
9693 /// @return true iff decl is at global scope.
9695 is_at_global_scope(const decl_base& decl)
9696 {return (is_global_scope(decl.get_scope()));}
9700 /// @param decl the decl to consider.
9702 /// @return true iff decl is at global scope.
9704 is_at_global_scope(const decl_base_sptr decl)
9705 {return (decl && is_global_scope(decl->get_scope()));}
9709 /// @param decl the decl to consider.
9711 /// @return true iff decl is at global scope.
9713 is_at_global_scope(const decl_base* decl)
9714 {return is_at_global_scope(*decl);}
9716 /// Tests whether a given decl is at class scope.
9718 /// @param decl the decl to consider.
9720 /// @return true iff decl is at class scope.
9722 is_at_class_scope(const decl_base_sptr decl)
9723 {return is_at_class_scope(decl.get());}
9725 /// Tests whether a given decl is at class scope.
9727 /// @param decl the decl to consider.
9729 /// @return true iff decl is at class scope.
9731 is_at_class_scope(const decl_base* decl)
9733 if (!decl)
9736 return is_at_class_scope(*decl);
9739 /// Tests whether a given decl is at class scope.
9741 /// @param decl the decl to consider.
9743 /// @return true iff decl is at class scope.
9745 is_at_class_scope(const decl_base& decl)
9747 scope_decl* scope = decl.get_scope();
9778 /// Tests whether a given decl is at template scope.
9783 /// @param decl the decl to consider.
9785 /// @return true iff the decl is at template scope.
9787 is_at_template_scope(const shared_ptr<decl_base> decl)
9788 {return (decl && dynamic_cast<template_decl*>(decl->get_scope()));}
9790 /// Tests whether a decl is a template parameter.
9792 /// @param decl the decl to consider.
9794 /// @return true iff decl is a template parameter.
9796 is_template_parameter(const shared_ptr<decl_base> decl)
9798 return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
9799 || dynamic_pointer_cast<non_type_tparameter>(decl)
9800 || dynamic_pointer_cast<template_tparameter>(decl)));
9867 // The artifact is a decl-only (like a function or a
9870 // have a pointer to the decl sub-object handy. Just return
9878 // pointer to the decl sub-object handily present.
10121 /// Test if a decl is an enum_type_decl
10123 /// @param d the decl to test for.
10130 /// Test if a decl is an enum_type_decl
10132 /// @param d the decl to test for.
10457 /// If a class (or union) is a decl-only class, get its definition.
10467 /// If a class (or union) is a decl-only class, get its definition.
10477 /// If a class (or union) is a decl-only class, get its definition.
10487 /// If an enum is a decl-only enum, get its definition.
10497 /// If an enum is a decl-only enum, get its definition.
10507 /// If a decl is decl-only get its definition. Otherwise, just return nil.
10509 /// @param d the decl to consider.
10511 /// @return either the definition of the decl, or nil.
10515 decl_base_sptr decl;
10517 decl = d.get_definition_of_declaration();
10519 if (!decl)
10520 return decl;
10522 while (decl->get_is_declaration_only()
10523 && decl->get_definition_of_declaration())
10524 decl = decl->get_definition_of_declaration();
10526 return decl;
10529 /// If a decl is decl-only enum, get its definition. Otherwise, just
10530 /// return the initial decl.
10532 /// @param d the decl to consider.
10534 /// @return either the definition of the enum, or the decl itself.
10548 /// If a decl is decl-only get its definition. Otherwise, just return nil.
10550 /// @param d the decl to consider.
10552 /// @return either the definition of the decl, or nil.
10566 /// If a type is is decl-only, then get its definition. Otherwise,
10569 /// @param d the decl to consider.
10571 /// @return either the definition of the decl, or the initial type.
10582 /// If a type is is decl-only, then get its definition. Otherwise,
10585 /// @param d the decl to consider.
10587 /// @return either the definition of the decl, or the initial type.
10600 /// @param decl the decl to test.
10602 /// @return the var_decl_sptr iff decl is a variable declaration; nil
10610 /// @param decl the decl to test.
10612 /// @return the var_decl_sptr iff decl is a variable declaration; nil
10615 is_var_decl(const type_or_decl_base_sptr& decl)
10616 {return dynamic_pointer_cast<var_decl>(decl);}
10636 /// Tests whether a decl is a template parameter composition type.
10638 /// @param decl the declaration to consider.
10640 /// @return true iff decl is a template parameter composition type.
10642 is_template_parm_composition_type(const shared_ptr<decl_base> decl)
10644 return (decl
10645 && is_at_template_scope(decl)
10646 && is_type(decl)
10647 && !is_template_parameter(decl));
10650 /// Test whether a decl is the pattern of a function template.
10652 /// @param decl the decl to consider.
10654 /// @return true iff decl is the pattern of a function template.
10656 is_function_template_pattern(const shared_ptr<decl_base> decl)
10658 return (decl
10659 && dynamic_pointer_cast<function_decl>(decl)
10660 && dynamic_cast<template_decl*>(decl->get_scope()));
10763 /// Tests whether a decl is a template.
10765 /// @param decl the decl to consider.
10767 /// @return true iff decl is a function template, class template, or
10770 is_template_decl(const shared_ptr<decl_base> decl)
10771 {return decl && dynamic_pointer_cast<template_decl>(decl);}
10926 /// then try to return the first one that is not decl-only.
12266 /// @param t the class decl type which has the same qualified name as
12339 /// @param result the vector of decl-only class types named @p
12342 /// @return true iff @p result was populated with the decl-only
12388 /// @return the resulting class decl, if any.
12406 /// @return the resulting class decl, if any.
13146 // Let's try to look through decl-only classes to get their
13664 /// @param decl the declaration of the type to consider.
13666 maybe_update_types_lookup_map(const decl_base_sptr& decl)
13668 if (!is_type(decl))
13671 if (type_decl_sptr basic_type = is_type_decl(decl))
13673 else if (class_decl_sptr class_type = is_class_type(decl))
13675 else if (union_decl_sptr union_type = is_union_type(decl))
13677 else if (enum_type_decl_sptr enum_type = is_enum_type(decl))
13679 else if (typedef_decl_sptr typedef_type = is_typedef(decl))
13681 else if (qualified_type_def_sptr qualified_type = is_qualified_type(decl))
13683 else if (pointer_type_def_sptr pointer_type = is_pointer_type(decl))
13685 else if (reference_type_def_sptr reference_type = is_reference_type(decl))
13687 else if (array_type_def_sptr array_type = is_array_type(decl))
13689 else if (array_type_def::subrange_sptr subrange_type = is_subrange_type(decl))
13709 if (decl_base_sptr decl = get_type_declaration(type))
13710 maybe_update_types_lookup_map(decl);
14142 // Look through decl-only types (classes, unions and enums)
14234 // Compare types by considering that decl-only classes don't
14241 // the decl-only-class-being-equal-to-a-matching-definition
15271 /// representation of the decl (or type) for the purpose of canonical
15497 /// representation of the decl (or type) for the purpose of canonical
16741 /// representation of the decl (or type) for the purpose of canonical
17273 /// representation of the decl (or type) for the purpose of canonical
17480 /// representation of the decl (or type) for the purpose of canonical
17883 /// representation of the decl (or type) for the purpose of canonical
18143 // Look through decl-only-enum.
18158 // One enum is decl-only while the other is not.
18168 // At this point, both enums have the same state of decl-only-ness.
18281 /// decl.
18296 /// decl.
18682 /// representation of the decl (or type) for the purpose of canonical
18850 /// involves comparing their underlying elf symbols. The decl name
18853 /// @param sym the new ELF symbol for this variable decl.
18868 /// @return sym the underlying ELF symbol for this variable decl, if
18904 /// Note that the decl won't hold a reference on the scope. It's
18983 // considering their decl names.
19126 /// representation of the decl (or type) for the purpose of canonical
19164 decl_base_sptr decl = get_type_declaration(et);
19165 ABG_ASSERT(decl);
19166 result += decl->get_qualified_name(internal)
19767 /// representation of the decl (or type) for the purpose of canonical
19995 /// representation of the decl (or type) for the purpose of canonical
20142 /// representation of the decl (or type) for the purpose of canonical
20191 /// representation of the decl (or type) for the purpose of canonical
20256 /// Getter for the first non-implicit parameter of a function decl.
20307 /// This sets the underlying ELF symbol for the current function decl.
20309 /// And underlyin$g ELF symbol for the current function decl might
20310 /// exist only if the corpus that this function decl originates from
20314 /// symbols involves comparing their underlying elf symbols. The decl
20317 /// @param sym the new ELF symbol for this function decl.
20332 /// @return sym the underlying ELF symbol for this function decl, if
20489 // w/o considering their decl names.
20601 /// @return the hash value for function decl.
21001 /// Get the hash of a decl. If the hash hasn't been computed yet,
21004 /// @return the hash of the decl.
21029 /// representation of the decl (or type) for the purpose of canonical
21273 /// Remove a given decl from the current @ref class_or_union scope.
21279 /// @param decl the declaration to remove from this @ref
21282 class_or_union::remove_member_decl(decl_base_sptr decl)
21284 type_base_sptr t = is_type(decl);
21772 /// @return the decl @p that got inserted.
21814 // If this is a decl-only type (and thus with no canonical type),
21927 // The two decl-only classes differ from their size. A
21928 // true decl-only class should not have a size property to
21963 else // A decl-only class is considered different from a
22652 /// representation of the decl (or type) for the purpose of canonical
23726 // If this is a decl-only type (and thus with no canonical type),
24486 /// representation of the decl (or type) for the purpose of canonical
24805 /// @param name the name of the template decl.
24916 // template decl might lead to comparing this very same template
25715 /// Hash an ABI artifact that is either a type or a decl.
25727 /// If the artifact is a decl, then a combination of the hash of its
25728 /// type and the hash of the other properties of the decl is computed.
25730 /// @param tod the type or decl to hash.
25809 /// @param t the type or decl to hash.
25816 /// Hash an ABI artifact that is either a type of a decl.
25830 /// system are decl-only class/union, the void type and variadic
25860 if (decl_base * decl = is_decl(type))
25862 // Make sure we get the real definition of a decl-only type.
25863 decl = look_through_decl_only(decl);
25864 type = is_type(decl);
25884 /// system are decl-only class/union and the void type.
25915 decl_base *decl = is_decl(t);
25916 if (decl
25917 && decl->get_is_declaration_only()
25918 && decl->get_naked_definition_of_declaration())
25921 is_type(decl->get_naked_definition_of_declaration());
25931 // non-canonicalized type. It must be a decl-only class or a void
26727 /// of a tree decl node.
26771 /// This is called when we start visiting a decl node, during the
26774 /// @param d the decl node we are visiting.
26784 /// @param d the decl node we are visiting.