LLVM: lib/DebugInfo/LogicalView/Core/LVSupport.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

15

16using namespace llvm;

18

19#define DEBUG_TYPE "Support"

20

21namespace {

22

24}

26

27

28

29

30

32 std::string Name(Path);

35

36

37 size_t Pos = 0;

38 while ((Pos = Name.find("//", Pos)) != std:🧵:npos)

39 Name.erase(Pos, 1);

40

42}

43

44

45

46

47

49 std::string Name(Path);

51

52 const char *CharSet = "/\\<>.:%*?|\" ";

58 };

60}

61

64

66 if (Name.empty())

67 return {};

68

69 size_t AngleCount = 0;

70 size_t ColonSeen = 0;

71 size_t Current = 0;

72

74

75#ifndef NDEBUG

76 auto PrintLexicalEntry = [&]() {

79 "'{0}:{1}', '{2}'\n", Entry.first, Entry.second,

80 Name.substr(Entry.first, Entry.second - Entry.first + 1));

81 };

82#endif

83

85 for (size_t Index = 0; Index < Length; ++Index) {

89 });

90 switch (Name[Index]) {

91 case '<':

92 ++AngleCount;

93 break;

94 case '>':

95 --AngleCount;

96 break;

97 case ':':

98 ++ColonSeen;

99 break;

100 }

101 if (ColonSeen == 2) {

102 if (!AngleCount) {

104 Current = Index + 1;

105 LLVM_DEBUG({ PrintLexicalEntry(); });

106 }

107 ColonSeen = 0;

108 continue;

109 }

110 }

111

112

114 LLVM_DEBUG({ PrintLexicalEntry(); });

115 return Indexes;

116}

117

119 if (Name.empty())

120 return {};

121

123 if (Indexes.size() == 1)

125

129 Name.substr(BeginEntry.first, EndEntry.second - BeginEntry.first + 1);

130

134

135 return std::make_tuple(Outer, Inner);

136}

137

139 if (Name.empty())

140 return {};

141

145 Components.push_back(

146 Name.substr(Entry.first, Entry.second - Entry.first + 1));

147

148 return Components;

149}

150

153 if (Components.empty())

154 return {};

155 std::string Name(BaseName);

157 if (BaseName.size())

158 Stream << "::";

159 Stream << Components[0];

160 for (LVStringRefs::size_type Index = 1; Index < Components.size(); ++Index)

161 Stream << "::" << Components[Index];

163}

static LexicalIndexes getAllLexicalIndexes(StringRef Name)

Definition LVSupport.cpp:65

SmallVector< LexicalEntry, 10 > LexicalIndexes

Definition LVSupport.cpp:63

std::pair< size_t, size_t > LexicalEntry

Definition LVSupport.cpp:62

The Input class is used to parse a yaml document into in-memory structs and vectors.

void push_back(const T &Elt)

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.

constexpr size_t size() const

size - Get the string size.

A raw_ostream that writes to an std::string.

LLVM_ABI LVStringPool & getStringPool()

Definition LVSupport.cpp:25

LLVM_ABI LVStringRefs getAllLexicalComponents(StringRef Name)

Definition LVSupport.cpp:138

std::vector< StringRef > LVStringRefs

LLVM_ABI std::string transformPath(StringRef Path)

Definition LVSupport.cpp:31

LLVM_ABI LVLexicalComponent getInnerComponent(StringRef Name)

Definition LVSupport.cpp:118

std::tuple< StringRef, StringRef > LVLexicalComponent

LLVM_ABI std::string flattenedFilePath(StringRef Path)

Definition LVSupport.cpp:48

LLVM_ABI std::string getScopedName(const LVStringRefs &Components, StringRef BaseName={})

Definition LVSupport.cpp:151

This is an optimization pass for GlobalISel generic memory operations.

OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)

Wrapper function around std::transform to apply a function to a range and store the result elsewhere.

auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

void replace(R &&Range, const T &OldValue, const T &NewValue)

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