diff --git a/gcc/tree.h b/gcc/tree.h
index 9af971cf401..a50f7b2be9d 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1135,7 +1135,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
 
 /* Define fields and accessors for some special-purpose tree nodes.  */
 
-/* As with STRING_CST, in C terms this is sizeof, not strlen.  */
+/* Unlike STRING_CST, in C terms this is strlen, not sizeof.  */
 #define IDENTIFIER_LENGTH(NODE) \
   (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
 #define IDENTIFIER_POINTER(NODE) \
@@ -4706,6 +4706,13 @@ extern tree build_alloca_call_expr (tree, unsigned int, HOST_WIDE_INT);
 extern tree build_string_literal (unsigned, const char * = NULL,
 				  tree = char_type_node,
 				  unsigned HOST_WIDE_INT = HOST_WIDE_INT_M1U);
+inline tree build_string_literal (const char *p)
+{ return build_string_literal (strlen (p) + 1, p); }
+inline tree build_string_literal (tree t)
+{
+  return build_string_literal (IDENTIFIER_LENGTH (t) + 1,
+			       IDENTIFIER_POINTER (t));
+}
 
 /* Construct various nodes representing data types.  */
 
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 5f319b28030..26898d7e27e 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -9521,10 +9521,10 @@ fold_builtin_FILE (location_t loc)
 	 __FILE__ macro so it appears appropriate to use the same file prefix
 	 mappings.  */
       fname = remap_macro_filename (fname);
-    return build_string_literal (strlen (fname) + 1, fname);
+      return build_string_literal (fname);
     }
 
-  return build_string_literal (1, "");
+  return build_string_literal ("");
 }
 
 /* Fold a call to __builtin_FUNCTION to a constant string.  */
@@ -9537,7 +9537,7 @@ fold_builtin_FUNCTION ()
   if (current_function_decl)
     name = lang_hooks.decl_printable_name (current_function_decl, 0);
 
-  return build_string_literal (strlen (name) + 1, name);
+  return build_string_literal (name);
 }
 
 /* Fold a call to __builtin_LINE to an integer constant.  */
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 28c339869b8..cc8bfada5af 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -3378,10 +3378,10 @@ fold_builtin_source_location (location_t loc)
 	      if (const char *fname = LOCATION_FILE (loc))
 		{
 		  fname = remap_macro_filename (fname);
-		  val = build_string_literal (strlen (fname) + 1, fname);
+		  val = build_string_literal (fname);
 		}
 	      else
-		val = build_string_literal (1, "");
+		val = build_string_literal ("");
 	    }
 	  else if (strcmp (n, "_M_function_name") == 0)
 	    {
@@ -3390,7 +3390,7 @@ fold_builtin_source_location (location_t loc)
 	      if (current_function_decl)
 		name = cxx_printable_name (current_function_decl, 2);
 
-	      val = build_string_literal (strlen (name) + 1, name);
+	      val = build_string_literal (name);
 	    }
 	  else if (strcmp (n, "_M_line") == 0)
 	    val = build_int_cst (TREE_TYPE (field), LOCATION_LINE (loc));
diff --git a/gcc/cp/vtable-class-hierarchy.cc b/gcc/cp/vtable-class-hierarchy.cc
index cc1df1ebdb2..1e180ea61dc 100644
--- a/gcc/cp/vtable-class-hierarchy.cc
+++ b/gcc/cp/vtable-class-hierarchy.cc
@@ -467,19 +467,6 @@ check_and_record_registered_pairs (tree vtable_decl, tree vptr_address,
   return !inserted_something;
 }
 
-/* Given an IDENTIFIER_NODE, build and return a string literal based on it.  */
-
-static tree
-build_string_from_id (tree identifier)
-{
-  int len;
-
-  gcc_assert (TREE_CODE (identifier) == IDENTIFIER_NODE);
-
-  len = IDENTIFIER_LENGTH (identifier);
-  return build_string_literal (len + 1, IDENTIFIER_POINTER (identifier));
-}
-
 /* A class may contain secondary vtables in it, for various reasons.
    This function goes through the decl chain of a class record looking
    for any fields that point to secondary vtables, and adding calls to
@@ -920,7 +907,7 @@ register_all_pairs (tree body)
 
 
       if (flag_vtv_debug)
-        str1 = build_string_from_id (DECL_NAME (base_ptr_var_decl));
+	str1 = build_string_literal (DECL_NAME (base_ptr_var_decl));
 
       new_type = build_pointer_type (TREE_TYPE (base_ptr_var_decl));
       arg1 = build1 (ADDR_EXPR, new_type, base_ptr_var_decl);
@@ -953,7 +940,7 @@ register_all_pairs (tree body)
                 if (vtable_decl)
                   {
                     vtable_should_be_output = TREE_ASM_WRITTEN (vtable_decl);
-                    str2 = build_string_from_id (DECL_NAME (vtable_decl));
+		    str2 = build_string_literal (DECL_NAME (vtable_decl));
                   }
 
                 if (vtable_decl && vtable_should_be_output)
@@ -1009,8 +996,7 @@ register_all_pairs (tree body)
       arg2 = build_key_buffer_arg (base_ptr_var_decl);
 
       if (str2 == NULL_TREE)
-        str2 = build_string_literal (strlen ("unknown") + 1,
-                                     "unknown");
+	str2 = build_string_literal ("unknown");
 
       if (flag_vtv_debug)
         output_set_info (current->class_info->class_type,
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 42a996dfeb9..69bad340d2e 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -1771,14 +1771,12 @@ gimple_add_init_for_auto_var (tree decl,
   tree decl_name = NULL_TREE;
   if (DECL_NAME (decl))
 
-    decl_name = build_string_literal (IDENTIFIER_LENGTH (DECL_NAME (decl)) + 1,
-				      IDENTIFIER_POINTER (DECL_NAME (decl)));
+    decl_name = build_string_literal (DECL_NAME (decl));
 
   else
     {
       char *decl_name_anonymous = xasprintf ("D.%u", DECL_UID (decl));
-      decl_name = build_string_literal (strlen (decl_name_anonymous) + 1,
-					decl_name_anonymous);
+      decl_name = build_string_literal (decl_name_anonymous);
       free (decl_name_anonymous);
     }
 
diff --git a/gcc/vtable-verify.cc b/gcc/vtable-verify.cc
index 24894e7f108..f01058e5412 100644
--- a/gcc/vtable-verify.cc
+++ b/gcc/vtable-verify.cc
@@ -725,10 +725,6 @@ verify_bb_vtables (basic_block bb)
                      trace information to debug problems.  */
                   if (flag_vtv_debug)
                     {
-                      int len1 = IDENTIFIER_LENGTH
-                                                 (DECL_NAME (vtbl_var_decl));
-                      int len2 = strlen (vtable_name);
-
                       call_stmt = gimple_build_call
                                      (verify_vtbl_ptr_fndecl, 4,
                                       build1 (ADDR_EXPR,
@@ -737,12 +733,8 @@ verify_bb_vtables (basic_block bb)
                                               vtbl_var_decl),
                                       lhs,
                                       build_string_literal
-                                                  (len1 + 1,
-                                                   IDENTIFIER_POINTER
-                                                       (DECL_NAME
-                                                            (vtbl_var_decl))),
-                                      build_string_literal (len2 + 1,
-                                                            vtable_name));
+						  (DECL_NAME (vtbl_var_decl)),
+				      build_string_literal (vtable_name));
                     }
                   else
                     call_stmt = gimple_build_call
