/* Implementation of subroutines for the GNU C++ pretty-printer.
Copyright (C) 2003, 2004, 2005, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "real.h"
#include "intl.h"
-#include "cxx-pretty-print.h"
#include "cp-tree.h"
-#include "toplev.h"
+#include "cxx-pretty-print.h"
+#include "tree-pretty-print.h"
/* Translate if being used for diagnostics, but not for dump files or
__PRETTY_FUNCTION. */
static void
pp_cxx_nested_name_specifier (cxx_pretty_printer *pp, tree t)
{
- if (t != NULL && t != pp->enclosing_scope)
+ if (!SCOPE_FILE_SCOPE_P (t) && t != pp->enclosing_scope)
{
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
pp_cxx_nested_name_specifier (pp, scope);
}
break;
+ case INTEGER_CST:
+ if (NULLPTR_TYPE_P (TREE_TYPE (t)))
+ {
+ pp_string (pp, "nullptr");
+ break;
+ }
+ /* else fall through. */
+
default:
pp_c_constant (pp_c_base (pp), t);
break;
__is_convertible_to ( type-id , type-id )
__is_empty ( type-id )
__is_enum ( type-id )
+ __is_literal_type ( type-id )
__is_pod ( type-id )
__is_polymorphic ( type-id )
+ __is_std_layout ( type-id )
+ __is_trivial ( type-id )
__is_union ( type-id ) */
static void
pp_unary_expression (pp, TREE_OPERAND (t, 0));
break;
+ case AT_ENCODE_EXPR:
+ pp_cxx_ws_string (pp, "@encode");
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_type_id (pp, TREE_OPERAND (t, 0));
+ pp_cxx_right_paren (pp);
+ break;
+
+ case NOEXCEPT_EXPR:
+ pp_cxx_ws_string (pp, "noexcept");
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_expression (pp, TREE_OPERAND (t, 0));
+ pp_cxx_right_paren (pp);
+ break;
+
case UNARY_PLUS_EXPR:
pp_plus (pp);
pp_cxx_cast_expression (pp, TREE_OPERAND (t, 0));
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
+ case NOEXCEPT_EXPR:
pp_cxx_unary_expression (pp, t);
break;
if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
|| TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
pp_cxx_ptr_operator (pp, TREE_TYPE (t));
+ pp_c_attributes_display (pp_c_base (pp),
+ TYPE_ATTRIBUTES (TREE_TYPE (t)));
if (TREE_CODE (t) == POINTER_TYPE)
{
pp_star (pp);
static inline tree
pp_cxx_implicit_parameter_type (tree mf)
{
- return TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (mf))));
+ return class_of_this_parm (TREE_TYPE (mf));
}
/*
tree ex_spec = TYPE_RAISES_EXCEPTIONS (t);
bool need_comma = false;
- if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
+ if (ex_spec == NULL)
return;
+ if (TREE_PURPOSE (ex_spec))
+ {
+ pp_cxx_ws_string (pp, "noexcept");
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ if (DEFERRED_NOEXCEPT_SPEC_P (ex_spec))
+ pp_cxx_ws_string (pp, "<uninstantiated>");
+ else
+ pp_cxx_expression (pp, TREE_PURPOSE (ex_spec));
+ pp_cxx_right_paren (pp);
+ return;
+ }
pp_cxx_ws_string (pp, "throw");
pp_cxx_left_paren (pp);
for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
if (TREE_CODE (t) == METHOD_TYPE)
{
pp_base (pp)->padding = pp_before;
- pp_cxx_cv_qualifier_seq
- (pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
+ pp_cxx_cv_qualifier_seq (pp, class_of_this_parm (t));
}
pp_cxx_exception_specification (pp, t);
break;
case TEMPLATE_PARM_INDEX:
case TEMPLATE_DECL:
case TYPEOF_TYPE:
+ case UNDERLYING_TYPE:
case DECLTYPE_TYPE:
case TEMPLATE_ID_EXPR:
pp_cxx_type_specifier_seq (pp, t);
pp_needs_newline (pp) = true;
break;
+ case RANGE_FOR_STMT:
+ pp_cxx_ws_string (pp, "for");
+ pp_space (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_statement (pp, RANGE_FOR_DECL (t));
+ pp_space (pp);
+ pp_needs_newline (pp) = false;
+ pp_colon (pp);
+ pp_space (pp);
+ pp_cxx_statement (pp, RANGE_FOR_EXPR (t));
+ pp_cxx_right_paren (pp);
+ pp_newline_and_indent (pp, 3);
+ pp_cxx_statement (pp, FOR_BODY (t));
+ pp_indentation (pp) -= 3;
+ pp_needs_newline (pp) = true;
+ break;
+
/* jump-statement:
goto identifier;
continue ;
{
tree tmpl = most_general_template (t);
tree level;
- int i = 0;
pp_maybe_newline_and_indent (pp, 0);
for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level))
pp_cxx_template_parameter_list (pp, TREE_VALUE (level));
pp_cxx_end_template_argument_list (pp);
pp_newline_and_indent (pp, 3);
- i += 3;
}
if (TREE_CODE (t) == FUNCTION_DECL && DECL_SAVED_TREE (t))
pp_cxx_function_definition (pp, t);
case CPTK_IS_UNION:
pp_cxx_ws_string (pp, "__is_union");
break;
+ case CPTK_IS_LITERAL_TYPE:
+ pp_cxx_ws_string (pp, "__is_literal_type");
+ break;
default:
gcc_unreachable ();