[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.

; Function compile flags: /Odtp
DllMain PROC
; File z:\tmp\tmpp2uxxb.cpp
; Line 1
        xor     eax, eax
        ret     0
DllMain ENDP


More information about the cfe-commits mailing list