diff --git a/include/llvm/Transforms/LinkAllPasses.h b/include/llvm/Transforms/LinkAllPasses.h index 333e721f8a5..4ea75cc258f 100644 --- a/include/llvm/Transforms/LinkAllPasses.h +++ b/include/llvm/Transforms/LinkAllPasses.h @@ -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" @@ -25,20 +22,16 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" - -// Trying not to include , though maybe we should... Problem is, -// it pollutes the global namespace in some really nasty ways. -extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); +#include 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