LLDB mainline
AutoHandle.h
Go to the documentation of this file.
1//===-- AutoHandle.h --------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_lldb_Host_windows_AutoHandle_h_
10#define LLDB_lldb_Host_windows_AutoHandle_h_
11
13
14namespace lldb_private {
15
17public:
18 AutoHandle(HANDLE handle, HANDLE invalid_value = INVALID_HANDLE_VALUE)
19 : m_handle(handle), m_invalid_value(invalid_value) {}
20
23 ::CloseHandle(m_handle);
24 }
25
26 bool IsValid() const { return m_handle != m_invalid_value; }
27
28 HANDLE get() const { return m_handle; }
29
30private:
31 HANDLE m_handle;
33};
34}
35
36#endif
bool IsValid() const
Definition: AutoHandle.h:26
HANDLE get() const
Definition: AutoHandle.h:28
AutoHandle(HANDLE handle, HANDLE invalid_value=INVALID_HANDLE_VALUE)
Definition: AutoHandle.h:18
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14