Hello, I've noticed a following strange behavior: clang-3.2 fails to compile/parse any assembly code that invokes macros which named arguments contains non alphanumeric characters. For example, compilation of the following code snippet would fail with "Parameter not found" error: .macro mov_macro reg_1, reg_2 movl %\reg_1, %\reg_2 .endm mov_macro eax, ebx Although, if one removes underscores from mov_macro argument names, compilation would succeed. Such behavior is due to the glitch in AsmParser::expandMacro() logic: it treats first non-alphanumeric character as the end of argument instantiation token. Following patch fixes the issue (IsIdentifierChar routine implementation was borrowed from lib/MC/MCParser/AsmLexer.cpp): ==================================================================--- lib/MC/MCParser/AsmParser.cpp (revision 157279) +++ lib/MC/MCParser/AsmParser.cpp (working copy) @@ -1436,6 +1436,11 @@ NewDiag.print(0, OS); } +/// LexIdentifier: [a-zA-Z_.][a-zA-Z0-9_$.@]* +static bool IsIdentifierChar(char c) { + return isalnum(c) || c == '_' || c == '$' || c == '.' || c == '@'; +} + bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body, const std::vector<StringRef> &Parameters, const std::vector<std::vector<AsmToken> > &A, @@ -1501,7 +1506,7 @@ 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; ================================================================== Regards, Nikita