Lines Matching refs:decl
795 /// Test if a given decl has been written out to the XML output.
797 /// @param the decl to consider.
799 /// @return true if the decl has already been emitted, false
802 decl_is_emitted(const decl_base_sptr& decl) const
804 ABG_ASSERT(!is_type(decl));
805 string repr = get_pretty_representation(decl, true);
806 interned_string irepr = decl->get_environment().intern(repr);
812 /// @param decl the decl to consider.
814 record_decl_as_emitted(const decl_base_sptr& decl)
816 string repr = get_pretty_representation(decl, true);
817 interned_string irepr = decl->get_environment().intern(repr);
992 /// @return true iff decl is valid.
995 annotate(const T& decl,
999 if (!decl)
1010 << xml::escape_xml_comment(decl->get_pretty_representation(/*internal=*/false))
1025 /// @return true iff decl is valid
1056 /// @return true iff decl is valid
1091 /// parameter of the function decl.
1093 /// @return true iff decl is valid
1129 /// @param fn the function decl to annotate.
1136 /// parameter of the function decl.
1138 /// @return true iff decl is valid
1187 /// @return true iff decl is valid
1259 /// Write the location of a decl to the output stream.
1263 /// @param decl the decl to consider.
1267 write_location(const decl_base_sptr& decl,
1270 if (!decl)
1273 location loc = decl->get_location();
1280 /// Serialize the visibility property of the current decl as the
1283 /// @param decl the instance of decl_base to consider.
1289 write_visibility(const shared_ptr<decl_base>& decl, ostream& o)
1291 if (!decl)
1294 decl_base::visibility v = decl->get_visibility();
1323 /// Serialize the 'binding' property of the current decl.
1325 /// @param decl the decl to consider.
1329 write_binding(const shared_ptr<decl_base>& decl, ostream& o)
1331 if (!decl)
1337 dynamic_pointer_cast<var_decl>(decl);
1343 dynamic_pointer_cast<function_decl>(decl);
1370 /// Write the "is-artificial" attribute of the @ref decl.
1372 /// @param decl the declaration to consider.
1379 write_is_artificial(const decl_base_sptr& decl, ostream& o)
1381 if (!decl)
1384 if (decl->get_is_artificial())
1441 /// @param decl the type to consider.
1453 write_size_and_alignment(const shared_ptr<type_base> decl, ostream& o,
1456 size_t size_in_bits = decl->get_size_in_bits();
1460 size_t alignment_in_bits = decl->get_alignment_in_bits();
1466 /// @param decl the type to consider.
1470 write_array_size_and_alignment(const shared_ptr<array_type_def> decl, ostream& o)
1472 if (decl->is_infinite())
1475 size_t size_in_bits = decl->get_size_in_bits();
1480 size_t alignment_in_bits = decl->get_alignment_in_bits();
1725 /// current decl.
1763 /// current decl.
1836 /// decl is anonymous
1842 write_is_anonymous(const decl_base_sptr& decl, ostream& o)
1844 if (decl->get_is_anonymous())
1855 write_naming_typedef(const decl_base_sptr& decl, write_context& ctxt)
1857 if (!decl)
1862 if (typedef_decl_sptr typedef_type = decl->get_naming_typedef())
1910 /// @param decl the pointer to decl_base to serialize
1920 write_decl(const decl_base_sptr& decl, write_context& ctxt, unsigned indent)
1922 if (write_type_decl(dynamic_pointer_cast<type_decl> (decl),
1924 || write_namespace_decl(dynamic_pointer_cast<namespace_decl>(decl),
1927 (decl),
1929 || write_pointer_type_def(dynamic_pointer_cast<pointer_type_def>(decl),
1932 <reference_type_def>(decl), ctxt, indent)
1934 <array_type_def>(decl), ctxt, indent)
1935 || write_enum_type_decl(dynamic_pointer_cast<enum_type_decl>(decl),
1937 || write_typedef_decl(dynamic_pointer_cast<typedef_decl>(decl),
1939 || write_var_decl(dynamic_pointer_cast<var_decl>(decl), ctxt,
1942 (decl), ctxt, /*skip_first_parameter=*/true,
1944 || write_function_decl(dynamic_pointer_cast<function_decl>(decl),
1946 || write_class_decl(is_class_type(decl), ctxt, indent)
1947 || write_union_decl(is_union_type(decl), ctxt, indent)
1949 (dynamic_pointer_cast<function_tdecl>(decl), ctxt, indent))
1951 (dynamic_pointer_cast<class_tdecl>(decl), ctxt, indent)))
1963 /// @param decl the decl to emit.
1969 write_decl_in_scope(const decl_base_sptr& decl,
1973 type_base_sptr type = is_type(decl);
1980 for (scope_decl* s = decl->get_scope();
2000 o << "<namespace-decl name='"
2003 closing_tags.push("</namespace-decl>");
2013 closing_tags.push("</class-decl>");
2027 closing_tags.push("</union-decl>");
2042 write_decl(decl, ctxt, indent);
2333 decl_base_sptr decl(d, noop_deleter());
2334 write_decl_in_scope(decl, ctxt,
2445 for (const decl_base_sptr& decl : decls)
2447 if (type_base_sptr t = is_type(decl))
2464 if (!ctxt.decl_is_emitted(decl))
2465 write_decl(decl, ctxt, indent + c.get_xml_element_indent());
2527 o << "<type-decl name='" << xml::escape_xml_string(d->get_name()) << "'";
2546 /// @param decl the namespace declaration to serialize.
2556 write_namespace_decl(const namespace_decl_sptr& decl,
2559 if (!decl || decl->is_empty_or_has_empty_sub_namespaces())
2565 annotate(decl, ctxt, indent);
2569 o << "<namespace-decl name='"
2570 << xml::escape_xml_string(decl->get_name())
2575 const declarations& d = decl->get_sorted_member_decls();
2577 write_canonical_types_of_scope(*decl, ctxt,
2591 o << "</namespace-decl>\n";
2598 /// @param decl the qualfied type declaration to write.
2615 write_qualified_type_def(const qualified_type_def_sptr& decl,
2620 if (!decl)
2626 type_base_sptr underlying_type = decl->get_underlying_type();
2628 annotate(decl, ctxt, indent);
2637 if (decl->get_cv_quals() & qualified_type_def::CV_CONST)
2639 if (decl->get_cv_quals() & qualified_type_def::CV_VOLATILE)
2641 if (decl->get_cv_quals() & qualified_type_def::CV_RESTRICT)
2644 write_location(static_pointer_cast<decl_base>(decl), ctxt);
2648 i = ctxt.get_id_for_type(decl);
2652 ctxt.record_type_as_emitted(decl);
2659 /// @param decl the qualfied type declaration to write.
2668 write_qualified_type_def(const qualified_type_def_sptr& decl,
2671 {return write_qualified_type_def(decl, "", ctxt, indent);}
2675 /// @param decl the pointer_type_def to serialize.
2691 write_pointer_type_def(const pointer_type_def_sptr& decl,
2696 if (!decl)
2702 type_base_sptr pointed_to_type = decl->get_pointed_to_type();
2704 annotate(decl->get_canonical_type(), ctxt, indent);
2713 write_size_and_alignment(decl, o,
2716 : decl->get_translation_unit()->get_address_size()),
2721 i = ctxt.get_id_for_type(decl);
2725 write_location(static_pointer_cast<decl_base>(decl), ctxt);
2728 ctxt.record_type_as_emitted(decl);
2735 /// @param decl the pointer_type_def to serialize.
2743 write_pointer_type_def(const pointer_type_def_sptr& decl,
2746 {return write_pointer_type_def(decl, "", ctxt, indent);}
2750 /// @param decl the reference_type_def to serialize.
2766 write_reference_type_def(const reference_type_def_sptr& decl,
2771 if (!decl)
2774 annotate(decl->get_canonical_type(), ctxt, indent);
2781 if (decl->is_lvalue())
2787 type_base_sptr pointed_to_type = decl->get_pointed_to_type();
2792 if (function_type_sptr f = is_function_type(decl->get_pointed_to_type()))
2795 write_size_and_alignment(decl, o,
2798 : decl->get_translation_unit()->get_address_size()),
2803 i = ctxt.get_id_for_type(decl);
2806 write_location(static_pointer_cast<decl_base>(decl), ctxt);
2810 ctxt.record_type_as_emitted(decl);
2817 /// @param decl the reference_type_def to serialize.
2825 write_reference_type_def(const reference_type_def_sptr& decl,
2828 {return write_reference_type_def(decl, "", ctxt, indent);}
2832 /// @param decl the array_type_def::subrange_type to serialize.
2840 write_array_subrange_type(const array_type_def::subrange_sptr& decl,
2844 if (!decl)
2847 annotate(decl, ctxt, indent);
2855 if (!decl->get_name().empty())
2856 o << " name='" << decl->get_name() << "'";
2859 if (decl->is_infinite())
2862 o << decl->get_length();
2866 if (decl->get_lower_bound())
2868 ABG_ASSERT(decl->is_infinite()
2869 || (decl->get_length() ==
2870 (uint64_t) (decl->get_upper_bound()
2871 - decl->get_lower_bound() + 1)));
2872 o << " lower-bound='" << decl->get_lower_bound() << "' upper-bound='"
2873 << decl->get_upper_bound() << "'";
2876 type_base_sptr underlying_type = decl->get_underlying_type();
2885 o << " id='" << ctxt.get_id_for_type(decl) << "'";
2887 write_location(decl->get_location(), ctxt);
2891 ctxt.record_type_as_emitted(decl);
2898 /// @param decl the array_type_def to serialize.
2914 write_array_type_def(const array_type_def_sptr& decl,
2919 if (!decl)
2922 annotate(decl, ctxt, indent);
2929 o << " dimensions='" << decl->get_dimension_count() << "'";
2931 type_base_sptr element_type = decl->get_element_type();
2936 write_array_size_and_alignment(decl, o);
2940 i = ctxt.get_id_for_type(decl);
2943 write_location(static_pointer_cast<decl_base>(decl), ctxt);
2945 if (!decl->get_dimension_count())
2953 for (si = decl->get_subranges().begin();
2954 si != decl->get_subranges().end(); ++si)
2965 ctxt.record_type_as_emitted(decl);
2972 /// @param decl the array_type_def to serialize.
2980 write_array_type_def(const array_type_def_sptr& decl,
2983 {return write_array_type_def(decl, "", ctxt, indent);}
2987 /// @param decl the enum_type_decl to serialize.
3011 enum_type_decl_sptr decl = is_enum_type(look_through_decl_only_enum(d));
3013 annotate(decl->get_canonical_type(), ctxt, indent);
3018 o << "<enum-decl name='" << xml::escape_xml_string(decl->get_name()) << "'";
3020 write_is_anonymous(decl, o);
3021 write_naming_typedef(decl, ctxt);
3022 write_is_artificial(decl, o);
3023 write_is_non_reachable(is_type(decl), o);
3025 if (!decl->get_linkage_name().empty())
3027 << xml::escape_xml_string(decl->get_linkage_name())
3030 write_location(decl, ctxt);
3031 write_is_declaration_only(decl, o);
3035 i = ctxt.get_id_for_type(decl);
3040 << ctxt.get_id_for_type(decl->get_underlying_type())
3044 decl->get_enumerators().begin();
3045 i != decl->get_enumerators().end();
3057 o << "</enum-decl>\n";
3059 ctxt.record_type_as_emitted(decl);
3066 /// @param decl the enum_type_decl to serialize.
3074 write_enum_type_decl(const enum_type_decl_sptr& decl,
3077 {return write_enum_type_decl(decl, "", ctxt, indent);}
3203 /// @param decl the typedef_decl to serialize.
3219 write_typedef_decl(const typedef_decl_sptr& decl,
3224 if (!decl)
3229 annotate(decl, ctxt, indent);
3233 o << "<typedef-decl name='"
3234 << xml::escape_xml_string(decl->get_name())
3237 type_base_sptr underlying_type = decl->get_underlying_type();
3242 write_location(decl, ctxt);
3246 i = ctxt.get_id_for_type(decl);
3250 ctxt.record_type_as_emitted(decl);
3257 /// @param decl the typedef_decl to serialize.
3265 write_typedef_decl(const typedef_decl_sptr& decl,
3268 {return write_typedef_decl(decl, "", ctxt, indent);}
3272 /// @param decl the var_decl to serialize.
3283 write_var_decl(const var_decl_sptr& decl, write_context& ctxt,
3286 if (!decl)
3289 annotate(decl, ctxt, indent);
3295 o << "<var-decl name='" << xml::escape_xml_string(decl->get_name()) << "'";
3296 type_base_sptr var_type = decl->get_type();
3302 const string& linkage_name = decl->get_linkage_name();
3307 write_visibility(decl, o);
3309 write_binding(decl, o);
3311 write_location(decl, ctxt);
3313 write_elf_symbol_reference(decl->get_symbol(), o);
3317 ctxt.record_decl_as_emitted(decl);
3324 /// @param decl the pointer to function_decl to serialize.
3329 /// parameter of the function decl.
3335 write_function_decl(const function_decl_sptr& decl, write_context& ctxt,
3338 if (!decl)
3341 annotate(decl, ctxt, indent);
3347 o << "<function-decl name='"
3348 << xml::escape_xml_string(decl->get_name())
3351 if (!decl->get_linkage_name().empty())
3353 << xml::escape_xml_string(decl->get_linkage_name()) << "'";
3355 write_location(decl, ctxt);
3357 if (decl->is_declared_inline())
3360 write_visibility(decl, o);
3362 write_binding(decl, o);
3364 write_size_and_alignment(decl->get_type(), o,
3367 : decl->get_translation_unit()->get_address_size()),
3369 write_elf_symbol_reference(decl->get_symbol(), o);
3375 decl->get_parameters().begin();
3376 for ((skip_first_parm && pi != decl->get_parameters().end()) ? ++pi: pi;
3377 pi != decl->get_parameters().end();
3407 if (shared_ptr<type_base> return_type = decl->get_return_type())
3417 o << "</function-decl>\n";
3419 ctxt.record_decl_as_emitted(decl);
3426 /// @param decl the pointer to function_type to serialize.
3520 /// Write the opening tag of a 'class-decl' element.
3522 /// @param decl the class declaration to serialize.
3524 /// @param the type ID to use for the 'class-decl' element,, or empty
3538 write_class_decl_opening_tag(const class_decl_sptr& decl,
3544 if (!decl)
3551 o << "<class-decl name='" << xml::escape_xml_string(decl->get_name()) << "'";
3553 write_size_and_alignment(decl, o);
3555 write_is_struct(decl, o);
3557 write_is_anonymous(decl, o);
3559 write_is_artificial(decl, o);
3561 write_is_non_reachable(is_type(decl), o);
3563 write_naming_typedef(decl, ctxt);
3565 write_visibility(decl, o);
3567 write_location(decl, ctxt);
3569 write_is_declaration_only(decl, o);
3571 if (decl->get_earlier_declaration())
3574 o << " def-of-decl-id='"
3575 << ctxt.get_id_for_type(is_type(decl->get_earlier_declaration()))
3581 i = ctxt.get_id_for_type(decl);
3584 if (prepare_to_handle_empty && decl->has_no_base_nor_member())
3592 /// Write the opening tag of a 'union-decl' element.
3594 /// @param decl the union declaration to serialize.
3596 /// @param the type ID to use for the 'union-decl' element, or empty
3610 write_union_decl_opening_tag(const union_decl_sptr& decl,
3616 if (!decl)
3623 o << "<union-decl name='" << xml::escape_xml_string(decl->get_name()) << "'";
3625 if (!decl->get_is_declaration_only())
3626 write_size_and_alignment(decl, o);
3628 write_is_anonymous(decl, o);
3630 write_naming_typedef(decl, ctxt);
3632 write_visibility(decl, o);
3634 write_is_artificial(decl, o);
3636 write_is_non_reachable(is_type(decl), o);
3638 write_location(decl, ctxt);
3640 write_is_declaration_only(decl, o);
3644 i = ctxt.get_id_for_type(decl);
3647 if (prepare_to_handle_empty && decl->has_no_member())
3679 class_decl_sptr decl = is_class_type(look_through_decl_only_class(d));
3681 annotate(decl, ctxt, indent);
3685 if (decl->get_is_declaration_only())
3691 // We are looking at a decl-only class. All decl-only classes
3693 // decl-only class can still have member types. So we might
3694 // have other decl-only classes of the same name as this one,
3697 // Those other decl-only classes of the same name might have a
3699 // decl-only class that is seen first, "different" ones might be
3704 // So let's gather all the member-types of all the decl-only
3706 if (lookup_decl_only_class_types(env.intern(decl->get_qualified_name()),
3707 *decl->get_corpus(),
3723 // decl-only class we are looking at, so let's emit them in
3726 write_class_decl_opening_tag(decl, id, ctxt, indent,
3740 o << indent << "</class-decl>\n";
3742 // Mark all the decl-only classes as emitted, even if just
3751 write_class_decl_opening_tag(decl, id, ctxt, indent,
3754 if (!decl->has_no_base_nor_member())
3759 decl->get_base_specifiers().begin();
3760 base != decl->get_base_specifiers().end();
3782 write_canonical_types_of_scope(*decl, ctxt, nb_ws,
3786 decl->get_sorted_member_types().begin();
3787 ti != decl->get_sorted_member_types().end();
3793 decl->get_data_members().begin();
3794 data != decl->get_data_members().end();
3818 decl->get_member_functions().begin();
3819 f != decl->get_member_functions().end();
3849 decl->get_virtual_mem_fns().begin();
3850 f != decl->get_virtual_mem_fns().end();
3877 decl->get_member_function_templates().begin();
3878 fn != decl->get_member_function_templates().end();
3896 decl->get_member_class_templates().begin();
3897 cl != decl->get_member_class_templates().end();
3914 o << "</class-decl>\n";
3917 ctxt.record_type_as_emitted(decl);
3924 /// @param decl the pointer to class_decl to serialize.
3932 write_class_decl(const class_decl_sptr& decl,
3935 {return write_class_decl(decl, "", ctxt, indent);}
3955 union_decl_sptr decl = is_union_type(look_through_decl_only_class(d));
3957 annotate(decl, ctxt, indent);
3961 write_union_decl_opening_tag(decl, id, ctxt, indent,
3963 if (!decl->has_no_member())
3967 decl->get_member_types().begin();
3968 ti != decl->get_member_types().end();
3973 write_canonical_types_of_scope(*decl, ctxt, nb_ws,
3977 decl->get_data_members().begin();
3978 data != decl->get_data_members().end();
4001 decl->get_member_functions().begin();
4002 f != decl->get_member_functions().end();
4032 decl->get_member_function_templates().begin();
4033 fn != decl->get_member_function_templates().end();
4051 decl->get_member_class_templates().begin();
4052 cl != decl->get_member_class_templates().end();
4069 o << "</union-decl>\n";
4072 ctxt.record_type_as_emitted(decl);
4078 write_union_decl(const union_decl_sptr& decl,
4081 {return write_union_decl(decl, "", ctxt, indent);}
4101 decl_base_sptr decl = get_type_declaration(t);
4102 ABG_ASSERT(decl);
4105 write_access(decl, o);
4118 /// @param decl the declaration of the member type to serialize.
4161 /// @param decl the instance to serialize.
4169 write_type_tparameter(const type_tparameter_sptr decl,
4173 if (!decl)
4180 if (ctxt.type_has_existing_id(decl))
4186 << id_attr_name << "='" << ctxt.get_id_for_type(decl) << "'";
4188 std::string name = xml::escape_xml_string(decl->get_name ());
4192 write_location(decl, ctxt);
4196 ctxt.record_type_as_emitted(decl);
4203 /// @param decl the instance to serialize.
4212 const shared_ptr<non_type_tparameter> decl,
4215 if (!decl)
4222 << ctxt.get_id_for_type(decl->get_type())
4225 string name = xml::escape_xml_string(decl->get_name());
4229 write_location(decl, ctxt);
4238 /// @param decl the instance to serialize.
4247 write_template_tparameter (const template_tparameter_sptr decl,
4251 if (!decl)
4258 if (ctxt.type_has_existing_id(decl))
4262 << ctxt.get_id_for_type(decl) << "'";
4264 string name = xml::escape_xml_string(decl->get_name());
4272 decl->get_template_parameters().begin();
4273 p != decl->get_template_parameters().end();
4275 write_template_parameter(decl, ctxt, nb_spaces);
4280 ctxt.record_type_as_emitted(decl);
4287 /// @param decl the decl to serialize.
4296 (const shared_ptr<type_composition> decl,
4299 if (!decl)
4310 (dynamic_pointer_cast<pointer_type_def>(decl->get_composed_type()),
4313 (dynamic_pointer_cast<reference_type_def>(decl->get_composed_type()),
4316 (dynamic_pointer_cast<array_type_def>(decl->get_composed_type()),
4319 (dynamic_pointer_cast<qualified_type_def>(decl->get_composed_type()),
4330 /// @param decl the instance to serialize.
4338 write_template_parameter(const shared_ptr<template_parameter> decl,
4342 (dynamic_pointer_cast<type_tparameter>(decl), ctxt, indent))
4344 (dynamic_pointer_cast<non_type_tparameter>(decl),
4347 (dynamic_pointer_cast<template_tparameter>(decl),
4350 (dynamic_pointer_cast<type_composition>(decl),
4377 /// @param decl the instance to serialize.
4383 write_function_tdecl(const shared_ptr<function_tdecl> decl,
4386 if (!decl)
4393 o << "<function-template-decl id='" << ctxt.get_id_for_fn_tmpl(decl) << "'";
4395 write_location(decl, ctxt);
4397 write_visibility(decl, o);
4399 write_binding(decl, o);
4403 write_template_parameters(decl, ctxt, indent);
4405 write_function_decl(decl->get_pattern(), ctxt,
4411 o << "</function-template-decl>\n";
4419 /// @param decl a pointer to the instance of class_tdecl to serialize.
4428 write_class_tdecl(const shared_ptr<class_tdecl> decl,
4431 if (!decl)
4438 o << "<class-template-decl id='" << ctxt.get_id_for_class_tmpl(decl) << "'";
4440 write_location(decl, ctxt);
4442 write_visibility(decl, o);
4446 write_template_parameters(decl, ctxt, indent);
4448 write_class_decl(decl->get_pattern(), ctxt,
4453 o << "</class-template-decl>\n";
4797 /// Serialize the source location of a decl to an output stream for
4807 /// Serialize the source location of a decl to stderr for debugging
4826 /// Serialize the source location of a decl to stderr for debugging