[llvm-commits] [PATCH] Change SMRange to be half-open (exclusive end)

Jordan Rose jordan_rose at apple.com
Mon Dec 17 17:10:35 PST 2012


Hi, all. When Chris first put in SMRange, he made it a closed range, meaning that [X, X] was a range that includes X rather than an empty range. I'd like to change this to a half-open range for a couple of reasons:

- More consistent with C++ (begin() and end()).
- Empty ranges are useful to represent insertions (for my upcoming revised fixit patch)
- It is unclear what it means if the last character of a range is a multibyte character -- does the pointer refer to the start of the character, or the last byte in the character?
- It looks like some of the AsmParser uses of SMRange were already assuming this.

This patch should handle all of this, but I'm seeing a failure in the X86 disassembly tests. This confuses me because I didn't think the disassembler used SMRange.

> /Volumes/Lore/llvm-public/llvm/test/MC/Disassembler/X86/enhanced.txt:5:10: error: expected string not found in input
> # CHECK: [o:movq][w: ][1-r:%gs=r{{[0-9]+}}][1-p::][1-l:8=8][p:,][w: ][0-r:%rcx=r{{[0-9]+}}] <mov> 0:[RCX/{{[0-9]+}}]=0 1:[GS/{{[0-9]+}}]=8
>          ^
> <stdin>:2:1: note: scanning from here
> [o:movq][w: ][1-r:%gs=r64][1-p::][1-l:8=8][1-p:,][w: ][0-r:%rcx=r109] <mov> 0:[RCX/109]=0 1:[GS/64]=8 
> ^

I'm usually up on the Clang side (all of this is trying to get a new warning into Clang TableGen, with a fixit), so I'm not sure how to debug this one. Does anyone have any ideas why this test would start failing?

This patch is 90% just modifying source info in the various parsers, but I'd appreciate if someone took a look at that as well to make sure I'm doing it sanely.

Comments?
Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121217/493aead5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SMRange.patch
Type: application/octet-stream
Size: 38359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121217/493aead5/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121217/493aead5/attachment-0001.html>


More information about the llvm-commits mailing list