[llvm-commits] [llvm] r110692 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/macros.s

Daniel Dunbar daniel at zuster.org
Tue Aug 10 10:38:52 PDT 2010


Author: ddunbar
Date: Tue Aug 10 12:38:52 2010
New Revision: 110692

URL: http://llvm.org/viewvc/llvm-project?rev=110692&view=rev
Log:
MC/AsmParser: Fix a bug in macro argument parsing, which was dropping
parentheses from argument lists.

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

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=110692&r1=110691&r2=110692&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Aug 10 12:38:52 2010
@@ -1032,12 +1032,14 @@
     // list.
     if (ParenLevel == 0 && Lexer.is(AsmToken::Comma)) {
       MacroArguments.push_back(std::vector<AsmToken>());
-    } else if (Lexer.is(AsmToken::LParen)) {
-      ++ParenLevel;
-    } else if (Lexer.is(AsmToken::RParen)) {
-      if (ParenLevel)
-        --ParenLevel;
     } else {
+      // Adjust the current parentheses level.
+      if (Lexer.is(AsmToken::LParen))
+        ++ParenLevel;
+      else if (Lexer.is(AsmToken::RParen) && ParenLevel)
+        --ParenLevel;
+
+      // Append the token to the current argument list.
       MacroArguments.back().push_back(getTok());
     }
     Lex();

Modified: llvm/trunk/test/MC/AsmParser/macros.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/macros.s?rev=110692&r1=110691&r2=110692&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/macros.s (original)
+++ llvm/trunk/test/MC/AsmParser/macros.s Tue Aug 10 12:38:52 2010
@@ -30,3 +30,10 @@
 
 // CHECK: .globl	"1 23  $3 2"
 test3 1,2 3
+
+.macro test4
+.globl "$0 -- $1"
+.endmacro
+
+// CHECK: .globl	"ab)(,) -- (cd)"
+test4 a b)(,),(cd)





More information about the llvm-commits mailing list