[PATCH] D102220: [NFC, CFI] Use unsigned type for CFI register values in parser/streamer code

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 20:04:33 PDT 2021


MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

In D102220#2755883 <https://reviews.llvm.org/D102220#2755883>, @RamNalamothu wrote:

> In D102220#2755545 <https://reviews.llvm.org/D102220#2755545>, @MaskRay wrote:
>
>>> the interfacing code in parsers and streamers are using both signed and unsigned type in different parts.
>>
>> Where is uint64_t used? Most places use int64_t.
>
> For instance in `AsmParser::parseRegisterOrRegisterNumber()` and type cast in `MCStreamer::emitCFIDefCfaRegister()`.
>
> Anyway, I have changed the summary as the above scenarios are minor in the entire changes.

Both `AsmParser::parseRegisterOrRegisterNumber()` and `MCStreamer::emitCFIDefCfaRegister()` uses int64_t.

OK, I am not convinced that most places use int64_t.
Using unsigned type to represent "negative values aren't allowed" is not a good idea.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es106-dont-try-to-avoid-negative-values-by-using-unsigned


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102220/new/

https://reviews.llvm.org/D102220



More information about the llvm-commits mailing list