Feedback requested on MS compatibility work (bug 11789)

I'm working on bug 11789, which is a MS compatibility bug. I'm a new developer to the clang project, so I could really use some guidance. Here's the background on what I'm doing:

MSVC does some wacky things to make __FUNCTION__ act as if it were a macro like __FILE__, rather than a predefined expression. In particular, when pasting L##__FUNCTION__, it results in a wide string literal equivalent to __FUNCTION__, rather than the identifier L__FUNCTION__. Here's an example of what needs to happen in the preprocessor:

#define __STR2WSTR(str) L##str
#define _STR2WSTR(str) __STR2WSTR(str)
// Expands to __LPREFIX( __FUNCTION__)
// Expands to L__FUNCTION__

#define __FOO_PREFIX(str) FOO##str
#define _FOO_PREFIX(str) __FOO_PREFIX(str)
// Expands to FOO__FSTREXP __FUNCTION__
// Expands to FOO__FUNCTION__

#define __FOO_SUFFIX(str) str##FOO
#define _FOO_SUFFIX(str) __FOO_SUFFIX(str)
// Expands to __FUNCTION__ FOO (note the leading space before __FUNCTION__)
// Expands to __FUNCTION__FOO

So basically, as I see it, there are three rules:
1. L##__FUNCTION__ expands to __LPREFIX( __FUNCTION__)
2. any_token##__FUNCTION__ expands to any_token__FSTREXP __FUNCTION__ . Note __FUNCTION__ gets a space on both sides
3. __FUNCTION__##any_token expands to __FUNCTION__ any_token. Again note the space on both sides.

I've begun writing up the implementation in the preprocessor, without yet worrying about implementing the __LPREFIX and FSTREXP weirdness in the frontend. However, there's one complication that my implementation isn't getting right: __FUNCTION__ is supposed to follow the rules for macro expansion -- note how "__STR2WSTR(__FUNCTION__)" just expands to "L__FUNCTION__". It's as if the first time __FUNCTION__ is expanded, it gets expanded to an identical token, but with some special "expanded" flag set, and then once the "expanded" __FUNCTION__ is encountered, the special rules apply. In my implementation so far, both "__STR2WSTR(__FUNCTION__)" and "_STR2WSTR(__FUNCTION__)" expand to "__LPREFIX( __FUNCTION__)".

I'm going to attach my patch to show what I've done so far, because maybe I'm totally headed in the wrong direction. I'd appreciate if anybody more familiar with the preprocessor might be able to point me in the right direction as far as how to handle the two-stage expansion of __FUNCTION__, as well as to generally review my code so far and let me know if it looks reasonable. Thanks very much! My patch is below:

Index: include/clang/Basic/TokenKinds.def