]> granicus.if.org Git - llvm/commitdiff
Fix the build for MSVC builds using M_PI
authorReid Kleckner <rnk@google.com>
Thu, 29 Aug 2019 20:32:53 +0000 (20:32 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 29 Aug 2019 20:32:53 +0000 (20:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370405 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

index 1562523a8516828754d0a236c8752e26c64a44ab..a48243aad29ee10d19f1fb2061e429f4794a3553 100644 (file)
 /// \todo This should be generated by TableGen.
 //===----------------------------------------------------------------------===//
 
+#if defined(_MSC_VER) || defined(__MINGW32__)
+// According to Microsoft, one must set _USE_MATH_DEFINES in order to get M_PI
+// from the Visual C++ cmath / math.h headers:
+// https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=vs-2019
+#define _USE_MATH_DEFINES
+#endif
+
 #include "AMDGPU.h"
 #include "AMDGPULegalizerInfo.h"
 #include "AMDGPUTargetMachine.h"