LLVM: lib/Support/InitLLVM.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

16

17#ifdef _WIN32

19#endif

20

21#if defined(HAVE_UNISTD_H)

22#include <unistd.h>

23#else

24#ifndef STDIN_FILENO

25#define STDIN_FILENO 0

26#endif

27#ifndef STDOUT_FILENO

28#define STDOUT_FILENO 1

29#endif

30#ifndef STDERR_FILENO

31#define STDERR_FILENO 2

32#endif

33#endif

34

36#ifdef _AIX

37

38 auto RaiseLimit = [](int resource) {

39 struct rlimit r;

40 getrlimit(resource, &r);

41

42

43

44 if (r.rlim_cur != RLIM_INFINITY && r.rlim_cur != r.rlim_max) {

45 r.rlim_cur = r.rlim_max;

46 setrlimit(resource, &r);

47 }

48 };

49

50

51 RaiseLimit(RLIMIT_AS);

52

53 RaiseLimit(RLIMIT_DATA);

54

55 RaiseLimit(RLIMIT_STACK);

56#ifdef RLIMIT_RSS

57

58 RaiseLimit(RLIMIT_RSS);

59#endif

60#endif

61}

62

71

72using namespace llvm;

74

76 bool InstallPipeSignalExitHandler) {

77#ifndef NDEBUG

78 static std::atomic Initialized{false};

79 assert(!Initialized && "InitLLVM was already initialized!");

80 Initialized = true;

81#endif

82

83

85

86 if (InstallPipeSignalExitHandler)

87

88

89

90

91

93

94

95 StackPrinter.emplace(Argc, Argv);

99

100#ifdef __MVS__

101

102

103

104

105 std::string Banner = std::string(Argv[0]) + ": ";

107

108

109

112#endif

113

114#ifdef _WIN32

115

116

117

118

119

120

121

122

123

124 std::string Banner = std::string(Argv[0]) + ": ";

126

128

129

130

131 Args.push_back(nullptr);

132

133 Argc = Args.size() - 1;

134 Argv = Args.data();

135#endif

136}

137

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static void RaiseLimits()

Definition InitLLVM.cpp:35

#define STDOUT_FILENO

Definition InitLLVM.cpp:28

#define STDERR_FILENO

Definition InitLLVM.cpp:31

void CleanupStdHandles(void *Cookie)

Definition InitLLVM.cpp:63

#define STDIN_FILENO

Definition InitLLVM.cpp:25

Helper for check-and-exit error handling.

LLVM_ABI ~InitLLVM()

Definition InitLLVM.cpp:138

LLVM_ABI InitLLVM(int &Argc, const char **&Argv, bool InstallPipeSignalExitHandler=true)

Definition InitLLVM.cpp:75

This class implements an extremely fast bulk output stream that can only output to a stream.

LLVM_ABI std::error_code GetCommandLineArguments(SmallVectorImpl< const char * > &Args, BumpPtrAllocator &Alloc)

LLVM_ABI void DefaultOneShotPipeSignalHandler()

On Unix systems and Windows, this function exits with an "IO error" exit code.

LLVM_ABI void SetOneShotPipeSignalFunction(void(*Handler)())

Registers a function to be called in a "one-shot" manner when a pipe signal is delivered to the proce...

LLVM_ABI void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie)

Add a function to be called when an abort/kill signal is delivered to the process.

LLVM_ABI void PrintStackTraceOnErrorSignal(StringRef Argv0, bool DisableCrashReporting=false)

When an error signal (such as SIGABRT or SIGSEGV) is delivered to the process, print a stack trace an...

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI raw_fd_ostream & outs()

This returns a reference to a raw_fd_ostream for standard output.

LLVM_ABI void install_out_of_memory_new_handler()

LLVM_ABI raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

LLVM_ABI void llvm_shutdown()

llvm_shutdown - Deallocate and destroy all ManagedStatic variables.

LLVM_ABI Error errorCodeToError(std::error_code EC)

Helper for converting an std::error_code to a Error.