On 11/12/22 16:55, Andrew Pinski via Gcc-patches wrote:
On Sat, Nov 12, 2022 at 3:47 PM Bernhard Reutner-Fischer via
Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
gcc/ChangeLog:
* value-range.cc (get_bound_with_infinite_markers): New static helper.
(irange::as_string): New definition.
* value-range.h: New declaration.
---
Provide means to print a value range to a newly allocated buffer.
The caller is responsible to free() the allocated memory.
Bootstrapped and regtested on x86_86-unknown-linux with no regressions.
Ok for trunk?
Cc: Andrew MacLeod <amacl...@redhat.com>
Cc: Aldy Hernandez <al...@redhat.com>
---
gcc/value-range.cc | 56 ++++++++++++++++++++++++++++++++++++++++++++++
gcc/value-range.h | 3 +++
2 files changed, 59 insertions(+)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index a855aaf626c..51cd9a38d90 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -3099,6 +3099,62 @@ debug (const value_range &vr)
fprintf (stderr, "\n");
}
+/* Helper for irange::as_string(). Print a bound to an allocated buffer. */
+static char *
Can we start using std::string instead of char* here?
If it makes the code easier to read/maintain, sure. std::string isn't
used heavily, but has crept into a few places, mostly in target files.
std::string isn't something we've pushed at all in terms of preferred
practices.
Jeff