@@ -96,6 +96,10 @@ class COFFAsmParser : public MCAsmParserExtension {
9696 " .seh_startepilogue" );
9797 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndEpilog>(
9898 " .seh_endepilogue" );
99+ addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveUnwindV2Start>(
100+ " .seh_unwindv2start" );
101+ addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveUnwindVersion>(
102+ " .seh_unwindversion" );
99103 }
100104
101105 bool parseSectionDirectiveText (StringRef, SMLoc) {
@@ -147,6 +151,8 @@ class COFFAsmParser : public MCAsmParserExtension {
147151 bool parseSEHDirectiveEndProlog (StringRef, SMLoc);
148152 bool ParseSEHDirectiveBeginEpilog (StringRef, SMLoc);
149153 bool ParseSEHDirectiveEndEpilog (StringRef, SMLoc);
154+ bool ParseSEHDirectiveUnwindV2Start (StringRef, SMLoc);
155+ bool ParseSEHDirectiveUnwindVersion (StringRef, SMLoc);
150156
151157 bool parseAtUnwindOrAtExcept (bool &unwind, bool &except);
152158 bool parseDirectiveSymbolAttribute (StringRef Directive, SMLoc);
@@ -774,6 +780,28 @@ bool COFFAsmParser::ParseSEHDirectiveEndEpilog(StringRef, SMLoc Loc) {
774780 return false ;
775781}
776782
783+ bool COFFAsmParser::ParseSEHDirectiveUnwindV2Start (StringRef, SMLoc Loc) {
784+ Lex ();
785+ getStreamer ().emitWinCFIUnwindV2Start (Loc);
786+ return false ;
787+ }
788+
789+ bool COFFAsmParser::ParseSEHDirectiveUnwindVersion (StringRef, SMLoc Loc) {
790+ int64_t Version;
791+ if (getParser ().parseIntToken (Version, " expected unwind version number" ))
792+ return true ;
793+
794+ if ((Version < 1 ) || (Version > UINT8_MAX))
795+ return Error (Loc, " invalid unwind version" );
796+
797+ if (getLexer ().isNot (AsmToken::EndOfStatement))
798+ return TokError (" unexpected token in directive" );
799+
800+ Lex ();
801+ getStreamer ().emitWinCFIUnwindVersion (Version, Loc);
802+ return false ;
803+ }
804+
777805bool COFFAsmParser::parseAtUnwindOrAtExcept (bool &unwind, bool &except) {
778806 StringRef identifier;
779807 if (getLexer ().isNot (AsmToken::At) && getLexer ().isNot (AsmToken::Percent))
0 commit comments