[PATCH] D131522: [ms] [llvm-ml] Add support for nested PROC/ENDP pairs
Eric Astor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 9 14:14:54 PDT 2022
epastor created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
epastor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is believed to match behavior by ML.EXE and ML64.EXE.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131522
Files:
llvm/lib/MC/MCParser/COFFMasmParser.cpp
Index: llvm/lib/MC/MCParser/COFFMasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/COFFMasmParser.cpp
+++ llvm/lib/MC/MCParser/COFFMasmParser.cpp
@@ -204,8 +204,9 @@
SectionKind::getBSS());
}
- StringRef CurrentProcedure;
- bool CurrentProcedureFramed;
+ /// Stack of active procedure definitions.
+ SmallVector<StringRef, 1> CurrentProcedures;
+ SmallVector<bool, 1> CurrentProceduresFramed;
public:
COFFMasmParser() = default;
@@ -340,8 +341,8 @@
}
getStreamer().emitLabel(Sym, Loc);
- CurrentProcedure = Label;
- CurrentProcedureFramed = Framed;
+ CurrentProcedures.push_back(Label);
+ CurrentProceduresFramed.push_back(Framed);
return false;
}
bool COFFMasmParser::ParseDirectiveEndProc(StringRef Directive, SMLoc Loc) {
@@ -350,17 +351,17 @@
if (getParser().parseIdentifier(Label))
return Error(LabelLoc, "expected identifier for procedure end");
- if (CurrentProcedure.empty())
+ if (CurrentProcedures.empty())
return Error(Loc, "endp outside of procedure block");
- else if (CurrentProcedure != Label)
+ else if (CurrentProcedures.back() != Label)
return Error(LabelLoc, "endp does not match current procedure '" +
- CurrentProcedure + "'");
+ CurrentProcedures.back() + "'");
- if (CurrentProcedureFramed) {
+ if (CurrentProceduresFramed.back()) {
getStreamer().emitWinCFIEndProc(Loc);
}
- CurrentProcedure = "";
- CurrentProcedureFramed = false;
+ CurrentProcedures.pop_back();
+ CurrentProceduresFramed.pop_back();
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131522.451269.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220809/694a6139/attachment.bin>
More information about the llvm-commits
mailing list