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

1

2

3

4

5

6

7

8

9

10

11

12

16#include "llvm/Config/config.h"

17#include "llvm/Config/llvm-config.h"

21

22#include

23#include <stdlib.h>

24

25using namespace llvm;

26using namespace sys;

27

28

29

30

31

32

33std::optionalstd::string

37

38std::optionalstd::string

42 std::optionalstd::string FoundPath;

43 std::optionalstd::string OptPath = Process::GetEnv(EnvName);

44 if (!OptPath)

45 return FoundPath;

46

47 const char EnvPathSeparatorStr[] = {Separator, '\0'};

49 SplitString(*OptPath, Dirs, EnvPathSeparatorStr);

50

52 if (Dir.empty())

53 continue;

54

56 continue;

57

61 FoundPath = std::string(FilePath);

62 break;

63 }

64 }

65

66 return FoundPath;

67}

68

69

70#define COLOR(FGBG, CODE, BOLD) "\033[0;" BOLD FGBG CODE "m"

71

72#define ALLCOLORS(FGBG, BRIGHT, BOLD) \

73 { \

74 COLOR(FGBG, "0", BOLD), \

75 COLOR(FGBG, "1", BOLD), \

76 COLOR(FGBG, "2", BOLD), \

77 COLOR(FGBG, "3", BOLD), \

78 COLOR(FGBG, "4", BOLD), \

79 COLOR(FGBG, "5", BOLD), \

80 COLOR(FGBG, "6", BOLD), \

81 COLOR(FGBG, "7", BOLD), \

82 COLOR(BRIGHT, "0", BOLD), \

83 COLOR(BRIGHT, "1", BOLD), \

84 COLOR(BRIGHT, "2", BOLD), \

85 COLOR(BRIGHT, "3", BOLD), \

86 COLOR(BRIGHT, "4", BOLD), \

87 COLOR(BRIGHT, "5", BOLD), \

88 COLOR(BRIGHT, "6", BOLD), \

89 COLOR(BRIGHT, "7", BOLD), \

90 }

91

92

93

94

95

96

97

102

103

104

105

107

109

110[[noreturn]] void Process::Exit(int RetCode, bool NoCleanup) {

112 CRC->HandleExit(RetCode);

113

114 if (NoCleanup)

115 ExitNoCleanup(RetCode);

116 else

117 ::exit(RetCode);

118}

119

120

121#ifdef LLVM_ON_UNIX

123#endif

124#ifdef _WIN32

126#endif

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

static bool coreFilesPrevented

Definition Process.cpp:106

#define ALLCOLORS(FGBG, BRIGHT, BOLD)

Definition Process.cpp:72

static const char colorcodes[2][2][16][11]

Definition Process.cpp:98

Provides a library for accessing information about this process and other processes on the operating ...

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Crash recovery helper object.

static LLVM_ABI CrashRecoveryContext * GetCurrent()

Return the active context, if the code is currently executing in a thread which is in a protected con...

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

static LLVM_ABI std::optional< std::string > FindInEnvPath(StringRef EnvName, StringRef FileName, ArrayRef< std::string > IgnoreList, char Separator=EnvPathSeparator)

This function searches for an existing file in the list of directories in a PATH like environment var...

Definition Process.cpp:39

static LLVM_ABI void Exit(int RetCode, bool NoCleanup=false)

Equivalent to exit(), except when running inside a CrashRecoveryContext.

Definition Process.cpp:110

static LLVM_ABI bool AreCoreFilesPrevented()

true if PreventCoreFiles has been called, false otherwise.

Definition Process.cpp:108

static LLVM_ABI std::optional< std::string > GetEnv(StringRef name)

LLVM_ABI bool exists(const basic_file_status &status)

Does file exist?

LLVM_ABI bool equivalent(file_status A, file_status B)

Do file_status's represent the same thing?

LLVM_ABI bool is_absolute(const Twine &path, Style style=Style::native)

Is path absolute?

LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")

Append to path.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")

SplitString - Split up the specified string according to the specified delimiters,...

bool any_of(R &&range, UnaryPredicate P)

Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.