[PATCH] [ms-cxxabi] PR15512 - mangle lambda names.

Michael Han fragmentshaders at gmail.com
Thu May 9 13:03:32 PDT 2013

Comment at: lib/AST/MicrosoftMangle.cpp:485-492
@@ +484,10 @@
+          // Mangle local lambda in the form
+          // <lambda_n>
+          // where n is the lambda id.
+          SmallString<64> Str;
+          Str += "<lambda_";
+          Str += llvm::utostr(ID);
+          Str += ">";
+          Out << Str.str();
+          break;
Charles Davis wrote:
> Are you sure we should deviate from VC's behavior here? I thought the whole point of Microsoft ABI support was so we could compile a program with Clang against a DLL compiled with VC (and //vice versa//), and have it all just work. (At least, that's what I had in mind when I started all this :).
> I do admit, this might be a bit nicer if we were the ones driving the ABI "spec" (inasmuch as there even //is// one to follow), but we're not. (Then again, they do only have internal linkage...)
> On a related note, I now know I need to investigate VC's behavior when a mangled name refers to multiple unnamed tag types (if it's even possible...).

I fully agree what you said I didn't try to deviate from MSVC - the <lambda> tag is what VC would emit for lambda with internal linkage (and probably with external linkage as well.) based on what I observed. Since there is no spec, my understanding may be inaccurate. 

As for the MS ABI spec, I am also curious to know if there is any public documents on how closure types should be mangled. All the existing documents about MS name mangling I can find seems dated and wrote before lambda got into standard and VC.


More information about the cfe-commits mailing list