<div dir="ltr">I revised the compile commands database. But there is still problem with header files. Their path is relative in yaml file. I will try to change clang-tidy source code in order to fix the problem.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 20, 2018 at 7:59 PM, Ahmad Nouralizadeh <span dir="ltr"><<a href="mailto:ahmadnouralizadeh@gmail.com" target="_blank">ahmadnouralizadeh@gmail.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">Many Thanks! You helped me pinpoint the problem.<div>The problem is with the compile commands database. In fact, clang-tidy expects the database format to be a little bit restricted (which is the real cause of the problem). The input paths to build commands in MPlayer are all relative (determined by the Makefile) as can be seen here:</div><div><div>...</div><div>            "-I/usr/local/lib/clang/3.9.0/<wbr>include/",</div><div>            "-fpie",</div><div>            "-DPIC",</div><div>            "-D_REENTRANT",</div><div>            "-DZLIB_CONST",</div><div>            "-o",</div><div>            "libavformat/cafdec.o",</div><div>            "libavformat/cafdec.c"</div><div>        ],</div><div>        "directory": "/home/ahmad/Programs/MPlayer-<wbr>1.3.0/ffmpeg",</div><div>        "file": "/home/ahmad/Programs/MPlayer-<wbr>1.3.0/ffmpeg/libavformat/<wbr>cafdec.c"</div></div><div>...</div><div>This is part of the commands database generated using Bear with the file entry revised to be absolute (I did that). The problem is still there. Because the last two lines of the compile command arguments are relative paths:</div><div>"libavformat/cafdec.o"</div><div>"libavformat/cafdec.c"</div><div>which should be changed to:</div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">"/home/ahmad/Programs/MPlayer-<wbr>1.3.0/ffmpeg/libavformat/<wbr>cafdec.o"</span><br></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><div style="text-decoration-style:initial;text-decoration-color:initial">"/home/ahmad/Programs/MPlayer-<wbr>1.3.0/ffmpeg/libavformat/<wbr>cafdec.c"</div>It seems that the fastest way to fix the problem is to postprocess the commands database and make all paths absolute.<br class="m_3438796536845859224gmail-Apple-interchange-newline"><br></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 20, 2018 at 11:53 AM, Miklos Vajna <span dir="ltr"><<a href="mailto:vmiklos@vmiklos.hu" target="_blank">vmiklos@vmiklos.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span><br>
On Thu, Jul 19, 2018 at 11:04:21PM +0430, Ahmad Nouralizadeh <<a href="mailto:ahmadnouralizadeh@gmail.com" target="_blank">ahmadnouralizadeh@gmail.com</a>> wrote:<br>
> path is recreated in that case. It can be seen at "clang-extra-tools-source/<br>
> clang-tidy/ClangTidy.cpp:line1<wbr>31" (clang-extra-tools-6.0.0):<br>
> ...<br>
> <br>
> SmallString<128> FixAbsoluteFilePath = Repl.getFilePath();<br>
> <br>
> Files.makeAbsolutePath(FixAbso<wbr>luteFilePath);<br>
> ...<br>
> But the same operation is not performed when the information is exported to<br>
> yaml, which is done when I run "run-clang-tidy" script with "-fix" option.<br>
<br>
</span>Sounds like if you submit a patch to fix this, it would makes sense. (I<br>
haven't tried run-clang-tidy with -fix myself; what I usually do is<br>
invoking clang-tidy directly with -export-fixes=, then<br>
clang-apply-replacements, but in theory this is the same.)<br>
<br>
Perhaps the reason why nobody hit this before is the usage of relative<br>
paths; I think cmake just writes absolute paths in the compile commands<br>
db, so you don't hit the codepath where making the paths absolute<br>
matters.<br>
<br>
Regards,<br>
<br>
Miklos<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>