<div dir="ltr">> <span style="font-family:garamond,serif">For example, if I need to update a function but I'm not sure in which AST it would appear, I need to create all and check?</span><br>I think, yes.</div><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 18 Jul 2018, 11:00 Ridwan Shariffdeen, <<a href="mailto:rshariffdeen@gmail.com" target="_blank">rshariffdeen@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"><div class="gmail_default" style="font-family:garamond,serif;font-size:small">Hi Gabor,</div><div class="gmail_default" style="font-family:garamond,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:garamond,serif;font-size:small">Thank you for the explanation, so if I need to modify a function for a particular AST I need to build all possible AST's and check one-by-one? no other possibility? </div><div class="gmail_default" style="font-family:garamond,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:garamond,serif;font-size:small">For example, if I need to update a function but I'm not sure in which AST it would appear, I need to create all and check?</div><div class="gmail_default" style="font-family:garamond,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:garamond,serif;font-size:small">Thank you for your help</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 4:41 PM Gábor Márton <<a href="mailto:martongabesz@gmail.com" rel="noreferrer" target="_blank">martongabesz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> Analyzing the database I find multiple compile commands for the same source file with different arguments<br>
I don't know the details of your case, but generally there are two<br>
major cases for this:<br>
1) build both for shared libs (-fpic) and static libs<br>
2) build for different architectures/platforms<br>
In the case of 1), the AST of the translation units will be the same.<br>
Also, you could configure your project to build only one variant, e.g.<br>
the -fpic version.<br>
In the case of 2), the ASTs might be essentially different, so there<br>
is no sense to merge them, you have to pick one and work with that.<br>
<br>
Hope this helps,<br>
Gabor<br>
<br>
On Wed, Jul 18, 2018 at 10:14 AM Ridwan Shariffdeen via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I am working on generating an AST for a given source code. I am using the tool Bear (<a href="https://github.com/rizsotto/Bear" rel="noreferrer noreferrer" target="_blank">https://github.com/rizsotto/Bear</a>) to capture the make commands in order to generate the compilation database. Analyzing the database I find multiple compile commands for the same source file with different arguments. Reviewing further it uses different command arguments to compile the source file. Hence for each compile command, I get different AST. I am using ClangTool::buildASTs() method to generate the ASTs.<br>
><br>
> How can I merge these multiple ASTs generated from the same code? Is it possible to just create all the AST's and create the final AST? or any other method to aggregate?<br>
><br>
> Any help in this regard is highly appreciated.<br>
><br>
> Thanks!<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div></div></div>