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.
{
/* 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
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);
};
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);