78 return Sym.starts_with(
"@") ||
Sym.contains(
"@@") ||
Sym.starts_with(
"?") ||
79 (!MingwDef &&
Sym.contains(
'@'));
130 return Token(K, Word);
142 : Lex(S), Machine(M), MingwDef(
B), AddUnderscores(AU) {
144 AddUnderscores =
false;
149 if (
Error Err = parseOne())
150 return std::move(Err);
151 }
while (Tok.
K !=
Eof);
179 void unget() { Stack.push_back(Tok); }
193 if (
Error Err = parseExport())
226 Error parseExport() {
228 E.Name = std::string(Tok.
Value);
235 E.Name = std::string(Tok.
Value);
240 if (AddUnderscores) {
242 E.Name = (std::string(
"_").append(E.Name));
243 if (!E.ExtName.empty() && !
isDecorated(E.ExtName, MingwDef))
244 E.ExtName = (std::string(
"_").append(E.ExtName));
250 if (Tok.
Value ==
"@") {
284 E.ImportName = std::string(Tok.
Value);
292 "unexpected end of file, EXPORTAS identifier expected");
293 E.ExportAs = std::string(Tok.
Value);
304 if (
Error Err = readAsInt(Reserve))
312 if (
Error Err = readAsInt(Commit))
321 *Out = std::string(Tok.
Value);
329 if (
Error Err = expect(
Equal,
"'=' expected"))
331 if (
Error Err = readAsInt(Baseaddr))
351 else if (
V2.getAsInteger(10, *Minor))
358 std::vector<Token> Stack;
360 COFFModuleDefinition Info;
368 bool AddUnderscores) {
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
COFF::MachineTypes Machine
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.
Tagged union holding either a T or a Error.
StringRef getBuffer() const
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
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
empty - Check if the string is empty.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
static constexpr size_t npos
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
LLVM Value Representation.
Parser(StringRef S, MachineTypes M, bool B, bool AU)
Expected< COFFModuleDefinition > parse()
@ IMAGE_FILE_MACHINE_I386
Error createError(const Twine &Err)
Expected< COFFModuleDefinition > parseCOFFModuleDefinition(MemoryBufferRef MB, COFF::MachineTypes Machine, bool MingwDef=false, bool AddUnderscores=true)
static bool isDecorated(StringRef Sym, bool MingwDef)
bool has_extension(const Twine &path, Style style=Style::native)
Has extension?
This is an optimization pass for GlobalISel generic memory operations.
uint32_t MajorImageVersion
uint32_t MinorImageVersion
std::vector< COFFShortExport > Exports
Token(Kind T=Unknown, StringRef S="")