<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>
<div><br></div><div>-Eli</div></div>