]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBError.h
Merge ^/head r313644 through r313895.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBError.h
1 //===-- SBError.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLDB_SBError_h_
11 #define LLDB_SBError_h_
12
13 #include "lldb/API/SBDefines.h"
14
15 namespace lldb {
16
17 class LLDB_API SBError {
18 public:
19   SBError();
20
21   SBError(const lldb::SBError &rhs);
22
23   ~SBError();
24
25   const SBError &operator=(const lldb::SBError &rhs);
26
27   const char *GetCString() const;
28
29   void Clear();
30
31   bool Fail() const;
32
33   bool Success() const;
34
35   uint32_t GetError() const;
36
37   lldb::ErrorType GetType() const;
38
39   void SetError(uint32_t err, lldb::ErrorType type);
40
41   void SetErrorToErrno();
42
43   void SetErrorToGenericError();
44
45   void SetErrorString(const char *err_str);
46
47   int SetErrorStringWithFormat(const char *format, ...)
48       __attribute__((format(printf, 2, 3)));
49
50   bool IsValid() const;
51
52   bool GetDescription(lldb::SBStream &description);
53
54 protected:
55   friend class SBCommandReturnObject;
56   friend class SBData;
57   friend class SBDebugger;
58   friend class SBCommunication;
59   friend class SBHostOS;
60   friend class SBPlatform;
61   friend class SBProcess;
62   friend class SBStructuredData;
63   friend class SBThread;
64   friend class SBTarget;
65   friend class SBValue;
66   friend class SBWatchpoint;
67   friend class SBBreakpoint;
68   friend class SBBreakpointLocation;
69
70   lldb_private::Error *get();
71
72   lldb_private::Error *operator->();
73
74   const lldb_private::Error &operator*() const;
75
76   lldb_private::Error &ref();
77
78   void SetError(const lldb_private::Error &lldb_error);
79
80 private:
81   std::unique_ptr<lldb_private::Error> m_opaque_ap;
82
83   void CreateIfNeeded();
84 };
85
86 } // namespace lldb
87
88 #endif // LLDB_SBError_h_