[PATCH] Fix JSON compilation database command unescaping.

Daniel Cheng dcheng at google.com
Mon Nov 24 10:22:41 PST 2014


That's an interesting discovery about ninja. On Windows:

D:\>more build.ninja
rule cc
  command = /bin/echo "\\" $in
build test: cc dir\test.c

D:\>ninja -t compdb cc
[
  {
    "directory": "D:\\",
    "command": "/bin/echo \"\\\\\" dir\\test.c",
    "file": "dir\\test.c"
  }
]

So ninja isn't even internally consistent! I'll file a bug against ninja.
That being said, I'm not convinced that it makes sense to handle anything
other than the literal \" specially--we still need to skip processing every
other 'normal' escape sequence, so we may as well limit this special
behavior to the combination of the two.

On Mon Nov 24 2014 at 9:51:16 AM Tomasz Miąsko <tomasz.miasko at gmail.com>
wrote:

> And then quotes, backslash and space character all have special meaning
> outside
> quotes. So probably there should be separate implementation of skipEscape
> for
> unquoted string. Sorry for the noise.
>
> http://reviews.llvm.org/D6376
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141124/d0701e57/attachment.html>


More information about the cfe-commits mailing list