nickdiego / compiledb

Tool for generating Clang's JSON Compilation Database files for make-based build systems.
GNU General Public License v3.0
1.38k stars 123 forks source link

Backslashes in include paths not processed properly #120

Open shyun3 opened 3 years ago

shyun3 commented 3 years ago

Hello, I tried using compiledb on Windows and it looks like backslashes in include paths get deleted.

Here's a make output:

make: Entering directory `C:/projects/test/build'
echo 'Building file: ../test.c'
echo 'Invoking: GNU ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -I"C:\projects\test" -o "test.o" "../test.c"
echo 'Finished building: ../test.c'
echo ' '
make: Leaving directory `C:/projects/test/build'

Note that this has been manually sanitized from an original.

Resulting compile_commands.json after running compiledb --parse:

[
 {
  "directory": "C:\\projects\\test\\build",
  "arguments": [
   "arm-none-eabi-gcc",
   "-mcpu=cortex-m33",
   "-mthumb",
   "-IC:projectstest",
   "-o",
   "test.o",
   "../test.c"
  ],
  "file": "../test.c"
 }
]

This output has also been manually sanitized but should get the point across.

Note how the backslashes in the -I parameter are not present. Obviously, the result is not a valid path.