#include "c-family/c-objc.h"
#define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',')
+#define pp_separate_with_semicolon(PP) pp_cxx_separate_with (PP, ';')
/* The global buffer where we dump everything. It is there only for
transitional purpose. It is expected, in the near future, to be
static const char *parm_to_string (int);
static const char *type_to_string (tree, int);
+static void dump_alias_template_specialization (tree, int);
static void dump_type (tree, int);
static void dump_typename (tree, int);
static void dump_simple_decl (tree, tree, int);
static void
dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
{
- int need_comma = 0;
+ bool need_semicolon = false;
int i;
tree t;
if (lvl_args && NUM_TMPL_ARGS (lvl_args) > arg_idx)
arg = TREE_VEC_ELT (lvl_args, arg_idx);
- if (need_comma)
- pp_separate_with_comma (cxx_pp);
+ if (need_semicolon)
+ pp_separate_with_semicolon (cxx_pp);
dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER);
pp_cxx_whitespace (cxx_pp);
pp_equal (cxx_pp);
pp_string (cxx_pp, M_("<missing>"));
++arg_idx;
- need_comma = 1;
+ need_semicolon = true;
}
parms = TREE_CHAIN (parms);
FOR_EACH_VEC_ELT (tree, typenames, i, t)
{
- if (need_comma)
- pp_separate_with_comma (cxx_pp);
+ if (need_semicolon)
+ pp_separate_with_semicolon (cxx_pp);
dump_type (t, TFF_PLAIN_IDENTIFIER);
pp_cxx_whitespace (cxx_pp);
pp_equal (cxx_pp);
}
}
+/* Dump a human-readable equivalent of the alias template
+ specialization of T. */
+
+static void
+dump_alias_template_specialization (tree t, int flags)
+{
+ tree name;
+
+ gcc_assert (alias_template_specialization_p (t));
+
+ if (!(flags & TFF_UNQUALIFIED_NAME))
+ dump_scope (CP_DECL_CONTEXT (TYPE_NAME (t)), flags);
+ name = TYPE_IDENTIFIER (t);
+ pp_cxx_tree_identifier (cxx_pp, name);
+ dump_template_parms (TYPE_TEMPLATE_INFO (t),
+ /*primary=*/false,
+ flags & ~TFF_TEMPLATE_HEADER);
+}
+
/* Dump a human-readable equivalent of TYPE. FLAGS controls the
format. */
{
tree decl = TYPE_NAME (t);
if ((flags & TFF_CHASE_TYPEDEF)
- || DECL_SELF_REFERENCE_P (decl)
- || (!flag_pretty_templates
- && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
+ || DECL_SELF_REFERENCE_P (decl)
+ || (!flag_pretty_templates
+ && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
t = strip_typedefs (t);
+ else if (alias_template_specialization_p (t))
+ {
+ dump_alias_template_specialization (t, flags);
+ return;
+ }
else if (same_type_p (t, TREE_TYPE (decl)))
t = decl;
else
if (name)
{
- typdef = !DECL_ARTIFICIAL (name);
+ typdef = (!DECL_ARTIFICIAL (name)
+ /* An alias specialization is not considered to be a
+ typedef. */
+ && !alias_template_specialization_p (t));
if ((typdef
&& ((flags & TFF_CHASE_TYPEDEF)
{
/* Because the template names are mangled, we have to locate
the most general template, and use that name. */
- tree tpl = CLASSTYPE_TI_TEMPLATE (t);
+ tree tpl = TYPE_TI_TEMPLATE (t);
while (DECL_TEMPLATE_INFO (tpl))
tpl = DECL_TI_TEMPLATE (tpl);
dump_type (TREE_TYPE (t), flags);
break;
}
+ if (TYPE_DECL_ALIAS_P (t)
+ && (flags & TFF_DECL_SPECIFIERS
+ || flags & TFF_CLASS_KEY_OR_ENUM))
+ {
+ pp_cxx_ws_string (cxx_pp, "using");
+ dump_decl (DECL_NAME (t), flags);
+ pp_cxx_whitespace (cxx_pp);
+ pp_cxx_ws_string (cxx_pp, "=");
+ pp_cxx_whitespace (cxx_pp);
+ dump_type (DECL_ORIGINAL_TYPE (t), flags);
+ break;
+ }
if ((flags & TFF_DECL_SPECIFIERS)
&& !DECL_SELF_REFERENCE_P (t))
pp_cxx_ws_string (cxx_pp, "typedef");
}
}
- if (DECL_TEMPLATE_RESULT (t)
- && TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
+ if (DECL_CLASS_TEMPLATE_P (t))
dump_type (TREE_TYPE (t),
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
else if (DECL_TEMPLATE_RESULT (t)
- && TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
+ && (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL
+ /* Alias template. */
+ || DECL_TYPE_TEMPLATE_P (t)))
dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
else
{
}
else if (name && IDENTIFIER_OPNAME_P (name))
pp_cxx_tree_identifier (cxx_pp, name);
+ else if (name && UDLIT_OPER_P (name))
+ pp_cxx_tree_identifier (cxx_pp, name);
else
dump_decl (name, flags);
| TFF_NO_FUNCTION_ARGUMENTS));
break;
+ case SSA_NAME:
+ if (!DECL_ARTIFICIAL (SSA_NAME_VAR (t)))
+ dump_expr (SSA_NAME_VAR (t), flags);
+ else
+ pp_cxx_ws_string (cxx_pp, M_("<unknown>"));
+ break;
+
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
pp_constant (cxx_pp, t);
break;
+ case USERDEF_LITERAL:
+ pp_cxx_userdef_literal (cxx_pp, t);
+ break;
+
case THROW_EXPR:
/* While waiting for caret diagnostics, avoid printing
__cxa_allocate_exception, __cxa_throw, and the like. */
break;
CASE_CONVERT:
+ case IMPLICIT_CONV_EXPR:
case VIEW_CONVERT_EXPR:
{
tree op = TREE_OPERAND (t, 0);
break;
case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
dump_type (t, flags);
break;
cp_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- diagnostic_report_current_module (context);
+ diagnostic_report_current_module (context, diagnostic->location);
cp_print_error_function (context, diagnostic);
maybe_print_instantiation_context (context);
maybe_print_constexpr_context (context);
static void
cp_diagnostic_finalizer (diagnostic_context *context,
- diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
+ diagnostic_info *diagnostic)
{
+ virt_loc_aware_diagnostic_finalizer (context, diagnostic);
pp_base_destroy_prefix (context->printer);
}
case CPP0X_INITIALIZER_LISTS:
pedwarn (input_location, 0,
"extended initializer lists "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_EXPLICIT_CONVERSION:
pedwarn (input_location, 0,
"explicit conversion operators "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_VARIADIC_TEMPLATES:
pedwarn (input_location, 0,
"variadic templates "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_LAMBDA_EXPR:
pedwarn (input_location, 0,
"lambda expressions "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_AUTO:
pedwarn (input_location, 0,
- "C++0x auto only available with -std=c++0x or -std=gnu++0x");
+ "C++0x auto only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_SCOPED_ENUMS:
pedwarn (input_location, 0,
- "scoped enums only available with -std=c++0x or -std=gnu++0x");
+ "scoped enums only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_DEFAULTED_DELETED:
pedwarn (input_location, 0,
"defaulted and deleted functions "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
break;
case CPP0X_INLINE_NAMESPACES:
pedwarn (input_location, OPT_pedantic,
"inline namespaces "
- "only available with -std=c++0x or -std=gnu++0x");
- break;
+ "only available with -std=c++11 or -std=gnu++11");
+ break;
case CPP0X_OVERRIDE_CONTROLS:
pedwarn (input_location, 0,
"override controls (override/final) "
- "only available with -std=c++0x or -std=gnu++0x");
+ "only available with -std=c++11 or -std=gnu++11");
+ break;
+ case CPP0X_NSDMI:
+ pedwarn (input_location, 0,
+ "non-static data member initializers "
+ "only available with -std=c++11 or -std=gnu++11");
+ break;
+ case CPP0X_USER_DEFINED_LITERALS:
+ pedwarn (input_location, 0,
+ "user-defined literals "
+ "only available with -std=c++11 or -std=gnu++11");
+ break;
+ case CPP0X_DELEGATING_CTORS:
+ pedwarn (input_location, 0,
+ "delegating constructors "
+ "only available with -std=c++11 or -std=gnu++11");
break;
default:
- gcc_unreachable();
+ gcc_unreachable ();
}
}