Created attachment 16028
Preprocessor tricky code
The preprocessor is tricked to insert an extra space during macro expansion in
the following code:
// clang -E asm.S -o -
#define CONCAT(a,b) a##b
#define XMM(i) CONCAT(%xmm, i)
.macro foo n
x = XMM(\n)
.endm
Instead of emitting '%xmm\n' it emits '%xmm \n'.
Even weird if one define 'XMM(i)' as 'CONCAT(%xmm,i)' without a leading space
on 'i' it emits '%xmm\n'.
At least I dont expect such a change impact on codegen.
The line that triggers it is:
// https://github.com/llvm-mirror/clang/blob/master/lib/Lex/TokenLexer.cpp#L186
...
if (i != 0 && !Tokens[i-1].is(tok::hashhash) && CurTok.hasLeadingSpace())
NextTokGetsSpace = true;
...
asm.S
(157 bytes, text/x-asm)