aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp')
-rw-r--r--contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp b/contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp
index d0673c2a44..0c255ef02d 100644
--- a/contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp
+++ b/contrib/libs/llvm12/lib/MC/MCParser/WasmAsmParser.cpp
@@ -90,44 +90,44 @@ public:
return false;
}
- bool parseSectionFlags(StringRef FlagStr, bool &Passive, bool &Group) {
- for (char C : FlagStr) {
- switch (C) {
- case 'p':
+ bool parseSectionFlags(StringRef FlagStr, bool &Passive, bool &Group) {
+ for (char C : FlagStr) {
+ switch (C) {
+ case 'p':
Passive = true;
- break;
- case 'G':
- Group = true;
- break;
- default:
- return Parser->Error(getTok().getLoc(),
- StringRef("Unexepcted section flag: ") + FlagStr);
- }
+ break;
+ case 'G':
+ Group = true;
+ break;
+ default:
+ return Parser->Error(getTok().getLoc(),
+ StringRef("Unexepcted section flag: ") + FlagStr);
+ }
+ }
+ return false;
+ }
+
+ bool parseGroup(StringRef &GroupName) {
+ if (Lexer->isNot(AsmToken::Comma))
+ return TokError("expected group name");
+ Lex();
+ if (Lexer->is(AsmToken::Integer)) {
+ GroupName = getTok().getString();
+ Lex();
+ } else if (Parser->parseIdentifier(GroupName)) {
+ return TokError("invalid group name");
+ }
+ if (Lexer->is(AsmToken::Comma)) {
+ Lex();
+ StringRef Linkage;
+ if (Parser->parseIdentifier(Linkage))
+ return TokError("invalid linkage");
+ if (Linkage != "comdat")
+ return TokError("Linkage must be 'comdat'");
}
return false;
}
- bool parseGroup(StringRef &GroupName) {
- if (Lexer->isNot(AsmToken::Comma))
- return TokError("expected group name");
- Lex();
- if (Lexer->is(AsmToken::Integer)) {
- GroupName = getTok().getString();
- Lex();
- } else if (Parser->parseIdentifier(GroupName)) {
- return TokError("invalid group name");
- }
- if (Lexer->is(AsmToken::Comma)) {
- Lex();
- StringRef Linkage;
- if (Parser->parseIdentifier(Linkage))
- return TokError("invalid linkage");
- if (Linkage != "comdat")
- return TokError("Linkage must be 'comdat'");
- }
- return false;
- }
-
bool parseSectionDirective(StringRef, SMLoc) {
StringRef Name;
if (Parser->parseIdentifier(Name))
@@ -141,8 +141,8 @@ public:
auto Kind = StringSwitch<Optional<SectionKind>>(Name)
.StartsWith(".data", SectionKind::getData())
- .StartsWith(".tdata", SectionKind::getThreadData())
- .StartsWith(".tbss", SectionKind::getThreadBSS())
+ .StartsWith(".tdata", SectionKind::getThreadData())
+ .StartsWith(".tbss", SectionKind::getThreadBSS())
.StartsWith(".rodata", SectionKind::getReadOnly())
.StartsWith(".text", SectionKind::getText())
.StartsWith(".custom_section", SectionKind::getMetadata())
@@ -158,30 +158,30 @@ public:
// Update section flags if present in this .section directive
bool Passive = false;
- bool Group = false;
- if (parseSectionFlags(getTok().getStringContents(), Passive, Group))
+ bool Group = false;
+ if (parseSectionFlags(getTok().getStringContents(), Passive, Group))
+ return true;
+
+ Lex();
+
+ if (expect(AsmToken::Comma, ",") || expect(AsmToken::At, "@"))
+ return true;
+
+ StringRef GroupName;
+ if (Group && parseGroup(GroupName))
+ return true;
+
+ if (expect(AsmToken::EndOfStatement, "eol"))
return true;
- Lex();
-
- if (expect(AsmToken::Comma, ",") || expect(AsmToken::At, "@"))
- return true;
-
- StringRef GroupName;
- if (Group && parseGroup(GroupName))
- return true;
-
- if (expect(AsmToken::EndOfStatement, "eol"))
- return true;
-
- // TODO: Parse UniqueID
- MCSectionWasm *WS = getContext().getWasmSection(
- Name, Kind.getValue(), GroupName, MCContext::GenericSectionID);
+ // TODO: Parse UniqueID
+ MCSectionWasm *WS = getContext().getWasmSection(
+ Name, Kind.getValue(), GroupName, MCContext::GenericSectionID);
if (Passive) {
- if (!WS->isWasmData())
+ if (!WS->isWasmData())
return Parser->Error(getTok().getLoc(),
"Only data sections can be passive");
- WS->setPassive();
+ WS->setPassive();
}
getStreamer().SwitchSection(WS);
return false;
@@ -221,13 +221,13 @@ public:
Lexer->is(AsmToken::Identifier)))
return error("Expected label,@type declaration, got: ", Lexer->getTok());
auto TypeName = Lexer->getTok().getString();
- if (TypeName == "function") {
+ if (TypeName == "function") {
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
- auto *Current =
- cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
- if (Current->getGroup())
- WasmSym->setComdat(true);
- } else if (TypeName == "global")
+ auto *Current =
+ cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
+ if (Current->getGroup())
+ WasmSym->setComdat(true);
+ } else if (TypeName == "global")
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL);
else if (TypeName == "object")
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_DATA);