]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
input: rename get_source to get_source_text_between
authorJason Merrill <jason@redhat.com>
Thu, 3 Nov 2022 19:44:25 +0000 (15:44 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 3 Nov 2022 19:44:25 +0000 (15:44 -0400)
Let's use a more informative name.

gcc/ChangeLog:

* input.h:
* input.cc (get_source):
Rename to get_source_text_between.

gcc/cp/ChangeLog:

* contracts.cc (build_comment): Adjust.

gcc/cp/contracts.cc
gcc/input.cc
gcc/input.h

index 38eb4ad9bfe94f58910358901c1bfeaaf2569dff..793743442073089ad4fb07cc61d892c9e75250b4 100644 (file)
@@ -723,7 +723,8 @@ build_comment (cp_expr condition)
 {
   /* Try to get the actual source text for the condition; if that fails pretty
      print the resulting tree.  */
-  char *str = get_source (condition.get_start (), condition.get_finish ());
+  char *str = get_source_text_between (condition.get_start (),
+                                      condition.get_finish ());
   if (!str)
     {
       /* FIXME cases where we end up here
index 7166c8108925e3d31fa1c8536321ec4e1064facb..9b36356338ac9d2a4bfe3d56a3b0c45a940f3584 100644 (file)
@@ -949,10 +949,11 @@ location_get_source_line (const char *file_path, int line)
   return char_span (buffer, len);
 }
 
-/* Return the source text between two locations.  */
+/* Return a copy of the source text between two locations.  The caller is
+   responsible for freeing the return value.  */
 
 char *
-get_source (location_t start, location_t end)
+get_source_text_between (location_t start, location_t end)
 {
   expanded_location expstart =
     expand_location_to_spelling_point (start, LOCATION_ASPECT_START);
index c97768ad2f37110ddfbb2c0aff599f738bb53c7e..f18769950b5a00d67d1b7d6b9cbd4fdad81111c9 100644 (file)
@@ -111,7 +111,7 @@ class char_span
 };
 
 extern char_span location_get_source_line (const char *file_path, int line);
-extern char *get_source (location_t, location_t);
+extern char *get_source_text_between (location_t, location_t);
 
 extern bool location_missing_trailing_newline (const char *file_path);