[BitInt] Expose a _BitInt literal suffix in C++
The C literal suffix for _BitInt is 'wb' or 'WB' (also allows a 'u' modifier for unsigned). We expose _BitInt in C++ as an extension, but do NOT expose the suffix, as it is one that the C++ committee might choose to use something else.
We should NOT do a single underscore, as that is reserved for the user defined literals (https://eel.is/c++draft/usrlit.suffix).
However, that standardeeze allows double-underscores for use by the implementation, so we could implement this with double-underscores without problem!
So allow: 123__WB, etc.
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- In the comments of the issue, request for it to be assigned to you.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Erich Keane (erichkeane)
We should NOT do a single underscore, as that is reserved for the user defined literals (https://eel.is/c++draft/usrlit.suffix).
However, that standardeeze allows double-underscores for use by the implementation, so we could implement this with double-underscores without problem!
@llvm/issue-subscribers-clang-frontend
Author: Erich Keane (erichkeane)
We should NOT do a single underscore, as that is reserved for the user defined literals (https://eel.is/c++draft/usrlit.suffix).
However, that standardeeze allows double-underscores for use by the implementation, so we could implement this with double-underscores without problem!
So allow: 123__WB, etc.
Hi, I'm interested in taking on this issue, could I have it assigned to me?
Hi, I'm interested in taking on this issue, could I have it assigned to me?
Done! Sadly I'm away after today and won't be back until April, so my reviews on whatever you submit are going to be delayed.
However, make sure you include a 'release note' (See ReleaseNotes.rst), an 'extension' warning (we have others, you should be able to search our DiagnosticXKinds.td for "extension", and sufficient testing for this (I'd imagine an AST test and some sort of static-assert based -verify one that makes sure the values are the same/allow large values/etc.
Thanks!
@erichkeane Hi, created a PR for this. I've included the things you've mentioned, but for testing, I ended up mostly using the same existing _BitInt literal cases as I thought they were comprehensive enough already. Also, I'm not sure if my parsing implementation was the best/most optimal way to do this. Please let me know if there's anything to change, thanks!