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

David Majnemer david.majnemer at gmail.com
Fri Sep 13 01:56:07 PDT 2013



================
Comment at: lib/AST/MicrosoftMangle.cpp:250
@@ -232,4 +249,3 @@
 
-    // "main" is not mangled.
-    if (FD->isMain())
+    if (isUserDefinedEntryPoint(FD))
       return false;
----------------
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.

================
Comment at: test/CodeGenCXX/mangle-ms.cpp:279
@@ +278,3 @@
+
+int DllMain() {
+}
----------------
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


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



More information about the cfe-commits mailing list