LLVM: include/llvm/DWARFLinker/Utils.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_DWARFLINKER_UTILS_H

10#define LLVM_DWARFLINKER_UTILS_H

11

17

18namespace llvm {

20

21

22

23

24

25

27 size_t MaxCounter = 100000) {

28 size_t iterationsCounter = 0;

29 while (iterationsCounter++ < MaxCounter) {

31 if (!IterationResultOrError)

32 return IterationResultOrError.takeError();

33 if (!IterationResultOrError.get())

35 }

36 return createStringError(std::errc::invalid_argument, "Infinite recursion");

37}

38

39

40

42

45 if (it == end || !it->ends_with(".sdk"))

46 return {};

47 ++it;

48

49 if (it == end || *it != "SDKs")

50 return {};

51 auto developerEnd = it;

52 ++it;

53 while (it != end) {

54

55 if (*it != "Developer")

56 return {};

57 ++it;

58 if (it == end)

59 return {};

60 if (*it == "Contents")

63

64 if (!it->ends_with(".platform"))

65 return {};

66 ++it;

67

68 if (it == end || *it != "Platforms")

69 return {};

70 developerEnd = it;

71 ++it;

72 }

73 return {};

74}

75

76

78

80 it != end; ++it) {

81 if (it->ends_with(".xctoolchain")) {

82 ++it;

83 if (it == end)

84 return false;

85 if (*it != "Toolchains")

86 return false;

87 ++it;

88 if (it == end)

89 return false;

90 if (*it != "Developer")

91 return false;

92 return true;

93 }

94 }

95 return false;

96}

97

105

106}

107}

108

109#endif

This file defines the SmallString class.

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Tagged union holding either a T or a Error.

Error takeError()

Take ownership of the stored error.

reference get()

Returns a reference to the stored T value.

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

constexpr const char * data() const

data - Get a pointer to the start of the string (which may not be null terminated).

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

An efficient, type-erasing, non-owning reference to a callable.

StringRef guessDeveloperDir(StringRef SysRoot)

Make a best effort to guess the Xcode.app/Contents/Developer path from an SDK path.

Definition Utils.h:41

bool isInToolchainDir(StringRef Path)

Make a best effort to determine whether Path is inside a toolchain.

Definition Utils.h:77

Error finiteLoop(function_ref< Expected< bool >()> Iteration, size_t MaxCounter=100000)

This function calls Iteration() until it returns false.

Definition Utils.h:26

bool isPathAbsoluteOnWindowsOrPosix(const Twine &Path)

Definition Utils.h:98

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

Is path absolute?

LLVM_ABI reverse_iterator rend(StringRef path LLVM_LIFETIME_BOUND)

Get reverse end iterator over path.

LLVM_ABI reverse_iterator rbegin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get reverse begin iterator over path.

This is an optimization pass for GlobalISel generic memory operations.

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.