<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;">Hi all,</span></p>
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;">I have read the project documentation about the compilation databases and this is my exact case:</span></p>
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;"><br>
</span></p>
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;">There can be multiple command objects for the same file, for example if the same source file is compiled with different
 configurations.</span><br>
</p>
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;"><br>
</span></p>
<p><span style="color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.4px; line-height: 18.72px;">Except from deleting one entry out of the two since I just want semantic analysis of the source file and I dont really
 care about the way it will be compiled is there something else?</span></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Georgiou, Andreas<br>
<b>Sent:</b> 14 July 2016 00:03:20<br>
<b>To:</b> Laszlo Nagy<br>
<b>Cc:</b> Miklos Vajna; David Blaikie; cfe-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [cfe-dev] How to execute clang front-end AST visitor to exract some information from source code without compiling the source code first</font>
<div> </div>
</div>
<div><style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear Laszlo,</p>
<p><br>
</p>
<p>Thank you for the provided information. I will try it and I will report back to you all and also Bear issue tracker.</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Laszlo Nagy <rizsotto.mailinglist@gmail.com><br>
<b>Sent:</b> 13 July 2016 23:50:15<br>
<b>To:</b> Georgiou, Andreas<br>
<b>Cc:</b> Miklos Vajna; David Blaikie; cfe-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [cfe-dev] How to execute clang front-end AST visitor to exract some information from source code without compiling the source code first</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>hi Andreas,<br>
<br>
</div>
can you try to create (or modify the existing) compilation database which makes the tools happy? (both clang-check and your tool too.) the project documentation has a
<a href="http://clang.llvm.org/docs/JSONCompilationDatabase.html">chapter</a> to explain how that file should look like.<br>
<br>
</div>
and if there any difference between the generated one and your hand written one, please post your findings to
<a href="https://github.com/rizsotto/Bear/">Bear</a> issue tracker.<br>
<br>
</div>
double AST visit can be caused by double entries in the compilation database. (you can check the file if that was the case or not.) it's a bug in Bear if there are duplicated entries in your compilation database.<br>
<br>
</div>
regards,<br>
</div>
Laszlo<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jul 14, 2016 at 4:45 AM, Georgiou, Andreas <span dir="ltr">
<<a href="mailto:andreas.georgiou15@imperial.ac.uk" target="_blank">andreas.georgiou15@imperial.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span class="">
<p></p>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Hi all,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
I did what you said and using the same compilation database I run clang-check and the tool gave me the same error.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Does it just trying to say that there is no "rule" for the specific file in the compilation database? </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
<br>
</div>
</span>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Furthermore something that I noticed is that some of my files are being analysed 2 times from my AST visitor and this is because of the compilation database. Is something I can do about it?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Something for example to avoid parsing 2 times the same file?</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><span class=""><b>From:</b> Laszlo Nagy <<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@gmail.com</a>><br>
<b>Sent:</b> 13 July 2016 13:45:40<br>
<b>To:</b> Georgiou, Andreas<br>
</span><b>Cc:</b> Miklos Vajna; David Blaikie; <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">
cfe-dev@lists.llvm.org</a>
<div>
<div class="h5"><br>
<b>Subject:</b> Re: [cfe-dev] How to execute clang front-end AST visitor to exract some information from source code without compiling the source code first</div>
</div>
</font>
<div> </div>
</div>
<div>
<div class="h5">
<div>
<div dir="ltr">
<div>
<div>@<span><span>Georgiou, when you generate a compilation database, it's better to validate it with other tools. you can run `clang-check`, `clang-format` just to see it's valid. if it is and your tool still fails with include problems, it might be the
<a href="http://clang.llvm.org/docs/LibTooling.html#builtin-includes" target="_blank">
reason</a> mentioned in the tooling doc. the other thing i noticed, that you use relative path to the module. (instead of `</span></span><br>
../ffmpeg-0.6/libavcodec/libxvid_rc.c` try `/home/andreas/Desktop/ffmpeg-0.6/libavcodec/libxvid_rc.c`)<br>
<br>
@<span><span>David, the `</span></span>build-interposition` command is already in the Clang source repo. it's in `tools/scan-build-py/bin` called `intercept-build`.<br>
<br>
<br>
</div>
regards,<br>
</div>
Laszlo<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 13, 2016 at 9:10 PM, Georgiou, Andreas via cfe-dev
<span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all, </p>
<p><br>
</p>
<p>As Miklos pointed out I am using Bear to create a compilation database to analyze my source code. This lead to much better results. </p>
<p>Although I still have some problems. Does anyone knows why this happens? </p>
<p><br>
</p>
<p>When I am executing using the compilation database I get this error on certain files:</p>
<p></p>
<div>Executing ASTvisitor ../ffmpeg-0.6/libavcodec/libxvid_rc.c</div>
<div>Skipping /home/andreas/Desktop/test_analysis/../ffmpeg-0.6/libavcodec/libxvid_rc.c. Command line not found.</div>
<div><br>
</div>
<div>And does  not extract anything from the file. </div>
<div><br>
</div>
<div>When am executing myAST visitor with the exact same file but without the compilation database it gives me the error:</div>
<div>
<div> 'xvid.h' file not found</div>
<div><br>
</div>
</div>
<div>but it analyses the file and the results are mostly correct. The visitor skips enything which has to do with variable declarations of the xvid.h header. </div>
<div>"How can the command line not found" error can be fixed?</div>
<div><br>
</div>
<div>Thank you all.</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Miklos Vajna <<a href="mailto:vmiklos@vmiklos.hu" target="_blank">vmiklos@vmiklos.hu</a>><br>
<b>Sent:</b> 12 July 2016 20:06:46<br>
<b>To:</b> David Blaikie<br>
<b>Cc:</b> Georgiou, Andreas; <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">
cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [cfe-dev] How to execute clang front-end AST visitor to exract some information from source code without compiling the source code first</font>
<div> </div>
</div>
</div>
<div>
<div><font size="2"><span style="font-size:10pt">
<div>Hi,<br>
<br>
On Tue, Jul 12, 2016 at 08:34:54AM -0700, David Blaikie via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> (probably the most generic thing someone could build to help here would be<br>
> a scan-build like build-interposition tool to make a compilation database<br>
> from any project/build system. Not the most efficient, but would be handy<br>
> as a fallback)<br>
<br>
This is exactly what <<a href="https://github.com/rizsotto/Bear" target="_blank">https://github.com/rizsotto/Bear</a>> implements.<br>
<br>
Regards,<br>
<br>
Miklos<br>
</div>
</span></font></div>
</div>
</div>
<br>
_______________________________________________<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>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>