Skip to content

Commit

Permalink
sys::process::get_id() now returns the process ID instead of a proces…
Browse files Browse the repository at this point in the history
…s handle on Windows. Patch thanks to Kim Gräsman!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
AaronBallman committed Jun 8, 2013
1 parent 1799921 commit 0c79301
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions include/llvm/Support/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class process {
public:
/// \brief Operating system specific type to identify a process.
///
/// Note that the windows one is defined to 'void *' as this is the
/// documented type for HANDLE on windows, and we don't want to pull in the
/// Note that the windows one is defined to 'unsigned long' as this is the
/// documented type for DWORD on windows, and we don't want to pull in the
/// Windows headers here.
#if defined(LLVM_ON_UNIX)
typedef pid_t id_type;
#elif defined(LLVM_ON_WIN32)
typedef void *id_type; // Must match the type of HANDLE.
typedef unsigned long id_type; // Must match the type of DWORD.
#else
#error Unsupported operating system.
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/Support/Windows/Process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace sys;


process::id_type self_process::get_id() {
return GetCurrentProcess();
return GetCurrentProcessId();
}

static TimeValue getTimeValueFromFILETIME(FILETIME Time) {
Expand Down
2 changes: 1 addition & 1 deletion unittests/Support/ProcessTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TEST(ProcessTest, SelfProcess) {
#if defined(LLVM_ON_UNIX)
EXPECT_EQ(getpid(), process::get_self()->get_id());
#elif defined(LLVM_ON_WIN32)
EXPECT_EQ(GetCurrentProcess(), process::get_self()->get_id());
EXPECT_EQ(GetCurrentProcessId(), process::get_self()->get_id());
#endif

EXPECT_LT(1u, process::get_self()->page_size());
Expand Down

0 comments on commit 0c79301

Please sign in to comment.