Lines Matching defs:scope

1147 /// Getter of the the global scope of the translation unit.
1149 /// @return the global scope of the current translation unit. If
1150 /// there is not global scope allocated yet, this function creates one
1158 /// Getter of the the global scope of the translation unit.
1160 /// @return the global scope of the current translation unit. If
1161 /// there is not global scope allocated yet, this function creates one
4359 // name of the decl and the qualified name of its scope. So if in
4363 // the direct containing scope of this decl.
4368 // decl and the name of its scope; not the qualified name of the
4369 // scope.
4675 /// Having an anoymous parent means having a anonymous parent scope
4678 /// @return true iff the current decl has a direct or indirect scope
4683 scope_decl *scope = get_scope();
4684 if (!scope)
4686 return scope->get_is_anonymous();
4868 /// its scope.
4871 /// update_qualified_name when the decl is added to its scope.
4886 /// name of its scope. It doesn't contain the qualified name of its
4887 /// scope, unlike what is returned by decl_base::get_qualified_name.
4890 /// update_qualified_name when the decl is added to its scope.
5075 /// For decls that are part of an anonymous scope, only the
5152 /// If both of the current decls have an anonymous scope then let's
5165 // Both decls are anonymous and their scope are *NOT* anonymous.
5233 /// Setter of the scope of the current decl.
5235 /// Note that the decl won't hold a reference on the scope. It's
5236 /// rather the scope that holds a reference on its members.
5238 decl_base::set_scope(scope_decl* scope)
5241 priv_->context_ = new context_rel(scope);
5243 priv_->context_->set_scope(scope);
5384 /// Tests if a declaration has got a scope.
5388 /// @return true if the declaration has got a scope, false otherwise.
5393 /// Tests if a declaration has got a scope.
5397 /// @return true if the declaration has got a scope, false otherwise.
5946 /// Test if the scope of a given decl is anonymous or anonymous with a
5951 /// @return true iff the scope of @p d is anonymous or anonymous with
6507 /// stripped off. Usually, types are held by their scope, so their
6508 /// life time is bound to the life time of their scope. But as this
6509 /// function cannot really insert the built type into it's scope, it
7237 /// to a scope (e.g, using add_decl_to_scope) for its lifetime to be
7238 /// bound to the one of that scope. Otherwise, its lifetime is bound
7259 if (scope_decl *scope = (*i)->get_scope())
7260 add_decl_to_scope(subrange, scope);
7279 /// added to a scope (e.g, using add_decl_to_scope) for its lifetime
7280 /// to be bound to the one of that scope. Otherwise, its lifetime is
7303 /// to be added to a scope (e.g, using add_decl_to_scope) for its
7304 /// lifetime to be bound to the one of that scope. Otherwise, its
7333 scope_decl* scope = is_decl(type) ? is_decl(type)->get_scope() : 0;
7345 if (scope)
7346 add_decl_to_scope(is_decl(result), scope);
7365 scope_decl* scope = is_decl(t)->get_scope();
7390 add_decl_to_scope(is_decl(subtree), scope);
7400 scope_decl* scope =
7402 ABG_ASSERT(scope);
7403 add_decl_to_scope(is_decl(s), scope);
7416 scope_decl* scope =
7418 ABG_ASSERT(scope);
7419 add_decl_to_scope(is_decl(s), scope);
7435 scope_decl* scope = is_decl(e)->get_scope();
7436 ABG_ASSERT(scope);
7437 add_decl_to_scope(is_decl(s), scope);
7503 /// @param the name of the scope decl.
7530 /// @eturn the set of canonical types of the the current scope.
7535 /// @eturn the set of canonical types of the the current scope.
7540 /// Return a vector of sorted canonical types of the current scope.
7547 /// @return a vector of sorted canonical types of the current scope.
7609 /// scope.
7611 /// @return the number of anonymous classes contained in this scope.
7627 /// scope.
7629 /// @return the number of anonymous unions contained in this scope.
7645 /// scope.
7647 /// @return the number of anonymous enums contained in this scope.
7662 /// Getter for the scopes carried by the current scope.
7664 /// @return the scopes carried by the current scope.
7669 /// Getter for the scopes carried by the current scope.
7671 /// @return the scopes carried by the current scope.
7676 /// Test if the current scope is empty.
7678 /// @return true iff the current scope is empty.
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,
7691 /// it ABG_ASSERTs that member should not have its scope set, prior to
7694 /// @param member the new member decl to add to this scope.
7736 /// type of name @p name, for the current scope.
7766 /// scope, otherwise this will violate an ABG_ASSERTion.
7789 /// Remove a member type from the current @ref class_or_union 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.
7865 /// Remove a declaration from the current scope.
7867 /// @param member the declaration to remove from the scope.
7884 scope_decl_sptr scope = dynamic_pointer_cast<scope_decl>(member);
7885 if (scope)
8018 /// Find a member of the current scope and return an iterator on it.
8020 /// @param decl the scope member to find.
8053 /// Find a member of the current scope and return an iterator on it.
8055 /// @param decl the scope member to find.
8097 /// Appends a declaration to a given scope, if the declaration
8100 /// @param decl the declaration to add to the scope
8102 /// @param scope the scope to append the declaration to
8104 add_decl_to_scope(decl_base_sptr decl, scope_decl* scope)
8106 ABG_ASSERT(scope);
8108 if (scope && decl && !decl->get_scope())
8109 decl = scope->add_member_decl(decl);
8114 /// Appends a declaration to a given scope, if the declaration doesn't
8115 /// already belong to a scope.
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.
8133 scope_decl* scope = decl->get_scope();
8134 scope->remove_member_decl(decl);
8138 /// Inserts a declaration into a given scope, before a given IR child
8139 /// node of the scope.
8141 /// @param decl the declaration to insert into the scope.
8146 /// @param scope the scope into which to insert the declaration.
8150 scope_decl* scope)
8152 if (scope && decl && !decl->get_scope())
8154 decl_base_sptr d = scope->insert_member_decl(decl, before);
8160 /// Inserts a declaration into a given scope, before a given IR child
8161 /// node of the scope.
8163 /// @param decl the declaration to insert into the scope.
8168 /// @param scope the scope into which to insert the declaration.
8172 scope_decl_sptr scope)
8173 {return insert_decl_into_scope(decl, before, scope.get());}
8177 /// @param tu the translation unit the scope belongs to.
8190 /// return the global scope as seen by a given declaration.
8194 /// @return the global scope of the decl, or a null pointer if the
8202 scope_decl* scope = decl.get_scope();
8203 while (scope && !dynamic_cast<global_scope*>(scope))
8204 scope = scope->get_scope();
8206 return scope ? dynamic_cast<global_scope*> (scope) : 0;
8209 /// return the global scope as seen by a given declaration.
8213 /// @return the global scope of the decl, or a null pointer if the
8219 /// Return the global scope as seen by a given declaration.
8223 /// @return the global scope of the decl, or a null pointer if the
8229 /// Return the a scope S containing a given declaration and that is
8230 /// right under a given scope P.
8232 /// Note that @p scope must come before @p decl in topological
8235 /// @param decl the decl for which to find a scope.
8237 /// @param scope the scope under which the resulting scope must be.
8239 /// @return the resulting scope.
8242 const scope_decl* scope)
8247 if (scope == 0)
8250 // Handle the case where decl is a scope itself.
8256 return scope;
8258 // Here, decl is in the scope 'scope', or decl and 'scope' are the
8260 if (s == scope)
8263 while (s && !is_global_scope(s) && s->get_scope() != scope)
8269 return scope;
8275 /// Return the a scope S containing a given declaration and that is
8276 /// right under a given scope P.
8278 /// @param decl the decl for which to find a scope.
8280 /// @param scope the scope under which the resulting scope must be.
8282 /// @return the resulting scope.
8285 const scope_decl* scope)
8286 {return get_top_most_scope_under(decl.get(), scope);}
8288 /// Return the a scope S containing a given declaration and that is
8289 /// right under a given scope P.
8291 /// @param decl the decl for which to find a scope.
8293 /// @param scope the scope under which the resulting scope must be.
8295 /// @return the resulting scope.
8298 const scope_decl_sptr scope)
8299 {return get_top_most_scope_under(decl, scope.get());}
8375 /// Build and return a qualified name from a name and its scope.
8378 /// scope.
8380 /// @param the scope to consider.
8386 build_qualified_name(const scope_decl* scope, const string& name)
8392 if (scope)
8393 qualified_name = scope->get_qualified_name();
8403 /// Build and return the qualified name of a type in its scope.
8405 /// @param scope the scope of the type to consider.
8409 build_qualified_name(const scope_decl* scope, const type_base_sptr& type)
8410 {return build_qualified_name(scope, get_name((type)));}
8448 /// Get the scope of a given type.
8452 /// @return the scope of type @p t or 0 if the type has no scope yet.
8465 /// Get the scope of a given type.
8469 /// @return the scope of type @p t or 0 if the type has no scope yet.
9661 /// Tests whether if a given scope is the global scope.
9663 /// @param scope the scope to consider.
9665 /// @return true iff the current scope is the global one.
9667 is_global_scope(const scope_decl& scope)
9668 {return !!dynamic_cast<const global_scope*>(&scope);}
9670 /// Tests whether if a given scope is the global scope.
9672 /// @param scope the scope to consider.
9674 /// @return the @ref global_scope* representing the scope @p scope or
9675 /// 0 if @p scope is not a global scope.
9677 is_global_scope(const scope_decl* scope)
9678 {return dynamic_cast<const global_scope*>(scope);}
9680 /// Tests whether if a given scope is the global scope.
9682 /// @param scope the scope to consider.
9684 /// @return true iff the current scope is the global one.
9686 is_global_scope(const shared_ptr<scope_decl>scope)
9687 {return is_global_scope(scope.get());}
9689 /// Tests whether a given declaration is at global scope.
9693 /// @return true iff decl is at global scope.
9698 /// Tests whether a given declaration is at global scope.
9702 /// @return true iff decl is at global scope.
9707 /// Tests whether a given declaration is at global scope.
9711 /// @return true iff decl is at global scope.
9716 /// Tests whether a given decl is at class scope.
9720 /// @return true iff decl is at class scope.
9725 /// Tests whether a given decl is at class scope.
9729 /// @return true iff decl is at class scope.
9739 /// Tests whether a given decl is at class scope.
9743 /// @return true iff decl is at class scope.
9747 scope_decl* scope = decl.get_scope();
9748 if (class_or_union* cl = is_class_type(scope))
9750 if (class_or_union* cl = is_union_type(scope))
9778 /// Tests whether a given decl is at template scope.
9781 /// and template patterns (function or class) can be at template scope.
9785 /// @return true iff the decl is at template scope.
11473 /// Lookup a type in a scope.
11475 /// This is really slow as it walks the member types of the scope in
11486 /// @param skope the scope to look into.
11498 /// Lookup a @ref var_decl in a scope.
11502 /// @param skope the scope to look into.
11519 /// Note that a node is a member of a scope.
11571 /// Lookup a node in a given scope.
11578 /// @param skope the scope to look into.
11590 scope_decl_sptr cur_scope = skope, new_scope, scope;
11603 // looking for a scope
11604 scope = dynamic_pointer_cast<scope_decl>(*m);
11605 if (scope && scope->get_name() == *c)
11607 new_scope = scope;
11635 /// lookup a type in a scope.
11638 /// This is really slow as it walks the member types of the scope in
11650 /// @param skope the scope to look into.
11655 const scope_decl_sptr& scope)
11656 {return is_type(lookup_node_in_scope<type_base>(comps, scope));}
11658 /// lookup a type in a scope.
11660 /// This is really slow as it walks the member types of the scope in
11672 /// before reaching the scope into which to look for @p type. Note
11673 /// that the deepest scope (the one immediately containing @p type) is
11674 /// at index 0 of this vector, and the top-most scope is the last
11677 /// @param scope the top-most scope into which to look for @p type.
11679 /// @return the scope found in @p scope, or NULL if it wasn't found.
11683 const scope_decl* scope)
11692 ABG_ASSERT(first_scope->get_name() == scope->get_name());
11700 scope->get_member_decls().begin();
11701 i != scope->get_member_decls().end();
11714 scope->get_member_scopes().begin();
11715 i != scope->get_member_scopes().end();
11729 /// lookup a type in a scope.
11731 /// This is really slow as it walks the member types of the scope in
11742 /// @param scope the top-most scope into which to look for @p type.
11744 /// @return the scope found in @p scope, or NULL if it wasn't found.
11747 const scope_decl* scope)
11761 return lookup_type_in_scope(*type, access_path, scope);
11792 /// lookup a var_decl in a scope.
11797 /// @param skope the scope to look into.
13189 /// @param scope the scope of the type to consider.
13630 /// @param scope the scope of the function type.
14461 scope_decl *scope = d->get_scope();
14463 // belonging to its scope.
14464 if (scope)
14466 if (is_type(scope))
14467 // The scope in question is itself a type (e.g, a class
14471 if (type_base_sptr c = is_type(scope)->get_canonical_type())
14475 // enough to get the types that belong to the scope of
14477 scope = is_scope_decl(is_decl(c)).get();
14478 scope->get_canonical_types().insert(canonical);
14480 // else, if the type doesn't have a scope, it's not meant to be
15389 /// Note that this function does not consider the scope of the scope
15392 /// @return true iff both scope types are equal.
15408 /// @return true iff both scope types are equal.
15522 /// Note that this function does not check if the scope of these
18891 class_or_union* scope = is_class_or_union_type(get_scope());
18892 scope->add_data_member(v, get_member_access_specifier(*this),
18902 /// Setter of the scope of the current var_decl.
18904 /// Note that the decl won't hold a reference on the scope. It's
18905 /// rather the scope that holds a reference on its members.
18907 /// @param scope the new scope.
18909 var_decl::set_scope(scope_decl* scope)
18912 set_context_rel(new dm_context_rel(scope));
18914 get_context_rel()->set_scope(scope);
19150 if (class_or_union* scope = is_at_class_scope(this))
19151 if (scope->get_is_anonymous())
19858 /// relationship between a method *declaration* and its scope.
19898 /// relationship between a method *declaration* and its scope.
20393 class_or_union* scope = is_class_or_union_type(get_scope());
20394 ABG_ASSERT(scope);
20395 scope->add_member_function(m, get_member_access_specifier(*this),
21273 /// Remove a given decl from the current @ref class_or_union scope.
21280 /// class_or_union scope.
21450 /// to a scope.
23069 /// @param scope the new containing class_decl.
23071 method_decl::set_scope(scope_decl* scope)
23074 set_context_rel(new mem_fn_context_rel(scope));
23076 get_context_rel()->set_scope(scope);
23242 /// should not have been already added to a scope.
23330 /// Return true iff the class has no entity in its scope.
24237 scope_decl* scope = d.get_scope();
24239 if (class_or_union* cl = is_class_or_union_type(scope))