31 auto ReportError = [&](
Twine Msg) {
32 return llvm::make_error<SymbolRemappingParseError>(
38 Line = Line.ltrim(
' ');
40 if (Line.starts_with(
"#") || Line.empty())
44 Line.split(Parts,
' ', -1,
false);
46 if (Parts.
size() != 3)
47 return ReportError(
"Expected 'kind mangled_name mangled_name', "
48 "found '" + Line +
"'");
52 .Case(
"name", FK::Name)
53 .
Case(
"type", FK::Type)
54 .
Case(
"encoding", FK::Encoding)
57 return ReportError(
"Invalid kind, expected 'name', 'type', or 'encoding',"
58 " found '" + Parts[0] +
"'");
61 switch (Canonicalizer.
addEquivalence(*FragmentKind, Parts[1], Parts[2])) {
65 case EE::ManglingAlreadyUsed:
66 return ReportError(
"Manglings '" + Parts[1] +
"' and '" + Parts[2] +
"' "
67 "have both been used in prior remappings. Move this "
68 "remapping earlier in the file.");
70 case EE::InvalidFirstMangling:
71 return ReportError(
"Could not demangle '" + Parts[1] +
"' "
72 "as a <" + Parts[0] +
">; invalid mangling?");
74 case EE::InvalidSecondMangling:
75 return ReportError(
"Could not demangle '" + Parts[2] +
"' "
76 "as a <" + Parts[0] +
">; invalid mangling?");
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
EquivalenceError addEquivalence(FragmentKind Kind, StringRef First, StringRef Second)
Add an equivalence between First and Second.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
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.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Error read(MemoryBuffer &B)
Read remappings from the given buffer, which must live as long as the remapper.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A forward iterator which reads text lines from a buffer.
int64_t line_number() const
Return the current line number. May return any number at EOF.
bool is_at_eof() const
Return true if we've reached EOF or are an "end" iterator.
This is an optimization pass for GlobalISel generic memory operations.