[PATCH] [-cxx-abi microsoft] Mangle user defined entry points properly

Timur Iskhodzhanov timurrrr at google.com
Fri Sep 13 02:04:04 PDT 2013



================
Comment at: test/CodeGenCXX/mangle-ms.cpp:279
@@ +278,3 @@
+
+int DllMain() {
+}
----------------
David Majnemer wrote:
> Timur Iskhodzhanov wrote:
> > This one doesn't compile with CL
> It compiles for me just fine.
> 
> PUBLIC  DllMain
> ; Function compile flags: /Odtp
> _TEXT   SEGMENT
> DllMain PROC
> ; File z:\tmp\tmpp2uxxb.cpp
> ; Line 1
>         xor     eax, eax
>         ret     0
> DllMain ENDP
> _TEXT   ENDS
Interesting:

  error C4716: 'DllMain' : must return a value

(VS2010 CL)

================
Comment at: lib/AST/MicrosoftMangle.cpp:250
@@ -232,4 +249,3 @@
 
-    // "main" is not mangled.
-    if (FD->isMain())
+    if (isUserDefinedEntryPoint(FD))
       return false;
----------------
David Majnemer wrote:
> Timur Iskhodzhanov wrote:
> > Interesting - the isMain() is used in a few places in AST and Sema.
> > 
> > Shouldn't we change isMain() to ask the ABI instead?
> I considered this but abandoned this approach. These user-defined entry points violate what clang considers main. You can only have one main but MSVC lets you get away with having a WinMain and a wmain, etc.
You should probably clarify that in a comment.


http://llvm-reviews.chandlerc.com/D1670



More information about the cfe-commits mailing list