[PATCH] Fix JSON compilation database command unescaping.

Daniel Cheng dcheng at google.com
Mon Nov 24 10:22:48 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.

http://reviews.llvm.org/D6376






More information about the cfe-commits mailing list