@@ -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);
@@ -767,6 +773,28 @@ bool COFFAsmParser::ParseSEHDirectiveEndEpilog(StringRef, SMLoc Loc) {
767773 return false ;
768774}
769775
776+ bool COFFAsmParser::ParseSEHDirectiveUnwindV2Start (StringRef, SMLoc Loc) {
777+ Lex ();
778+ getStreamer ().emitWinCFIUnwindV2Start (Loc);
779+ return false ;
780+ }
781+
782+ bool COFFAsmParser::ParseSEHDirectiveUnwindVersion (StringRef, SMLoc Loc) {
783+ int64_t Version;
784+ if (getParser ().parseIntToken (Version, " expected unwind version number" ))
785+ return true ;
786+
787+ if ((Version < 1 ) || (Version > UINT8_MAX))
788+ return Error (Loc, " invalid unwind version" );
789+
790+ if (getLexer ().isNot (AsmToken::EndOfStatement))
791+ return TokError (" unexpected token in directive" );
792+
793+ Lex ();
794+ getStreamer ().emitWinCFIUnwindVersion (Version, Loc);
795+ return false ;
796+ }
797+
770798bool COFFAsmParser::parseAtUnwindOrAtExcept (bool &unwind, bool &except) {
771799 StringRef identifier;
772800 if (getLexer ().isNot (AsmToken::At) && getLexer ().isNot (AsmToken::Percent))
0 commit comments