diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 6a104e738fa..d3189e6c589 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -22,7 +22,6 @@ #ifdef _MSC_VER #include -#include #endif namespace llvm { @@ -639,13 +638,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) { return int64_t(X << (64 - B)) >> (64 - B); } -#if defined(_MSC_VER) - // Visual Studio defines the HUGE_VAL class of macros using purposeful - // constant arithmetic overflow, which it then warns on when encountered. - const float huge_valf = std::numeric_limits::infinity(); -#else - const float huge_valf = HUGE_VALF; -#endif +extern const float huge_valf; } // End llvm namespace #endif diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt index 6ed5416bb7f..8ba992a40be 100644 --- a/lib/Support/CMakeLists.txt +++ b/lib/Support/CMakeLists.txt @@ -36,6 +36,7 @@ add_llvm_library(LLVMSupport Locale.cpp LockFileManager.cpp ManagedStatic.cpp + MathExtras.cpp MemoryBuffer.cpp MemoryObject.cpp MD5.cpp diff --git a/lib/Support/MathExtras.cpp b/lib/Support/MathExtras.cpp new file mode 100644 index 00000000000..ba0924540ce --- /dev/null +++ b/lib/Support/MathExtras.cpp @@ -0,0 +1,32 @@ +//===-- MathExtras.cpp - Implement the MathExtras header --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the MathExtras.h header +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/MathExtras.h" + +#ifdef _MSC_VER +#include +#else +#include +#endif + +namespace llvm { + +#if defined(_MSC_VER) + // Visual Studio defines the HUGE_VAL class of macros using purposeful + // constant arithmetic overflow, which it then warns on when encountered. + const float huge_valf = std::numeric_limits::infinity(); +#else + const float huge_valf = HUGE_VALF; +#endif + +}