[llvm-commits] [llvm] r103652 - /llvm/trunk/utils/lit/lit/ShUtil.py

Daniel Dunbar daniel at zuster.org
Wed May 12 14:47:58 PDT 2010


Author: ddunbar
Date: Wed May 12 16:47:58 2010
New Revision: 103652

URL: http://llvm.org/viewvc/llvm-project?rev=103652&view=rev
Log:
lit: Fix a sh lexing bug which caused annotate-token.m to fail when run with the
internal shell parser; we weren't lexing the quotes in a command like::

  clang -DFOO='hello'

correctly.

Modified:
    llvm/trunk/utils/lit/lit/ShUtil.py

Modified: llvm/trunk/utils/lit/lit/ShUtil.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShUtil.py?rev=103652&r1=103651&r2=103652&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/ShUtil.py (original)
+++ llvm/trunk/utils/lit/lit/ShUtil.py Wed May 12 16:47:58 2010
@@ -67,6 +67,9 @@
             elif c == '"':
                 self.eat()
                 str += self.lex_arg_quoted('"')
+            elif c == "'":
+                self.eat()
+                str += self.lex_arg_quoted("'")
             elif not self.win32Escapes and c == '\\':
                 # Outside of a string, '\\' escapes everything.
                 self.eat()
@@ -287,6 +290,10 @@
                          Pipeline([Command(['echo', 'hello'], [])], False))
         self.assertEqual(self.parse('echo ""'),
                          Pipeline([Command(['echo', ''], [])], False))
+        self.assertEqual(self.parse("""echo -DFOO='a'"""),
+                         Pipeline([Command(['echo', '-DFOO=a'], [])], False))
+        self.assertEqual(self.parse('echo -DFOO="a"'),
+                         Pipeline([Command(['echo', '-DFOO=a'], [])], False))
 
     def test_redirection(self):
         self.assertEqual(self.parse('echo hello > c'),





More information about the llvm-commits mailing list