From 47268164f3d660f6357cc3a59d510efe3bc9152f Mon Sep 17 00:00:00 2001 From: Charles Davis Date: Wed, 25 May 2011 04:08:15 +0000 Subject: [PATCH] Add a test for .seh_pushframe parsing. Fix the bug exposed by it (and another one I found by inspection). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132037 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/COFFAsmParser.cpp | 15 +++++++++------ test/MC/AsmParser/directive_seh.s | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/MC/MCParser/COFFAsmParser.cpp b/lib/MC/MCParser/COFFAsmParser.cpp index fa7ae5cf148..540df377bbd 100644 --- a/lib/MC/MCParser/COFFAsmParser.cpp +++ b/lib/MC/MCParser/COFFAsmParser.cpp @@ -343,13 +343,16 @@ bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc L) { } bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) { - bool Code; + bool Code = false; StringRef CodeID; - SMLoc startLoc = getLexer().getLoc(); - if (!getParser().ParseIdentifier(CodeID)) { - if (CodeID != "@code") - return Error(startLoc, "expected @code"); - Code = true; + if (getLexer().is(AsmToken::At)) { + SMLoc startLoc = getLexer().getLoc(); + Lex(); + if (!getParser().ParseIdentifier(CodeID)) { + if (CodeID != "code") + return Error(startLoc, "expected @code"); + Code = true; + } } if (getLexer().isNot(AsmToken::EndOfStatement)) diff --git a/test/MC/AsmParser/directive_seh.s b/test/MC/AsmParser/directive_seh.s index 7111fcc6b20..e14be4367ae 100644 --- a/test/MC/AsmParser/directive_seh.s +++ b/test/MC/AsmParser/directive_seh.s @@ -1,6 +1,7 @@ # RUN: llvm-mc -triple x86_64-pc-win32 %s | FileCheck %s # CHECK: .seh_proc func +# CHECK: .seh_pushframe @code # CHECK: .seh_stackalloc 24 # CHECK: .seh_endprologue # CHECK: .seh_handler __C_specific_handler, @except @@ -11,6 +12,7 @@ .def func; .scl 2; .type 32; .endef .seh_proc func func: + .seh_pushframe @code subq $24, %rsp .seh_stackalloc 24 .seh_endprologue -- 2.34.1