[libclang] Get the absolute path of argument in the compile database


In compile database, the include path in the arguments is relative path, e.g., “-I./src/include” shown in the below example:

        "arguments": [
        "directory": "/home/musl/musl-1.2.2",
        "file": "src/select/select.c"

When I use clang_parseTranslationUnit() by passing that arguments, it will report error, is there any method that I can let libclang get the absolute path of such arguments?


It should be relative to the “directory” entry. So I think the idea is that you should set the cwd to that and then execute the command. Otherwise you can smash those two together I guess!