[llvm-commits] [llvm] r132037 - in /llvm/trunk: lib/MC/MCParser/COFFAsmParser.cpp test/MC/AsmParser/directive_seh.s

Charles Davis cdavis at mines.edu
Tue May 24 21:08:15 PDT 2011


Author: cdavis
Date: Tue May 24 23:08:15 2011
New Revision: 132037

URL: http://llvm.org/viewvc/llvm-project?rev=132037&view=rev
Log:
Add a test for .seh_pushframe parsing. Fix the bug exposed by it (and another
one I found by inspection).

Modified:
    llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
    llvm/trunk/test/MC/AsmParser/directive_seh.s

Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp?rev=132037&r1=132036&r2=132037&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Tue May 24 23:08:15 2011
@@ -343,13 +343,16 @@
 }
 
 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))

Modified: llvm/trunk/test/MC/AsmParser/directive_seh.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_seh.s?rev=132037&r1=132036&r2=132037&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_seh.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_seh.s Tue May 24 23:08:15 2011
@@ -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





More information about the llvm-commits mailing list