From a35480f85960feccc44ac9a7641070d2a6a78c2f Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Tue, 13 Jul 2021 13:27:09 -0400 Subject: [PATCH] [llvm-exegesis] Fix missing-headers build errors. Details: Switch all #includes to use <> because that is consistent with what happens in the cmake checks. Otherwise, we could be in the situation where cmake checks see that headers exist at but in llvm-exegesis code, we use "perfmon/...", which may not exist. Related PR/revisions: D84076, PR51017+D105615 Differential Revision: https://reviews.llvm.org/D105861 --- llvm/tools/llvm-exegesis/lib/PerfHelper.cpp | 6 +++--- llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp | 17 ++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp index 58e1f4dc2a2b22..8a0b399dc982b6 100644 --- a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp +++ b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp @@ -12,9 +12,9 @@ #include "llvm/Support/Error.h" #include "llvm/Support/raw_ostream.h" #ifdef HAVE_LIBPFM -#include "perfmon/perf_event.h" -#include "perfmon/pfmlib.h" -#include "perfmon/pfmlib_perf_event.h" +#include +#include +#include #endif #include diff --git a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp b/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp index e5b490e02049d8..3fee0e5d525998 100644 --- a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp +++ b/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp @@ -8,19 +8,18 @@ #include "X86Counter.h" -#if defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES) +#if defined(__linux__) && defined(HAVE_LIBPFM) && \ + defined(LIBPFM_HAS_FIELD_CYCLES) // FIXME: Use appropriate wrappers for poll.h and mman.h // to support Windows and remove this linux-only guard. -#ifdef __linux__ + #include "llvm/Support/Endian.h" #include "llvm/Support/Errc.h" -#ifdef HAVE_LIBPFM -#include "perfmon/perf_event.h" -#include "perfmon/pfmlib.h" -#include "perfmon/pfmlib_perf_event.h" -#endif // HAVE_LIBPFM +#include +#include +#include #include #include @@ -258,5 +257,5 @@ X86LbrCounter::doReadCounter(const void *From, const void *To) const { } // namespace exegesis } // namespace llvm -#endif // defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES) -#endif // __linux__ +#endif // defined(__linux__) && defined(HAVE_LIBPFM) && + // defined(LIBPFM_HAS_FIELD_CYCLES)