[llvm] r205839 - YAMLIO: Encode ambiguous hex strings explicitly

Michael Spencer bigcheesegs at gmail.com
Wed Apr 9 07:50:30 PDT 2014


On Wed, Apr 9, 2014 at 8:56 AM, David Majnemer <david.majnemer at gmail.com> wrote:
> Author: majnemer
> Date: Wed Apr  9 02:56:27 2014
> New Revision: 205839
>
> URL: http://llvm.org/viewvc/llvm-project?rev=205839&view=rev
> Log:
> YAMLIO: Encode ambiguous hex strings explicitly
>
> YAMLIO would turn a BinaryRef into the string 0000000004000000.
> However, the leading zero causes parsers to interpret it as being an
> octal number instead of a hexadecimal one.
>
> Instead, escape such strings as needed.
>

This is wrong. In YAML all numbers are treated as decimal. Also this
changes the tag type of the value to !!str.

The correct change is to fix the reader to always do decimal and
handle the 0x and 0o prefixes.

See: http://www.yaml.org/spec/1.2/spec.html#id2805071

- Michael Spencer



More information about the llvm-commits mailing list