<div dir="ltr">On Fri, Jun 14, 2013 at 5:00 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Attached is a patch to add a mangling for protocol-qualified ObjC types (like id<MyProtocol>).  The mangling is pretty straightforward:</div>
<div><br></div><div><font face="courier new, monospace"><protocol-qualfied-type> ::= U10__protqual <protocol name>+ E <base-type></font></div>
<div><br></div><div>This is necessary so we can mangle things like protocol qualified types in template parameters without causing a conflict with unqualified types (see, e.g. <rdar://problem/14074822>).</div><div>
<br>
</div><div>The obvious issue here is that this isn't ABI-compatible with previous clang versions.  However, the question of ABI-compatibility doesn't actually come up in common cases.  clang currently has code in Sema which prevents overloading a function based on an argument where the only difference is protocol qualification.  Taking advantage of this, this patch avoids changing the mangling for any function where protocol qualifications only show up in arguments of type ObjC interface pointer and arguments of type pointer-to-ObjC interface pointer.  Doug and I think that this is enough to avoid the worst of the ABI breakage.</div>

<div><br></div><div>(This patch also changes the relevant overloading code in Sema to be a bit more consistent with what it considers an overload, to make IRGen easier to implement.)<br></div><div><br></div><div>John, I would appreciate any comments you have.</div>
<span class="HOEnZb"><font color="#888888">
<div></div></font></span></div></blockquote></div><br></div><div class="gmail_extra">Attaching updated version which fixes a couple bugs.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">-Eli</div></div>