aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Host/HostInfo.h
blob: cbbf6cd2d49cf8df14c0e3f8bf0ffed74fa04d22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//===-- HostInfoBase.h ------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef lldb_Host_HostInfo_h_
#define lldb_Host_HostInfo_h_

//----------------------------------------------------------------------
/// @class HostInfo HostInfo.h "lldb/Host/HostInfo.h"
/// @brief A class that provides host computer information.
///
/// HostInfo is a class that answers information about the host operating
/// system.  Note that HostInfo is NOT intended to be used to manipulate or
/// control the operating system.
///
/// HostInfo is implemented in an OS-specific class (for example
/// HostInfoWindows) in a separate file, and then typedefed to HostInfo here.
/// Users of the class reference it as HostInfo::method().
///
/// Not all hosts provide the same functionality.  It is important that methods
/// only be implemented at the lowest level at which they make sense.  It should
/// be up to the clients of the class to ensure that they not attempt to call a
/// method which doesn't make sense for a particular platform.  For example,
/// when implementing a method that only makes sense on a posix-compliant
/// system, implement it on HostInfoPosix, and not on HostInfoBase with a
/// default implementation.  This way, users of HostInfo are required to think
/// about the implications of calling a particular method and if used in a
/// context where the method doesn't make sense, will generate a compiler error.
///
//----------------------------------------------------------------------

#if defined(_WIN32)
#include "lldb/Host/windows/HostInfoWindows.h"
#define HOST_INFO_TYPE HostInfoWindows
#elif defined(__linux__)
#include "lldb/Host/linux/HostInfoLinux.h"
#define HOST_INFO_TYPE HostInfoLinux
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
#define HOST_INFO_TYPE HostInfoFreeBSD
#elif defined(__APPLE__)
#include "lldb/Host/macosx/HostInfoMacOSX.h"
#define HOST_INFO_TYPE HostInfoMacOSX
#else
#include "lldb/Host/posix/HostInfoPosix.h"
#define HOST_INFO_TYPE HostInfoPosix
#endif

namespace lldb_private
{
typedef HOST_INFO_TYPE HostInfo;
}

#undef HOST_INFO_TYPE

#endif