This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC contribution


On Wed, Mar 28, 2018 at 11:15 PM, Katsunori Kumatani <
katsunori.kumatani@gmail.com> wrote:

> For example, I wanted to add some plugin processing (actually a top-level
> asm statement) at the end of a translation unit (with gathered data) to add
> some special symbols / GAS directives (not instructions). But there's no
> "normal" plugin event for this.
>
> So instead I simply saved the original lang_hooks.parse_file hook
> (pointer), overrode the hook with the plugin's, which calls the original
> first and then does whatever plugin does. And it works fine. This kind of
> thing wouldn't be easily changed with virtual methods I believe.
>
I think this would be pretty straightforward: you will need a single plugin
event, which would allow you to provide your own instance of a class
derived from lang_hooks. You could then inherit a new class from the
lang_hooks class in the frontend and override any of its virtual methods.

-- 
Regards,
   Mikhail Maltsev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]