Fix compilation of CodeLayout.cpp for MacOS
authorYevgeny Rouban <yrouban@azul.com>
Mon, 3 Oct 2022 14:47:43 +0000 (21:47 +0700)
committerYevgeny Rouban <yrouban@azul.com>
Mon, 3 Oct 2022 14:47:43 +0000 (21:47 +0700)
llvm/lib/Transforms/Utils/CodeLayout.cpp uses std::abs() with double argument,
which is provided by cmath header, which is not explicitly included into CodeLayout.cpp.
The implicit include in llvm/include/llvm/Support/MathExtras.h was removed in
commit 16544cbe64b81a50800a88296ef37f4873a37b25

Inserting explicit include of cmath into CodeLayout.cpp in order to fix build on MacOS.

Committed on behalf of alsemenov (Aleksei Semenov)
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D135072

llvm/lib/Transforms/Utils/CodeLayout.cpp

index eb35c80..9eb3aff 100644 (file)
@@ -42,6 +42,8 @@
 #include "llvm/Transforms/Utils/CodeLayout.h"
 #include "llvm/Support/CommandLine.h"
 
+#include <cmath>
+
 using namespace llvm;
 #define DEBUG_TYPE "code-layout"