[cfe-dev] Question regarding EndSourceFileAction
manish.verma at arm.com
Mon Feb 18 10:31:24 PST 2013
I am writing a Clang plugin (called SimplePlugin) which traverses AST-nodes
using ASTConsumer methods. The main plugin class is derived from the
In this plugin, I need to store some information for each translation unit
parsed by Clang and therefore, I have overloaded EndSourceFileAction
the SimplePlugin class.
Now, if the SimplePlugin is loaded as the default action in Clang, then the
EndSourceFileAction function gets executed. However, if the plugin is used
to the default action (-cc1), then EndSourceFileAction function isn't
$ clang -cc1 -load ./SimplePlugin.so -add-plugin simple foo.c
I have stepped through the code and it seems that when -add-plugin option is
then FrontendAction::EndSourceFileAction method will always be called which
is an empty function. The implementation is such that ASTConsumer methods
plugins would be executed, but not the EndSourceFileAction method.
I wondering if the knowledgeable people can tell me if this is a design
or an implementation oversight? If it is a design decision, then what would
the best way to store information for each translation unit.
More information about the cfe-dev