#include <SkSLMangler.h>
Definition at line 18 of file SkSLMangler.h.
◆ reset()
void SkSL::Mangler::reset |
( |
| ) |
|
|
inline |
◆ uniqueName()
std::string SkSL::Mangler::uniqueName |
( |
std::string_view |
baseName, |
|
|
SymbolTable * |
symbolTable |
|
) |
| |
Mangles baseName to create a name that is unique within symbolTable.
Definition at line 21 of file SkSLMangler.cpp.
21 {
23
24
26 baseName.remove_prefix(1);
27 }
28
29
30
32
34 while (isdigit(baseName[
offset])) {
36 }
37
38
40 baseName.remove_prefix(
offset + 1);
41 } else {
42
43
44
45 baseName.remove_prefix(1);
46 }
47 }
48
49
50
51
52
53
57 for (;;) {
58
60
61
62 *endPtr++ = '_';
63
64
65 int baseNameCopyLength = std::min<int>(baseName.size(), uniqueNameEnd - endPtr);
66 memcpy(endPtr, baseName.data(), baseNameCopyLength);
67 endPtr += baseNameCopyLength;
68
70 if (symbolTable->find(uniqueNameView) == nullptr) {
71 return std::string(uniqueNameView);
72 }
73 }
74}
char * SkStrAppendS32(char buffer[], int32_t)
std::string uniqueName(std::string_view baseName, SymbolTable *symbolTable)
constexpr bool starts_with(std::string_view str, std::string_view prefix)
The documentation for this class was generated from the following files: