From f5808f12ef86c3dc26bc19bb02a96d374d553cc8 Mon Sep 17 00:00:00 2001
From: Frederich Munch <marsupial@users.noreply.github.com>
Date: Wed, 30 Nov 2016 16:18:09 -0500
Subject: [PATCH] Windows: Remove managed at/on exit wrappers.

---
 .../cling/lib/Interpreter/Interpreter.cpp     | 20 +------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/interpreter/cling/lib/Interpreter/Interpreter.cpp b/interpreter/cling/lib/Interpreter/Interpreter.cpp
index 60a4ac28e48..1deb71a3c14 100644
--- a/interpreter/cling/lib/Interpreter/Interpreter.cpp
+++ b/interpreter/cling/lib/Interpreter/Interpreter.cpp
@@ -346,11 +346,9 @@ namespace cling {
       Strm << Linkage << " int __cxa_atexit(void (*f)(void*), void*, void*);\n";
 
       // C atexit, std::atexit
-#if !defined(LLVM_ON_WIN32) || !defined(_M_CEE_PURE)
       Strm << Linkage << " int atexit(void(*f)()) { "
            "return __cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); }\n";
       Globals.push_back("atexit");
-#endif
 
       // C++ 11 at_quick_exit, std::at_quick_exit
       if (LangOpts.CPlusPlus && LangOpts.CPlusPlus11) {
@@ -377,22 +375,6 @@ namespace cling {
          "__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f;}\n";
       Globals.push_back("_onexit");
  #endif
- #if defined(_M_CEE) || defined(_M_CEE_PURE)
-  #ifdef _M_CEE_MIXED
-      Strm << Linkage << " int __clrcall _atexit_m(_onexit_t f) { "
-         "return __cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); }\n";
-      Globals.push_back("_atexit_m");
-      Strm << Linkage << " _onexit_t_m __clrcall _onexit_m(_onexit_t f) { "
-         "__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f; }\n";
-      Globals.push_back("_onexit_m");
-  #endif
-      Strm << Linkage << " _onexit_t_m __clrcall _onexit_m_appdomain(_onexit_t f) { "
-         "__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f; }\n";
-      Globals.push_back("_onexit_m_appdomain");
-      Strm << Linkage << " int __clrcall _atexit_m_appdomain(_onexit_t f) { "
-         "return __cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); }\n";
-      Globals.push_back("_atexit_m_appdomain");
- #endif
 #endif
 
       // Override the native symbols now, before anything can be emitted.
@@ -402,7 +384,7 @@ namespace cling {
     }
 
     if (m_Opts.Verbose())
-      llvm::errs() << Strm.str();
+      cling::errs() << Strm.str();
 
     Transaction *T;
     declare(Strm.str(), &T);
-- 
GitLab