diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-08-21 18:29:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-08-21 18:29:30 +0000 |
commit | 799aacfb27ac51417ad17f4548b9f7743f946e66 (patch) | |
tree | 684550dba3aa27a6d17f35a878101b68e06649e9 /lib | |
parent | 64bfcbbc58ad485db157190496f0f39156b5a516 (diff) | |
download | external_llvm-799aacfb27ac51417ad17f4548b9f7743f946e66.zip external_llvm-799aacfb27ac51417ad17f4548b9f7743f946e66.tar.gz external_llvm-799aacfb27ac51417ad17f4548b9f7743f946e66.tar.bz2 |
Fix macros arguments with an underscore, dot or dollar in them. This is based
on a patch by Andy/PaX. I added the support for dot and dollar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index f723662..240c10b 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1454,6 +1454,14 @@ void AsmParser::DiagHandler(const SMDiagnostic &Diag, void *Context) { NewDiag.print(0, OS); } +// FIXME: This is mostly duplicated from the function in AsmLexer.cpp. The +// difference being that that function accepts '@' as part of identifiers and +// we can't do that. AsmLexer.cpp should probably be changed to handle +// '@' as a special case when needed. +static bool isIdentifierChar(char c) { + return isalnum(c) || c == '_' || c == '$' || c == '.'; +} + bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, const MacroParameters &Parameters, const MacroArguments &A, @@ -1518,7 +1526,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, Pos += 2; } else { unsigned I = Pos + 1; - while (isalnum(Body[I]) && I + 1 != End) + while (isIdentifierChar(Body[I]) && I + 1 != End) ++I; const char *Begin = Body.data() + Pos +1; |