LLVM: lib/Support/Errno.cpp Source File (original) (raw)
Go to the documentation of this file.
1
2
3
4
5
6
7
8
9
10
11
12
14#include "llvm/Config/config.h"
15#include
16#include <errno.h>
17
18
19
20
21
22
23namespace llvm {
24namespace sys {
25
29
31 std::string str;
32 if (errnum == 0)
33 return str;
34#if defined(HAVE_STRERROR_R) || HAVE_DECL_STRERROR_S
35 const int MaxErrStrLen = 2000;
36 char buffer[MaxErrStrLen];
37 buffer[0] = '\0';
38#endif
39
40#ifdef HAVE_STRERROR_R
41
42#if defined(__GLIBC__) && defined(_GNU_SOURCE)
43
44
45 str = strerror_r(errnum, buffer, MaxErrStrLen - 1);
46#else
47 strerror_r(errnum, buffer, MaxErrStrLen - 1);
48 str = buffer;
49#endif
50#elif HAVE_DECL_STRERROR_S
51 strerror_s(buffer, MaxErrStrLen - 1, errnum);
52 str = buffer;
53#else
54
55
56
57 str = strerror(errnum);
58#endif
59 return str;
60}
61
62}
63}
LLVM_ABI std::string StrError()
Returns a string representation of the errno value, using whatever thread-safe variant of strerror() ...
Definition Errno.cpp:26
This is an optimization pass for GlobalISel generic memory operations.