[cfe-dev] Merging Multiple AST

Gábor Márton via cfe-dev cfe-dev at lists.llvm.org
Wed Jul 18 01:41:21 PDT 2018


> 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


More information about the cfe-dev mailing list