本文整理汇总了C++中TYPE_CONTEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ TYPE_CONTEXT函数的具体用法?C++ TYPE_CONTEXT怎么用?C++ TYPE_CONTEXT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TYPE_CONTEXT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump_type_inheritance_graph
static void
dump_type_inheritance_graph (FILE *f)
{
unsigned int i;
if (!odr_types_ptr)
return;
fprintf (f, "\n\nType inheritance graph:\n");
for (i = 0; i < odr_types.length (); i++)
{
if (odr_types[i]->bases.length () == 0)
dump_odr_type (f, odr_types[i]);
}
for (i = 0; i < odr_types.length (); i++)
{
if (odr_types[i]->types && odr_types[i]->types->length ())
{
unsigned int j;
fprintf (f, "Duplicate tree types for odr type %i\n", i);
print_node (f, "", odr_types[i]->type, 0);
for (j = 0; j < odr_types[i]->types->length (); j++)
{
tree t;
fprintf (f, "duplicate #%i\n", j);
print_node (f, "", (*odr_types[i]->types)[j], 0);
t = (*odr_types[i]->types)[j];
while (TYPE_P (t) && TYPE_CONTEXT (t))
{
t = TYPE_CONTEXT (t);
print_node (f, "", t, 0);
}
putc ('\n',f);
}
}
}
}
示例2: pp_cxx_simple_type_specifier
static void
pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
{
switch (TREE_CODE (t))
{
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
pp_cxx_qualified_id (pp, t);
break;
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
case TEMPLATE_PARM_INDEX:
pp_cxx_unqualified_id (pp, t);
break;
case TYPENAME_TYPE:
pp_cxx_identifier (pp, "typename");
pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
pp_cxx_unqualified_id (pp, TYPE_NAME (t));
break;
default:
pp_c_type_specifier (pp_c_base (pp), t);
break;
}
}
示例3: pp_cxx_nested_name_specifier
static void
pp_cxx_nested_name_specifier (cxx_pretty_printer *pp, tree t)
{
if (t != NULL && t != pp->enclosing_scope)
{
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
pp_cxx_nested_name_specifier (pp, scope);
pp_cxx_template_keyword_if_needed (pp, scope, t);
pp_cxx_unqualified_id (pp, t);
pp_cxx_colon_colon (pp);
}
}
示例4: cxx_get_alias_set
static HOST_WIDE_INT
cxx_get_alias_set (tree t)
{
if (TREE_CODE (t) == RECORD_TYPE
&& TYPE_CONTEXT (t) && CLASS_TYPE_P (TYPE_CONTEXT (t))
&& CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
/* The base variant of a type must be in the same alias set as the
complete type. */
return get_alias_set (TYPE_CONTEXT (t));
if (/* It's not yet safe to use alias sets for some classes in C++. */
!ok_to_generate_alias_set_for_type (t)
/* Nor is it safe to use alias sets for pointers-to-member
functions, due to the fact that there may be more than one
RECORD_TYPE type corresponding to the same pointer-to-member
type. */
|| TYPE_PTRMEMFUNC_P (t))
return 0;
return c_common_get_alias_set (t);
}
示例5: cxx_get_alias_set
HOST_WIDE_INT
cxx_get_alias_set (tree t)
{
if (IS_FAKE_BASE_TYPE (t))
/* The base variant of a type must be in the same alias set as the
complete type. */
return get_alias_set (TYPE_CONTEXT (t));
/* Punt on PMFs until we canonicalize functions properly. */
if (TYPE_PTRMEMFUNC_P (t))
return 0;
return c_common_get_alias_set (t);
}
示例6: pp_cxx_qualified_id
static void
pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
{
switch (TREE_CODE (t))
{
/* A pointer-to-member is always qualified. */
case PTRMEM_CST:
pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t));
pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t));
break;
/* In Standard C++, functions cannot possibly be used as
nested-name-specifiers. However, there are situations where
is "makes sense" to output the surrounding function name for the
purpose of emphasizing on the scope kind. Just printing the
function name might not be sufficient as it may be overloaded; so,
we decorate the function with its signature too.
FIXME: This is probably the wrong pretty-printing for conversion
functions and some function templates. */
case OVERLOAD:
t = OVL_CURRENT (t);
case FUNCTION_DECL:
if (DECL_FUNCTION_MEMBER_P (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id
(pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
pp_cxx_parameter_declaration_clause (pp, TREE_TYPE (t));
break;
case OFFSET_REF:
case SCOPE_REF:
pp_cxx_nested_name_specifier (pp, TREE_OPERAND (t, 0));
pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 1));
break;
default:
{
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
if (scope != pp->enclosing_scope)
{
pp_cxx_nested_name_specifier (pp, scope);
pp_cxx_template_keyword_if_needed (pp, scope, t);
}
pp_cxx_unqualified_id (pp, t);
}
break;
}
}
示例7: lto_input_ts_type_common_tree_pointers
static void
lto_input_ts_type_common_tree_pointers (struct lto_input_block *ib,
struct data_in *data_in, tree expr)
{
TYPE_SIZE (expr) = stream_read_tree (ib, data_in);
TYPE_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);
TYPE_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);
TYPE_NAME (expr) = stream_read_tree (ib, data_in);
/* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO. They will be
reconstructed during fixup. */
/* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
during fixup. */
TYPE_MAIN_VARIANT (expr) = stream_read_tree (ib, data_in);
TYPE_CONTEXT (expr) = stream_read_tree (ib, data_in);
/* TYPE_CANONICAL gets re-computed during type merging. */
TYPE_CANONICAL (expr) = NULL_TREE;
TYPE_STUB_DECL (expr) = stream_read_tree (ib, data_in);
}
示例8: write_ts_type_common_tree_pointers
static void
write_ts_type_common_tree_pointers (struct output_block *ob, tree expr,
bool ref_p)
{
stream_write_tree (ob, TYPE_SIZE (expr), ref_p);
stream_write_tree (ob, TYPE_SIZE_UNIT (expr), ref_p);
stream_write_tree (ob, TYPE_ATTRIBUTES (expr), ref_p);
stream_write_tree (ob, TYPE_NAME (expr), ref_p);
/* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO. They will be
reconstructed during fixup. */
/* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
during fixup. */
stream_write_tree (ob, TYPE_MAIN_VARIANT (expr), ref_p);
stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p);
/* TYPE_CANONICAL is re-computed during type merging, so no need
to stream it here. */
stream_write_tree (ob, TYPE_STUB_DECL (expr), ref_p);
}
示例9: template
/* qualified-id:
nested-name-specifier template(opt) unqualified-id */
static void
pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
{
switch (TREE_CODE (t))
{
case PTRMEM_CST:
pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t));
pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t));
break;
case OVERLOAD:
t = OVL_CURRENT (t);
case FUNCTION_DECL:
if (DECL_FUNCTION_MEMBER_P (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id
(pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
break;
case OFFSET_REF:
case SCOPE_REF:
pp_cxx_nested_name_specifier (pp, TREE_OPERAND (t, 0));
pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 1));
break;
default:
{
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
if (scope != pp->enclosing_scope)
{
pp_cxx_nested_name_specifier (pp, scope);
pp_cxx_template_keyword_if_needed (pp, scope, t);
}
pp_cxx_unqualified_id (pp, t);
}
break;
}
}
示例10: DECLARE_CONTEXT
template <class CompositionT1, class CompositionT2>
class and_expr
: public cond_expr < and_expr<CompositionT1, CompositionT2> >
{
private:
typename CompositionT1::embed_t expr1;
typename CompositionT2::embed_t expr2;
public:
DECLARE_CONTEXT(TYPE_GENERATOR_CONTEXT2(CompositionT1, CompositionT2))
and_expr(cond_expr<CompositionT1> const& e1, cond_expr<CompositionT2> const& e2)
:expr1(e1.derived()), expr2(e2.derived())
{}
template <typename DataT>
bool
evaluate(TYPE_CONTEXT(DataT) & c) const;
};
template <class DerivedT>
inline and_expr<cst_expr, DerivedT>
operator&&(bool value, const cond_expr<DerivedT> & other);
}
#include "impl/and_expr_impl.hpp"
#endif
示例11: browse_tree
//.........这里部分代码省略.........
else
TB_WF;
break;
case TB_ARGUMENTS:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_ARGUMENTS (head));
else
TB_WF;
break;
case TB_ABSTRACT_ORIGIN:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head));
else if (head && TREE_CODE (head) == BLOCK)
TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head));
else
TB_WF;
break;
case TB_ATTRIBUTES:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_ATTRIBUTES (head));
else if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_ATTRIBUTES (head));
else
TB_WF;
break;
case TB_CONTEXT:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_CONTEXT (head));
else if (head && TYPE_P (head)
&& TYPE_CONTEXT (head))
TB_SET_HEAD (TYPE_CONTEXT (head));
else
TB_WF;
break;
case TB_OFFSET:
if (head && TREE_CODE (head) == FIELD_DECL)
TB_SET_HEAD (DECL_FIELD_OFFSET (head));
else
TB_WF;
break;
case TB_BIT_OFFSET:
if (head && TREE_CODE (head) == FIELD_DECL)
TB_SET_HEAD (DECL_FIELD_BIT_OFFSET (head));
else
TB_WF;
break;
case TB_UNIT_SIZE:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_SIZE_UNIT (head));
else if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_SIZE_UNIT (head));
else
TB_WF;
break;
case TB_SIZE:
if (head && DECL_P (head))
TB_SET_HEAD (DECL_SIZE (head));
else if (head && TYPE_P (head))
示例12:
template <typename DataT>
inline condition<DataT>
condition<DataT>::copy() const
{
return condition<DataT>(ptr.get() ? ptr->clone() : 0);
}
template <
typename DerivedT, // derived class
typename EmbedT, // how derived class is embedded
typename DataT
>
template <class>
bool
condition_base<DerivedT,EmbedT,DataT>::evaluate(TYPE_CONTEXT(DataT) & c) const
{
bool r = true;
DerivedT const* derived_this = static_cast<DerivedT const*>(this);
if (condition_base_access::get(*derived_this))
{
r = condition_base_access::get(*derived_this)
->do_evaluate_virtual(c);
}
return r;
}
}
示例13: cp_dump_tree
bool
cp_dump_tree (void* dump_info, tree t)
{
enum tree_code code;
dump_info_p di = (dump_info_p) dump_info;
/* Figure out what kind of node this is. */
code = TREE_CODE (t);
if (DECL_P (t))
{
if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
dump_string (di, language_to_string (DECL_LANGUAGE (t)));
}
switch (code)
{
case IDENTIFIER_NODE:
if (IDENTIFIER_OPNAME_P (t))
{
dump_string (di, "operator");
return true;
}
else if (IDENTIFIER_TYPENAME_P (t))
{
dump_child ("tynm", TREE_TYPE (t));
return true;
}
break;
case OFFSET_TYPE:
dump_string (di, "ptrmem");
dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
return true;
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (t))
{
dump_string (di, "ptrmem");
dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
return true;
}
/* Fall through. */
case UNION_TYPE:
/* Is it a type used as a base? */
if (TYPE_CONTEXT (t) && TREE_CODE (TYPE_CONTEXT (t)) == TREE_CODE (t)
&& CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
{
dump_child ("bfld", TYPE_CONTEXT (t));
return true;
}
if (! IS_AGGR_TYPE (t))
break;
dump_child ("vfld", TYPE_VFIELD (t));
if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
dump_string(di, "spec");
if (!dump_flag (di, TDF_SLIM, t) && TYPE_BINFO (t))
{
int i;
tree binfo;
tree base_binfo;
for (binfo = TYPE_BINFO (t), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
{
dump_child ("base", BINFO_TYPE (base_binfo));
if (BINFO_VIRTUAL_P (base_binfo))
dump_string (di, "virtual");
dump_access (di, base_binfo);
}
}
break;
case FIELD_DECL:
dump_access (di, t);
if (DECL_MUTABLE_P (t))
dump_string(di, "mutable");
break;
case VAR_DECL:
if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE)
dump_access (di, t);
if (TREE_STATIC (t) && !TREE_PUBLIC (t))
dump_string (di, "static");
break;
case FUNCTION_DECL:
if (!DECL_THUNK_P (t))
{
if (DECL_OVERLOADED_OPERATOR_P (t)) {
dump_string (di, "operator");
dump_op (di, t);
}
if (DECL_FUNCTION_MEMBER_P (t))
//.........这里部分代码省略.........
示例14: self_t
template <typename DataT, template <typename,typename> class PolicyT>
inline format<DataT, PolicyT>
format<DataT, PolicyT>::copy() const
{
return self_t(ptr.get() ? ptr->clone() : 0);
}
template <
typename DerivedT, // derived class
typename EmbedT, // how derived class is embedded
typename DataT
>
template <class>
inline void
format_base<DerivedT,EmbedT,DataT>::generate(TYPE_CONTEXT(DataT) & context) const
{
DerivedT const* derived_this = static_cast<DerivedT const*>(this);
if (format_base_access::get(*derived_this))
{
format_base_access::get(*derived_this)
->do_generate_virtual(context);
}
}
template <class BaseT, class DataT>
template <class>
inline void
generate_policy<BaseT,DataT>::generate(TYPE_CONTEXT(DataT) & context) const
{
BaseT::template generate<DataT>(context);
示例15: else_expr
namespace gen {
template <typename DataT>
bool
else_expr::evaluate(TYPE_CONTEXT(DataT) & c) const
{
return declare_context<DataT>::else_condition().evaluate<DataT>(c);
}
inline else_expr
else_g()
{
return else_expr();
}
}