how to instrument dmd compiler to dump all references to a given symbol?

Shachar Shemesh shachar at weka.io
Sun Jan 14 03:15:09 UTC 2018


On 14/01/18 04:42, Adam D. Ruppe wrote:
> On Sunday, 14 January 2018 at 02:36:02 UTC, Timothee Cour wrote:
>> how to instrument dmd compiler to dump all references to a given symbol?
> 
> you can actually do it with your own code. behold:
> 
> struct A{
> //int a; // comment this line
> int _a; // make the actual var renamed...

It wouldn't catch this use:

auto hiddenUser(T)(T t) {
   static if( __traits(hasMember, T, "a") ) {
     return T.a;
   } else {
     return 17;
   }
}

...
   A var;
   hiddenUser(var);


More information about the Digitalmars-d mailing list