[cfe-dev] No clang::Action no party

Simone Pellegrini spellegrini at dps.uibk.ac.at
Mon Sep 20 00:54:57 PDT 2010


  Dear all,
I noticed the old clang::Action interface has been wiped out from the 
new release of clang. This was a big shoot for me as I rely on the 
virtual dispatch of Actions and Sema to implement a mechanism to attach 
pragmas to statements.

My solution was rather simple and effective, a custom class extending 
Sema where a couple of methods of the Action interface were overloaded 
(and by reading this mailing list frequently I know this is something 
several people did for the same kind of problem). Now as the virtual 
dispatch has been removed my overloaded functions are not called 
anymore. I temporarily solved the problem by modifying the Sema 
interface and redeclaring virtual those methods I need to overload. But 
I would prefer to make my code work without patching clang.

I know you are rather picky with performance and virtual dispatch was 
too expensive but you have to give us at least another way to call an 
overloaded Sema. Could be templates an option here?

template <class Action = clang::Sema>
class Parser { };

By using this mechanism you still keep the static method dispatch and 
the capabilities of providing an overloaded behavior for Sema. Is there 
another way to have the behavior I am looking for?

thanks, Simone





More information about the cfe-dev mailing list