[PATCH] Fix JSON compilation database command unescaping.

Tomasz Miąsko tomasz.miasko at gmail.com
Mon Nov 24 08:02:03 PST 2014


Why limit this to double quote only? According to our specification both '"'
and '\' are special characters, thus both of them should have been escaped when
occurring in context where they have special meaning but literal meaning is
intended.

Consider for example ninja build command that executes /bin/echo with single
backslash as an argument:
```
$ cat build.ninja 
rule cc
  command = /bin/echo "\\"
build test: cc test.c
$ ninja -t compdb cc
[
  {
    "directory": "/tmp/",
    "command": "/bin/echo \"\\\\\"",
    "file": "test.c"
  }
]
```

http://reviews.llvm.org/D6376






More information about the cfe-commits mailing list