[PATCH] Mimic MSVC whitespace collapse for incompatible token pasting

Will Wilson will at indefiant.com
Fri Apr 10 12:45:31 PDT 2015


Hi Reid,

Attached is a patch to handle a corner case supported by MSVC. I decided to
attempt to workaround the behaviour in clang after encountering it in
public MS headers for XAudio where clang would fail to generate a valid
UUID due to the UUID components being combined with the '-' UUID
separators. Clang was attempting to recover but would preserve the leading
whitespace from the tokens after each failed paste leading to spaces
creeping into the UUID and causing an error in the __declspace(uuid())
parsing.

Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51)

Test case included and tested against latest trunk.

Let me know if it looks acceptable!

Cheers,
Will.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150410/f625a3b5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ms_paste_space_collapse.patch
Type: application/octet-stream
Size: 1354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150410/f625a3b5/attachment.obj>


More information about the cfe-commits mailing list