From 1b451d6f8abdab3ad51ac56a1c624ae7e22854bb Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 3 Nov 2015 12:24:12 -0500
Subject: [PATCH 22/27] FIXME: yet more WIP

---
 gcc/cp/cp-tree.h |  2 ++
 gcc/cp/parser.c  | 46 +++++++++++++++++++++++-----------------------
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 90f6cba..ada0aba 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -76,8 +76,10 @@ public:
     m_value (other.m_value), m_loc (other.m_loc) {}
 
   /* FIXME: should we use ctors, or have explicit conversion? */
+#if 0
   static cp_expr build (tree value, location_t loc) { return cp_expr (value, loc); }
   static cp_expr build (tree value) { return cp_expr (value); }
+#endif
 
   /* Implicit conversions to tree.  */
   operator tree () const { return m_value; }
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ca2b7f0..10ca513 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3678,9 +3678,9 @@ cp_parser_identifier (cp_parser* parser)
   token = cp_parser_require (parser, CPP_NAME, RT_NAME);
   /* Return the value.  */
   if (token)
-    return cp_expr::build (token->u.value, token->location);
+    return cp_expr (token->u.value, token->location);
   else
-    return cp_expr::build (error_mark_node);
+    return error_mark_node;
 }
 
 /* Parse a sequence of adjacent string constants.  Returns a
@@ -3716,7 +3716,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok,
   if (!cp_parser_is_string_literal (tok))
     {
       cp_parser_error (parser, "expected string-literal");
-      return cp_expr::build (error_mark_node);
+      return error_mark_node;
     }
 
   if (cpp_userdef_string_p (tok->type))
@@ -3867,7 +3867,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok,
   if (count > 1)
     obstack_free (&str_ob, 0);
 
-  return cp_expr::build (value);
+  return value;
 }
 
 /* Look up a literal operator with the name and the exact arguments.  */
@@ -3938,11 +3938,11 @@ cp_parser_userdef_char_literal (cp_parser *parser)
       error ("unable to find character literal operator %qD with %qT argument",
 	     name, TREE_TYPE (value));
       release_tree_vector (args);
-      return cp_expr::build (error_mark_node);
+      return error_mark_node;
     }
   result = finish_call_expr (decl, &args, false, true, tf_warning_or_error);
   release_tree_vector (args);
-  return cp_expr::build (result);
+  return result;
 }
 
 /* A subroutine of cp_parser_userdef_numeric_literal to
@@ -4051,7 +4051,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
 	}
 
       release_tree_vector (args);
-      return cp_expr::build (result);
+      return result;
     }
   release_tree_vector (args);
 
@@ -4066,7 +4066,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
       result = finish_call_expr (decl, &args, false, true,
 				 tf_warning_or_error);
       release_tree_vector (args);
-      return cp_expr::build (result);
+      return result;
     }
   release_tree_vector (args);
 
@@ -4082,7 +4082,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
       result = finish_call_expr (decl, &args, false, true,
 				 tf_warning_or_error);
       release_tree_vector (args);
-      return cp_expr::build (result);
+      return result;
     }
 
   release_tree_vector (args);
@@ -4091,7 +4091,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
   if (!cpp_get_options (parse_in)->ext_numeric_literals)
     inform (token->location, "use -std=gnu++11 or -fext-numeric-literals "
 	    "to enable more built-in suffixes");
-  return cp_expr::build (error_mark_node);
+  return error_mark_node;
 }
 
 /* Parse a user-defined string constant.  Returns a call to a user-defined
@@ -4424,7 +4424,7 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1)
       if (op == ERROR_MARK)
         {
           cp_parser_error (parser, "expected binary operator");
-          return cp_expr::build (error_mark_node);
+          return error_mark_node;
         }
 
       tree expr = cp_parser_cast_expression (parser, false, false,
@@ -4445,7 +4445,7 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1)
   if (cp_lexer_next_token_is_not (parser->lexer, CPP_ELLIPSIS))
     {
       cp_parser_error (parser, "expected ...");
-      return cp_expr::build (error_mark_node);
+      return error_mark_node;
     }
   cp_lexer_consume_token (parser->lexer);
 
@@ -4461,12 +4461,12 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1)
 
   // Right fold.
   if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
-    return cp_expr::build (finish_right_unary_fold_expr (expr1, op));
+    return finish_right_unary_fold_expr (expr1, op);
 
   if (cp_lexer_next_token_is_not (parser->lexer, token->type))
     {
       cp_parser_error (parser, "mismatched operator in fold-expression");
-      return cp_expr::build (error_mark_node);
+      return error_mark_node;
     }
   cp_lexer_consume_token (parser->lexer);
 
@@ -4571,7 +4571,7 @@ cp_parser_primary_expression (cp_parser *parser,
 	{
 	  error_at (token->location,
 		    "fixed-point types not supported in C++");
-	  return cp_expr::build (error_mark_node);
+	  return error_mark_node;
 	}
       /* Floating-point literals are only allowed in an integral
 	 constant expression if they are cast to an integral or
@@ -4617,7 +4617,7 @@ cp_parser_primary_expression (cp_parser *parser,
 	  if (!cast_p)
 	    cp_parser_non_integral_constant_expression (parser, NIC_FLOAT);
 	}
-      return cp_expr::build (token->u.value, token->location);
+      return cp_expr (token->u.value, token->location);
 
     case CPP_CHAR_USERDEF:
     case CPP_CHAR16_USERDEF:
@@ -4668,10 +4668,10 @@ cp_parser_primary_expression (cp_parser *parser,
 	      cp_parser_skip_to_end_of_block_or_statement (parser);
 	      if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
 		cp_lexer_consume_token (parser->lexer);
-	      return cp_expr::build (error_mark_node);
+	      return error_mark_node;
 	    }
 	  else
-	    return cp_expr::build (cp_parser_statement_expr (parser));
+	    return cp_parser_statement_expr (parser);
 	}
       /* Otherwise it's a normal parenthesized expression.  */
       {
@@ -4688,7 +4688,7 @@ cp_parser_primary_expression (cp_parser *parser,
 
 	if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
 	  /* Left fold expression. */
-	  expr = cp_expr::build (NULL_TREE);
+	  expr = NULL_TREE;
 	else
 	  /* Parse the parenthesized expression.  */
 	  expr = cp_parser_expression (parser, idk, cast_p, decltype_p);
@@ -4745,7 +4745,7 @@ cp_parser_primary_expression (cp_parser *parser,
 	cp_expr lam = cp_parser_lambda_expression (parser);
 	/* Don't warn about a failed tentative parse.  */
 	if (cp_parser_error_occurred (parser))
-	  return cp_expr::build (error_mark_node);
+	  return error_mark_node;
 	maybe_warn_cpp0x (CPP0X_LAMBDA_EXPR);
 	return lam;
       }
@@ -4755,7 +4755,7 @@ cp_parser_primary_expression (cp_parser *parser,
 	/* We have an Objective-C++ string literal. */
         return cp_parser_objc_expression (parser);
       cp_parser_error (parser, "expected primary-expression");
-      return cp_expr::build (error_mark_node);
+      return error_mark_node;
 
     case CPP_KEYWORD:
       switch (token->keyword)
@@ -4909,11 +4909,11 @@ cp_parser_primary_expression (cp_parser *parser,
 	      error_at (token->location,
 			"a template declaration cannot appear at block scope");
 	      cp_parser_skip_to_end_of_block_or_statement (parser);
-	      return cp_expr::build (error_mark_node);
+	      return error_mark_node;
 	    }
 	default:
 	  cp_parser_error (parser, "expected primary-expression");
-	  return cp_expr::build (error_mark_node);
+	  return error_mark_node;
 	}
 
       /* An id-expression can start with either an identifier, a
-- 
1.8.5.3

