diff options
author | Preston Gurd <preston.gurd@intel.com> | 2012-09-19 20:36:12 +0000 |
---|---|---|
committer | Preston Gurd <preston.gurd@intel.com> | 2012-09-19 20:36:12 +0000 |
commit | 7b6f2034ac355bd3b3cc88960bf8d0e694fe3db4 (patch) | |
tree | 1fbf98d382ccd9fe5d7e82c169df126848015ffc /lib/MC/MCParser/AsmLexer.cpp | |
parent | 4caf5281bf9cbdbc13758a6f2b965b0e9ef233d3 (diff) |
Add support for macro parameters/arguments delimited by spaces,
to improve compatibility with GNU as.
Based on a patch by PaX Team.
Fixed assertion failures on non-Darwin and added additional test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/AsmLexer.cpp')
-rw-r--r-- | lib/MC/MCParser/AsmLexer.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp index c76052d66e..f93f685bf5 100644 --- a/lib/MC/MCParser/AsmLexer.cpp +++ b/lib/MC/MCParser/AsmLexer.cpp @@ -396,8 +396,17 @@ AsmToken AsmLexer::LexToken() { case 0: case ' ': case '\t': - // Ignore whitespace. - return LexToken(); + if (SkipSpace) { + // Ignore whitespace. + return LexToken(); + } else { + int len = 1; + while (*CurPtr==' ' || *CurPtr=='\t') { + CurPtr++; + len++; + } + return AsmToken(AsmToken::Space, StringRef(TokStart, len)); + } case '\n': // FALL THROUGH. case '\r': isAtStartOfLine = true; |