On Jun 22, 2012, at 13:31 , Joshua Cranmer <[email protected]> wrote:
>>> + for (std::vector<Plugin>::iterator it = plugins.begin(); it !=
>>> plugins.end();
>>> + ++it) {
>>> + // Retrieve the callbacks, and clear all of the values to NULL
>>> + clang::plugin::PluginFileCallbacks *callbacks = it->getCallbacks();
>>> + memset(callbacks, 0, sizeof(clang::plugin::PluginFileCallbacks));
>> This is silly. Plugin should just default-initialize the struct when it's
>> created. (Empty parens will do the right thing.)
>
> Some notes:
> 1. This works even if a plugin doesn't define the method (e.g., a plugin just
> wants to do some LLVM hooking)
> 2. This has some footgun-prevention effects for plugin writers
>
Sorry, I meant "the Plugin object", i.e. *it (the class that owns the callback
struck). Users' plugins shouldn't have to do anything. Manuel mentioned this
too.
All your other responses make sense to me. :-) I'd like to see one more
iteration of the patch before this goes in, but I think it's looking pretty
good already.
Jordan
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits