[cfe-dev] compilation database for tooling

Laszlo Nagy via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 18 15:58:18 PST 2016


hi guys,

would like to come back to this topic... the inconsistency between the
compilation database [CDB] implementation and the documentation about the
file paths.

would like to clarify what is our expectation about CDB file paths. at the
same time would like to pin down these as test cases. and fix the
implementation when test cases are not passing.

so, for the first part: #1 shall CDB portable and allow relative paths? (it
means when i generate a CDB and then i move my sources into another
directory (with the CDB), tools shall be happy and run as before the move.)
#2 shall CDB support mixture of relative paths and absolute paths? (eg.:
the `directory` field in CDB use absolute path, while include paths are
relative in the `command` field.) #3 shall CDB support absolute paths too?
(my guess that's the only supported case at the moment.)

so, for the test cases: i checked the current functional test against CDB.
have not found specific test in the `clang-tools-extra` repo, but find a
few in `clang` source tree. #4 where test cases shall go? my other
questions about `lit`. CDB is a JSON file. using `lit` usually works as
adding comment section. JSON does not support comments. (but have seen
'test/Index/skip-parsed-bodies/compile_commands.json' in clang repo that
using it.) #5 will such file parsed? and when i'm writing test with
absolute paths, i can't wire in the current absolute path into the file.
so, thought to use CMake to substitute those values. #6 but then will `lit`
find the generated test files in the build dir too? (or just scans the
source dir?)

thanks,
Laszlo

On Fri, Feb 5, 2016 at 11:37 PM, Manuel Klimek <klimek at google.com> wrote:

> +clang-tidy folks, as this seems to be more of an issue with clang-tidy
> than anything else
>
> On Fri, Feb 5, 2016 at 12:27 PM Laszlo Nagy via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> hi Everyone,
>>
>> i have a question about compilation database (CDB). i wrote tools which
>> generate CDB. it follows the format what is mentioned in the
>> documentation <http://clang.llvm.org/docs/JSONCompilationDatabase.html>.
>> my question related to the source file. a source file is mentioned two
>> fields for a single entry, the 'file' and the 'command' fields. i remember
>> a discussion earlier to make the source file to be relative to the
>> directory (for portability). but at the same time, i receive complains
>> <https://llvm.org/bugs/show_bug.cgi?id=24710> about my tool when it
>> generates non absolute paths (in the 'command' field).
>>
>> to make it more fun, the 'directory' field could be also relative or
>> absolute (by the documentation). but two years ago, that was the first
>> thing i needed to fix (and always use absolute path).
>>
>> can somebody tell me what is the current status of the file paths in CDB?
>> is there any test suite around the CDB reading in the Clang repo? or shall
>> i just blindly copy the CMake generated CDBs and ignore the documentation?
>>
>> thanks,
>> Laszlo
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160219/92b19c09/attachment.html>


More information about the cfe-dev mailing list