There is no need for this to be VC++ only
authorChris Lattner <sabre@nondot.org>
Mon, 24 Oct 2005 00:08:51 +0000 (00:08 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 24 Oct 2005 00:08:51 +0000 (00:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23915 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/LinkAllPasses.h

index 333e721f8a53a49ce6b423c5fdc90227889a9d07..4ea75cc258f1bf0712663a4e0810e20755c77426 100644 (file)
@@ -7,17 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This header file is required for building with Microsoft's VC++, as it has
-// no way of linking all registered passes into executables other than by
-// explicit use.
+// This header file pulls in all transformation passes for tools like opts and
+// bugpoint that need this functionality.
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_TRANSFORMS_LINKALLPASSES_H
 #define LLVM_TRANSFORMS_LINKALLPASSES_H
 
-#ifdef _MSC_VER
-
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Analysis/LoadValueNumbering.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
-
-// Trying not to include <windows.h>, though maybe we should... Problem is,
-// it pollutes the global namespace in some really nasty ways.
-extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess();
+#include <cstdlib>
 
 namespace {
   struct ForcePassLinking {
     ForcePassLinking() {
-      // We must reference the passes in such a way that VC++ will not
+      // We must reference the passes in such a way that compilers will not
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
-      // to know that GetCurrentProcess() never returns
-      // INVALID_HANDLE_VALUE, this will do the job.
-      if (GetCurrentProcess() != (void *) -1)
+      // to know that getenv() never returns -1, this will do the job.
+      if (std::getenv("bar") != (char*) -1)
         return;
 
       (void) llvm::createAAEvalPass();
@@ -120,6 +113,4 @@ namespace {
   } _ForcePassLinking;
 };
 
-#endif // _MSC_VER
-
 #endif