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 
14 namespace lldb_private {
15 
16 class AutoHandle {
17 public:
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 
30 private:
31  HANDLE m_handle;
33 };
34 }
35 
36 #endif
lldb_private::AutoHandle::AutoHandle
AutoHandle(HANDLE handle, HANDLE invalid_value=INVALID_HANDLE_VALUE)
Definition: AutoHandle.h:18
lldb_private::AutoHandle
Definition: AutoHandle.h:16
lldb_private::AutoHandle::get
HANDLE get() const
Definition: AutoHandle.h:28
lldb_private::AutoHandle::m_handle
HANDLE m_handle
Definition: AutoHandle.h:31
lldb_private::AutoHandle::IsValid
bool IsValid() const
Definition: AutoHandle.h:26
lldb_private::AutoHandle::~AutoHandle
~AutoHandle()
Definition: AutoHandle.h:21
lldb_private::AutoHandle::m_invalid_value
HANDLE m_invalid_value
Definition: AutoHandle.h:32
windows.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16