lecaillon / Conan.Plugin.NullGuard

Conan plugin adds null guard code for all methods and constructors parameters preceded by a [NonNull] attribute.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Preserve debugging #1

Open xoofx opened 6 years ago

xoofx commented 6 years ago

Hi, super initiative!

So, one thing that is important for a plugin is to preserve the debugging experience, specially in the case where the code of the user is modified by a plugin.

In order to do that, you need to add a proper handling of line in your generated code with something like:

#line hidden
// your code 
#line insert_real_line_number_here

Check the latest version of Helloworld repo, it is trying to handle a few cases (method empty, method with expression body...etc.) but it is not yet perfect (there are still a few flaws).

I would like to try to find some recurrent patterns that could fit into the compiler directly for example for this case, but before going there, we need to practice it a bit more, so that's good if you can try this.

lecaillon commented 6 years ago

Indeed 👍 Never heard of the #line preprocessor directive before by the way.