diff options
author | Sergej Jaskiewicz <jaskiewiczs@icloud.com> | 2020-04-13 14:26:35 +0300 |
---|---|---|
committer | Sergej Jaskiewicz <jaskiewiczs@icloud.com> | 2020-04-16 15:05:37 +0300 |
commit | 5cef31074ff5ff63a38e0142783849987c598ef8 (patch) | |
tree | f96ad3e212df08655666134364eb32ba1cc068d7 /llvm/lib/Support/CodeGenCoverage.cpp | |
parent | 65a2de7e6c986193a630e691686c527b08f292d5 (diff) | |
download | llvm-5cef31074ff5ff63a38e0142783849987c598ef8.zip llvm-5cef31074ff5ff63a38e0142783849987c598ef8.tar.gz llvm-5cef31074ff5ff63a38e0142783849987c598ef8.tar.bz2 |
Introduce llvm::sys::Process::getProcessId() and adopt it
Differential Revision: https://reviews.llvm.org/D78022
Diffstat (limited to 'llvm/lib/Support/CodeGenCoverage.cpp')
-rw-r--r-- | llvm/lib/Support/CodeGenCoverage.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/llvm/lib/Support/CodeGenCoverage.cpp b/llvm/lib/Support/CodeGenCoverage.cpp index 2db4193..93f386b 100644 --- a/llvm/lib/Support/CodeGenCoverage.cpp +++ b/llvm/lib/Support/CodeGenCoverage.cpp @@ -11,20 +11,14 @@ #include "llvm/Support/CodeGenCoverage.h" -#include "llvm/Config/llvm-config.h" #include "llvm/Support/Endian.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Mutex.h" +#include "llvm/Support/Process.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/ToolOutputFile.h" -#if LLVM_ON_UNIX -#include <unistd.h> -#elif defined(_WIN32) -#include <windows.h> -#endif - using namespace llvm; static sys::SmartMutex<true> OutputMutex; @@ -89,14 +83,7 @@ bool CodeGenCoverage::emit(StringRef CoveragePrefix, // We can handle locking within a process easily enough but we don't want to // manage it between multiple processes. Use the process ID to ensure no // more than one process is ever writing to the same file at the same time. - std::string Pid = -#if LLVM_ON_UNIX - llvm::to_string(::getpid()); -#elif defined(_WIN32) - llvm::to_string(::GetCurrentProcessId()); -#else - ""; -#endif + std::string Pid = llvm::to_string(sys::Process::getProcessId()); std::string CoverageFilename = (CoveragePrefix + Pid).str(); |