diff mbox

[8/9] gcc: Convert implicit uses of input_location into explicit uses

Message ID 1385091069-23732-9-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Nov. 22, 2013, 3:31 a.m. UTC
gcc/
	* builtins.c (c_strlen): Remove use of EXPR_LOC_OR_HERE macro.
	* gimplify.c (internal_get_tmp_var): Likewise.
	EXPR_LOC_OR_HERE macro.
	(shortcut_cond_expr): Likewise.
	* tree-diagnostic.c (diagnostic_report_current_function): Remove
	use of input_filename macro.
	* tree.c (get_file_function_name): Likewise.
---
 gcc/builtins.c        |  2 +-
 gcc/gimplify.c        | 10 +++++-----
 gcc/tree-diagnostic.c |  3 ++-
 gcc/tree.c            |  4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9074ee7..280387f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -588,7 +588,7 @@  c_strlen (tree src, int only_value)
       && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0))))
     return c_strlen (TREE_OPERAND (src, 1), only_value);
 
-  loc = EXPR_LOC_OR_HERE (src);
+  loc = EXPR_LOC_OR_LOC (src, input_location);
 
   src = string_constant (src, &offset_node);
   if (src == 0)
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2b6de3e..fa09d8c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -515,7 +515,7 @@  internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p,
 
   mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));
 
-  SET_EXPR_LOCATION (mod, EXPR_LOC_OR_HERE (val));
+  SET_EXPR_LOCATION (mod, EXPR_LOC_OR_LOC (val, input_location));
 
   /* gimplify_modify_expr might want to reduce this further.  */
   gimplify_and_add (mod, pre_p);
@@ -2514,7 +2514,7 @@  shortcut_cond_expr (tree expr)
       while (TREE_CODE (pred) == TRUTH_ANDIF_EXPR)
 	{
 	  /* Keep the original source location on the first 'if'.  */
-	  location_t locus = EXPR_LOC_OR_HERE (expr);
+	  location_t locus = EXPR_LOC_OR_LOC (expr, input_location);
 	  TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
 	  /* Set the source location of the && on the second 'if'.  */
 	  if (EXPR_HAS_LOCATION (pred))
@@ -2536,7 +2536,7 @@  shortcut_cond_expr (tree expr)
       while (TREE_CODE (pred) == TRUTH_ORIF_EXPR)
 	{
 	  /* Keep the original source location on the first 'if'.  */
-	  location_t locus = EXPR_LOC_OR_HERE (expr);
+	  location_t locus = EXPR_LOC_OR_LOC (expr, input_location);
 	  TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
 	  /* Set the source location of the || on the second 'if'.  */
 	  if (EXPR_HAS_LOCATION (pred))
@@ -2600,7 +2600,7 @@  shortcut_cond_expr (tree expr)
   /* If there was nothing else in our arms, just forward the label(s).  */
   if (!then_se && !else_se)
     return shortcut_cond_r (pred, true_label_p, false_label_p,
-			    EXPR_LOC_OR_HERE (expr));
+			    EXPR_LOC_OR_LOC (expr, input_location));
 
   /* If our last subexpression already has a terminal label, reuse it.  */
   if (else_se)
@@ -2632,7 +2632,7 @@  shortcut_cond_expr (tree expr)
   jump_over_else = block_may_fallthru (then_);
 
   pred = shortcut_cond_r (pred, true_label_p, false_label_p,
-			  EXPR_LOC_OR_HERE (expr));
+			  EXPR_LOC_OR_LOC (expr, input_location));
 
   expr = NULL;
   append_to_statement_list (pred, &expr);
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 087cf6a..2942365 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -39,7 +39,8 @@  diagnostic_report_current_function (diagnostic_context *context,
 				    diagnostic_info *diagnostic)
 {
   diagnostic_report_current_module (context, diagnostic->location);
-  lang_hooks.print_error_function (context, input_filename, diagnostic);
+  lang_hooks.print_error_function (context, LOCATION_FILE (input_location),
+				   diagnostic);
 }
 
 static void
diff --git a/gcc/tree.c b/gcc/tree.c
index 25aa3e2..153243b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9101,7 +9101,7 @@  get_file_function_name (const char *type)
     {
       const char *file = main_input_filename;
       if (! file)
-	file = input_filename;
+	file = LOCATION_FILE (input_location);
       /* Just use the file's basename, because the full pathname
 	 might be quite long.  */
       p = q = ASTRDUP (lbasename (file));
@@ -9118,7 +9118,7 @@  get_file_function_name (const char *type)
       if (! name)
 	name = "";
       if (! file)
-	file = input_filename;
+	file = LOCATION_FILE (input_location);
 
       len = strlen (file);
       q = (char *) alloca (9 + 17 + len + 1);