20std::optional<MappedPrefix>
22 auto Equals = JoinedMapping.
find(
'=');
30template <
bool StopOnInval
id,
class StringT>
31static std::optional<StringRef>
34 size_t OriginalSize = Mappings.
size();
36 if (std::optional<MappedPrefix> Split =
43 Mappings.
resize(OriginalSize);
53 "invalid prefix map: '" + *Joined +
"'");
79 ArrayRef<std::pair<std::string, std::string>> Pairs,
81 for (
auto &Pair : Pairs) {
92 return Path.starts_with(Prefix);
94 if (Path.size() < Prefix.size())
98 for (
size_t I = 0,
E = Prefix.size();
I !=
E; ++
I) {
101 if (SepPath != SepPrefix)
111std::optional<StringRef>
123 bool OldEndsWithSeparator =
125 if (!OldEndsWithSeparator &&
129 Storage.
assign(New.begin(), New.end());
138 std::optional<StringRef> Mapped =
mapImpl(Path, NewPath);
139 if (!NewPath.
empty())
144 NewPath.
assign(Mapped->begin(), Mapped->end());
150 std::optional<StringRef> Mapped =
mapImpl(Path, Storage);
151 NewPath = Mapped ? Mapped->str() : Path.str();
152 return Mapped.has_value();
157 std::optional<StringRef> Mapped =
mapImpl(Path, Storage);
158 return Mapped ? Mapped->str() : Path.str();
163 std::optional<StringRef> Mapped =
168 Path.assign(Mapped->begin(), Mapped->end());
176 std::optional<StringRef> Mapped =
mapImpl(Path, Storage);
179 Path.assign(Mapped->begin(), Mapped->size());
186 std::stable_sort(Mappings.begin(), Mappings.end(),
188 return LHS.Old > RHS.Old;
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool startsWith(std::string_view S, std::string_view PrefixA, std::string_view PrefixB, bool A)
static Error makeErrorForInvalidJoin(std::optional< StringRef > Joined)
static std::optional< StringRef > transformJoinedImpl(ArrayRef< StringT > JoinedMappings, SmallVectorImpl< MappedPrefix > &Mappings)
This file defines the SmallString class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
std::string mapToString(StringRef Path) const
Map Path, returning std::string.
virtual std::optional< StringRef > mapImpl(StringRef Path, SmallVectorImpl< char > &Storage) const
Map (or unmap) Path.
bool map(StringRef Path, SmallVectorImpl< char > &NewPath) const
Map Path, and saving the new (or existing) path in NewPath.
bool mapInPlace(SmallVectorImpl< char > &Path) const
Map Path in place.
void sort()
A path-based reverse lexicographic sort, putting deeper paths first so that deeper paths are prioriti...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, ValueParamT Elt)
void swap(SmallVectorImpl &RHS)
void push_back(const T &Elt)
LLVM_NO_SANITIZE_CFI_UNRELATED_CAST iterator begin()
Represent a constant reference to a string, i.e.
static constexpr size_t npos
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
Check if the string is empty.
char back() const
Get the last character in the string.
constexpr size_t size() const
Get the string size.
char front() const
Get the first character in the string.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
constexpr bool is_style_posix(Style S)
Check if S uses POSIX path rules.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
LLVM_ABI bool is_separator(char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
This is an optimization pass for GlobalISel generic memory operations.
char toLower(char x)
Returns the corresponding lowercase character if x is uppercase.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
static LLVM_ABI void transformPairs(ArrayRef< std::pair< std::string, std::string > > Pairs, SmallVectorImpl< MappedPrefix > &Split)
static LLVM_ABI std::optional< MappedPrefix > getFromJoined(StringRef JoinedMapping)
static LLVM_ABI void transformJoinedIfValid(ArrayRef< StringRef > Joined, SmallVectorImpl< MappedPrefix > &Split)
static LLVM_ABI Error transformJoined(ArrayRef< StringRef > Joined, SmallVectorImpl< MappedPrefix > &Split)