[llvm] 39ecfe6 - Support: Simplify __HAIKU__ #ifdef in llvm::sys::Wait, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 12:29:12 PST 2021


Author: Duncan P. N. Exon Smith
Date: 2021-01-28T12:28:12-08:00
New Revision: 39ecfe614350fa5db7b8f13f81212f8e3831a390

URL: https://github.com/llvm/llvm-project/commit/39ecfe614350fa5db7b8f13f81212f8e3831a390
DIFF: https://github.com/llvm/llvm-project/commit/39ecfe614350fa5db7b8f13f81212f8e3831a390.diff

LOG: Support: Simplify __HAIKU__ #ifdef in llvm::sys::Wait, NFC

This just reduces the amount of code in the `#ifndef` block as a
follow-up to 5c1cea6f406366b85f3c200a1c48f713da4450ba.

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Program.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index d42681f5dc6b..679ba536c99e 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -452,12 +452,11 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
   if (ProcStat) {
     std::chrono::microseconds UserT = toDuration(Info.ru_utime);
     std::chrono::microseconds KernelT = toDuration(Info.ru_stime);
+    uint64_t PeakMemory = 0;
 #ifndef __HAIKU__
-    uint64_t PeakMemory = static_cast<uint64_t>(Info.ru_maxrss);
-    *ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory};
-#else
-    *ProcStat = ProcessStatistics{UserT + KernelT, UserT, 0};
+    PeakMemory = static_cast<uint64_t>(Info.ru_maxrss);
 #endif
+    *ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory};
   }
 
   // Return the proper exit status. Detect error conditions


        


More information about the llvm-commits mailing list