<div dir="ltr">Sounds good.  I added a local that caches the 64-bitness of pointers.<div><br></div><div style>-Warren</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 2, 2013 at 2:51 PM, Charles Davis <span dir="ltr"><<a href="mailto:cdavis5x@gmail.com" target="_blank">cdavis5x@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On May 2, 2013, at 3:19 PM, Warren Hunt wrote:<br>
<br>
> I've put together a patch that fixes all of the issues I found with Microsoft name mangling in 64-bit mode.  Mostly it involves adding an 'E' note to all pointers that are 64-bit (including 'this' pointers).  This is done in MicrosoftMangle.cpp.  I've updated 3 of the mangling test files with X64 tests, which provides some reasonable amount of coverage.<br>

><br>
> Please review.<br>
><br>
> Thanks,<br>
> -Warren<br>
><br>
> (Note: This is my first patch.)<br>
</div></div>Welcome to Clang development!<br>
<br>
> @@ -1277,6 +1278,9 @@ void MicrosoftCXXNameMangler::mangleFunctionClass(const FunctionDecl *FD) {<br>
>          else<br>
>            Out << 'Q';<br>
>      }<br>
> +  if (getASTContext().getTargetInfo().getPointerWidth(0) == 64 &&<br>
> +      !MD->isStatic())<br>
> +    Out << 'E';<br>
>    } else<br>
>      Out << 'Y';<br>
>  }<br>
The indentation on this looks wrong. (You can't tell from here, but it's definitely wrong in the patch itself.) Also, I think we should handle this where we mangle in the 'this' qualifiers--the 'E' is because the 'this' pointer is Extended (__ptr64 instead of __ptr32). (The relevant line is 1172.)<br>

<br>
> @@ -1390,6 +1394,8 @@ void MicrosoftCXXNameMangler::mangleDecayedArrayType(const ArrayType *T,<br>
>      manglePointerQualifiers(T->getElementType().getQualifiers());<br>
>    } else {<br>
>      Out << 'Q';<br>
> +    if (getASTContext().getTargetInfo().getPointerWidth(0) == 64)<br>
> +      Out << 'E';<br>
>    }<br>
>    mangleType(T->getElementType(), SourceRange());<br>
>  }<br>
Why only here? What does VC do in the global case?<br>
<br>
There's a lot of code duplication (i.e. checks against the pointer size sprinkled throughout the code). Most of those can be collapsed into mangleQualifiers().<br>
<br>
Someone else wrote a patch a while back. You can find it here:<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D101" target="_blank">http://llvm-reviews.chandlerc.com/D101</a><br>
<br>
I didn't finish reviewing it because real life got in the way. :\. You might find some ideas in there.<br>
<br>
Chip<br>
<br>
</blockquote></div><br></div>