[llvm] [Support] Recognise the '+' char for positive integers (PR #135856)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 16:03:47 PDT 2025
dwblaikie wrote:
> It will only be more permissive if the `+` at the start of a stringRef signifies something else.
Even if it doesn't mean anything else - if the consumer isn't intending to accept leading `+` and this change causes it to accept leading `+` that might be a problem (tangential story: Recently clang accidentally started accepting trailing `,` in function calls (eg: `f(a, b,)`) - google's internal codebase rapidly grew uses of this now allowed syntax (doubt anyone did it especially intentionally - but enough programmers making enough mistakes without a compiler telling them not to, some will sneak in) that had to be cleaned up so the codebase could compile once the bug was fixed)
> I did check the callers of the `StringRef::getAsInteger` function, this is not the case.
>
> The only new change was in the `llvm-symbolizer` to handle when the address starts with a `+` to match `addr2line`
That change seems fine - but yeah, still unsure about making everyone else accept leading `+` when they might not intend to.
Wouldn't mind a second or third opinion.
https://github.com/llvm/llvm-project/pull/135856
More information about the llvm-commits
mailing list