From e7b2bc0d08e18045b63b44b54440788581e5c89e Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Wed, 28 May 2025 22:30:12 +0100 Subject: [PATCH] Basic: Adjust condition for include after macro removal in upstream LLVM `HAVE_SYS_RESOURCE_H` was removed in https://github.com/llvm/llvm-project/pull/123288, so this header is no longer included at this particular location on rebranch, which breaks the Linux build, where it is not transitively included either. Use the same condition as in the use site (`getChildrenMaxResidentSetSize`) instead. Also, don't wrap `HAVE_GETRUSAGE` in `defined()` in case it does get defined to 0. --- lib/Basic/Statistic.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Basic/Statistic.cpp b/lib/Basic/Statistic.cpp index 4a20de17501c0..f270fe9ed690c 100644 --- a/lib/Basic/Statistic.cpp +++ b/lib/Basic/Statistic.cpp @@ -33,7 +33,7 @@ #ifdef HAVE_SYS_TIME_H #include #endif -#ifdef HAVE_SYS_RESOURCE_H +#if HAVE_GETRUSAGE && !defined(__HAIKU__) #include #endif #ifdef HAVE_PROC_PID_RUSAGE @@ -383,7 +383,7 @@ void UnifiedStatsReporter::recordJobMaxRSS(long rss) { } int64_t UnifiedStatsReporter::getChildrenMaxResidentSetSize() { -#if defined(HAVE_GETRUSAGE) && !defined(__HAIKU__) +#if HAVE_GETRUSAGE && !defined(__HAIKU__) struct rusage RU; ::getrusage(RUSAGE_CHILDREN, &RU); int64_t M = static_cast(RU.ru_maxrss);