[PATCH] D24778: Add `StringRef::consumeInteger`

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 13:13:18 PDT 2016


zturner added a comment.

BTW, I couldn't decide what was better for the return value.

`getAsInteger()` returns `true` for failure and `false` for success, but it is difficult to change this as it the function is in widespread use throughout the codebase.

`consume_front()` and `consume_back()` return `true` for success and `false` for failure, which is much more sensible.

So do we have `consumeInteger()` maintain consistency with `consume_front()` and `consume_back()` or with `getAsInteger()`?  I'm not sure.  I made it consistent with `getAsInteger()`, but if anyone feels it should be changed, let me know.  Ideally we would change `getAsInteger()` to use a more sensible return value.


https://reviews.llvm.org/D24778





More information about the llvm-commits mailing list