<div dir="ltr"><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">i have a question about compilation <span class="">database</span> (CDB). i wrote tools which generate CDB. it follows the format what is mentioned in the<a href="http://clang.llvm.org/docs/JSONCompilationDatabase.html" target="_blank">documentation</a>. 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 <a href="https://llvm.org/bugs/show_bug.cgi?id=24710" target="_blank">complains</a> about my tool when it generates non absolute paths (in the 'command' field).</blockquote><div><br></div><div>The crash bug is a clang-tidy bug, also reported in PR24834, PR26241. And I'm trying to fix it now, and the patch (<a href="http://reviews.llvm.org/D17335">http://reviews.llvm.org/D17335</a>) is under review. You can find the lit test in the patch.</div><div><br></div><div><div style="font-size:12.8px"><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">The CDB should support:<br>- absolute paths in directory (relative paths there seem to brittle)<br>- relative & absolute paths everywhere else</blockquote></div><span class="im" style="font-size:12.8px"> </span></div>I agree with Manuel. The `directory` in compilation database should be an absolute path. Maybe we need to update the compilation database document.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 7:39 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">On Fri, Feb 19, 2016 at 12:58 AM Laszlo Nagy <<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">hi guys,<div><br></div><div>would like to come back to this topic... the inconsistency between the compilation database [CDB] implementation and the documentation about the file paths.</div><div><br></div><div>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.</div><div><br></div><div>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.)</div></div></blockquote><div><br></div></span><div>The CDB should support:</div><div>- absolute paths in directory (relative paths there seem to brittle)</div><div>- relative & absolute paths everywhere else</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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?)</div></div></blockquote><div><br></div></span><div>For lit you give it a couple of RUN files at the start of the file anyway. In there, you can just strip the comments out to create the actual CDB yourself.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>thanks,</div><div>Laszlo</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 5, 2016 at 11:37 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">+clang-tidy folks, as this seems to be more of an issue with clang-tidy than anything else<br><br><div class="gmail_quote"><div><div><div dir="ltr">On Fri, Feb 5, 2016 at 12:27 PM Laszlo Nagy via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">hi Everyone,<div><br></div><div>i have a question about compilation database (CDB). i wrote tools which generate CDB. it follows the format what is mentioned in the <a href="http://clang.llvm.org/docs/JSONCompilationDatabase.html" target="_blank">documentation</a>. 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 <a href="https://llvm.org/bugs/show_bug.cgi?id=24710" target="_blank">complains</a> about my tool when it generates non absolute paths (in the 'command' field).</div><div><br></div><div>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).</div><div><br></div><div>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?</div><div><br></div><div>thanks,</div><div>Laszlo</div></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>
</blockquote></div><br></div>
</blockquote></span></div></div>
</blockquote></div><br></div>