Question regarding EndSourceFileAction

Hi,

I am writing a Clang plugin (called SimplePlugin) which traverses AST-nodes
by
using ASTConsumer methods. The main plugin class is derived from the
PluginASTAction
class.

In this plugin, I need to store some information for each translation unit
parsed by Clang and therefore, I have overloaded EndSourceFileAction
function in
the SimplePlugin class.

Now, if the SimplePlugin is loaded as the default action in Clang, then the
overloaded
EndSourceFileAction function gets executed. However, if the plugin is used
in addition
to the default action (-cc1), then EndSourceFileAction function isn't
executed.

$ 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
used
then FrontendAction::EndSourceFileAction method will always be called which
is an empty function. The implementation is such that ASTConsumer methods
for all
plugins would be executed, but not the EndSourceFileAction method.

I wondering if the knowledgeable people can tell me if this is a design
decision
or an implementation oversight? If it is a design decision, then what would
be
the best way to store information for each translation unit.

Regards,
Manish