ASan: disabling instrumentation of specific function

Nicholas Wilson via digitalmars-d-ldc digitalmars-d-ldc at
Tue Aug 8 18:56:27 PDT 2017

On Thursday, 3 August 2017 at 20:47:48 UTC, Johan Engelen wrote:
> Hi all,
>   I just implemented blacklisting of functions for the 
> sanitizers' instrumentation via a blacklist file (this is what 
> Clang also provides): 
> But I think it is nice if we also provide a way to disable 
> sanitizer instrumentation by adding a UDA to a function. For 
> PGO, back then, I choose to enable/disable profiling 
> instrumentation through a pragma. However, adding our own 
> pragmas is quite invasive and touches frontend code, whereas 
> adding a UDA is easy and nicely compartmentalized.

Well, technically UDA's now touch fronted code, in the form of 
one entry in idgen.d.
I haven't implemented any pragmas, but I'm sure they will be more 

> Any ideas for a name of the UDA? And where to put it, in 
> ldc.attributes?
> Clang has the no_sanitize_address attribute.

Will blacklisting other sanitisers happen at a future point? if 
so it may make sense to do

// Probably already exists, but w/e
// force the type
enum Sanitizer : byte
     // Other sanitisers
struct blacklist // or struct noSanitize
     Sanitizer s;

otherwise just

private struct _noSanitizeAddress {};
enum noSanitizeAddress = _noSanitizeAddress();

> Thanks,
>   Johan

More information about the digitalmars-d-ldc mailing list