[cfe-dev] Merging Multiple AST

Gábor Márton via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 20 00:56:35 PDT 2018


> 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?
I think, yes.


On Wed, 18 Jul 2018, 11:00 Ridwan Shariffdeen, <rshariffdeen at gmail.com>
wrote:

> Hi Gabor,
>
> 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?
>
> 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?
>
> Thank you for your help
>
> On Wed, Jul 18, 2018 at 4:41 PM Gábor Márton <martongabesz at gmail.com>
> wrote:
>
>> > Analyzing the database I find multiple compile commands for the same
>> source file with different arguments
>> I don't know the details of your case, but generally there are two
>> major cases for this:
>> 1) build both for shared libs (-fpic) and static libs
>> 2) build for different architectures/platforms
>> In the case of 1), the AST of the translation units will be the same.
>> Also, you could configure your project to build only one variant, e.g.
>> the -fpic version.
>> In the case of 2), the ASTs might be essentially different, so there
>> is no sense to merge them, you have to pick one and work with that.
>>
>> Hope this helps,
>> Gabor
>>
>> On Wed, Jul 18, 2018 at 10:14 AM Ridwan Shariffdeen via cfe-dev
>> <cfe-dev at lists.llvm.org> wrote:
>> >
>> > Hi,
>> >
>> > I am working on generating an AST for a given source code. I am using
>> the tool Bear (https://github.com/rizsotto/Bear) 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.
>> >
>> > 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?
>> >
>> > Any help in this regard is highly appreciated.
>> >
>> > Thanks!
>> > _______________________________________________
>> > 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/20180720/a461a35b/attachment.html>


More information about the cfe-dev mailing list