Quantcast

Merging AST from Multiple Translation Units

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Merging AST from Multiple Translation Units

Uri Mann
Hello everyone;

I'm trying to create a tool which transforms source using a class derived from ASTFrontendAction. The tool need to transform one or more source files and then produce a final source file which can reference symbols from all of the processed source files. I tried to use ASTMergeAction class by saving the ASTUnit at the inside my class's EndSourceFileAction(). But when the files are merged, ASTImporter emits multiple errors "cannot import unsupported AST node xxx". Is this the right way to do it?

Thanks in advance.
-Uri


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Merging AST from Multiple Translation Units

Alexey Kutumov
Hello,

I suppose that ASTImporter does not handle all AST nodes (i know that it cannot import `using` directives, it cannot import templates, also it cannot import pragmas and so on). I think that it can import only simple nodes (like structs, classes, functions).

I have branch (based on 3.6) https://github.com/prograholic/clang/tree/odr-check. In this branch i'm trying to implement import of all possible nodes. But my branch is highly experimental.

2015-06-17 6:41 GMT+06:00 Uri Mann <[hidden email]>:
Hello everyone;

I'm trying to create a tool which transforms source using a class derived from ASTFrontendAction. The tool need to transform one or more source files and then produce a final source file which can reference symbols from all of the processed source files. I tried to use ASTMergeAction class by saving the ASTUnit at the inside my class's EndSourceFileAction(). But when the files are merged, ASTImporter emits multiple errors "cannot import unsupported AST node xxx". Is this the right way to do it?

Thanks in advance.
-Uri


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Merging AST from Multiple Translation Units

Manuel Klimek
The generally used way to do that that also scales well is:
- run tool on each TU, produce intermediate output for each TU (map phase)
- slurp in intermediate output and produce end-result you want (reduce phase)

On Wed, Jun 17, 2015 at 6:37 AM Alexey Kutumov <[hidden email]> wrote:
Hello,

I suppose that ASTImporter does not handle all AST nodes (i know that it cannot import `using` directives, it cannot import templates, also it cannot import pragmas and so on). I think that it can import only simple nodes (like structs, classes, functions).

I have branch (based on 3.6) https://github.com/prograholic/clang/tree/odr-check. In this branch i'm trying to implement import of all possible nodes. But my branch is highly experimental.

2015-06-17 6:41 GMT+06:00 Uri Mann <[hidden email]>:
Hello everyone;

I'm trying to create a tool which transforms source using a class derived from ASTFrontendAction. The tool need to transform one or more source files and then produce a final source file which can reference symbols from all of the processed source files. I tried to use ASTMergeAction class by saving the ASTUnit at the inside my class's EndSourceFileAction(). But when the files are merged, ASTImporter emits multiple errors "cannot import unsupported AST node xxx". Is this the right way to do it?

Thanks in advance.
-Uri


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Merging AST from Multiple Translation Units

anooprajanna
This post has NOT been accepted by the mailing list yet.
In reply to this post by Uri Mann
Hi,

Can you please share your code where you have used ASTMergeAction for combining different AST's.

thanks
Loading...