<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 17, 2015 at 12:58 PM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
I'm experimenting with a Clang tool to generate export tables from<br>
source code (MSVC's .DEF files)<br>
<br>
I've noticed that MSVC always exports the copy assignment operator if<br>
the class is marked __declspec(dllexport), so I'm trying to mimic that<br>
behavior.<br></blockquote><div><br></div><div>Clang already implements that behavior if you use __declspec(dllexport). :-) But I assume you have your reasons for wanting to use .def files.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
So, given:<br>
<br>
  class Implicits { };<br>
<br>
Can I somehow visit the implicit methods (default ctor, copy ctor,<br>
copy assignment operator, dtor) in a Clang tool?<br>
<br>
I've smuggled Sema into the tool and tried to use the DefineImplicit<br>
methods to define them before visitation, but haven't had much luck.<br>
<br>
Is there a documented way to handle this? It seems Clang only defines<br>
these methods if they are used, but for tooling it would be useful to<br>
be able to work with them whether they're actually defined or not.</blockquote><div><br></div><div>See where Clang implements this in SemaDeclCXX.cpp. It calls Sema::ForceDeclarationOfImplicitMembers(), and then iterates over them and marks them referenced to ensure they are emitted.</div></div></div></div>