[cfe-commits] [PATCH] Introduce a plugin architecture

Sebastian Redl sebastian.redl at getdesigned.at
Mon Mar 5 10:16:08 PST 2012


On 05.03.2012, at 17:58, pidgeot18 at gmail.com wrote:

> +
> +/**
> + * Callback that is called before a function is compiled.

s/function/file/ or maybe s/a/any/ ? The way it is doesn't sound right.

> + *
> + * Before this function is called, the callbacks object will have all of its
> + * pointers set to null. All non-null callbacks will be deleted by the compiler
> + * internally, so one should always return a new pointer for every file.
> + *
> + * \arg fileName  The name of the function being called.
> + * \arg callbacks The pointer to the callbacks that this plugin will define for
> + *                this file.
> + */
> +extern void clang_plugin_begin_file(llvm::StringRef fileName,
> +  PluginFileCallbacks *callbacks);
> +
> +/**
> + * Callback that is called after a function has been compiled.

Same here.

> + *
> + * \arg fileName  The name of the function being called.
> + */
> +extern void clang_plugin_end_file(llvm::StringRef fileName);

I still think plugins should be capable of transforming the AST and passing the modified AST down the line (for code augmentation), but this looks like an excellent first step.

Sebastian





More information about the cfe-commits mailing list