[cfe-dev] libclang crash when parsing MS-style inline assembly

Alp Toker alp at nuanti.com
Sat Nov 9 01:49:56 PST 2013


On 09/11/2013 09:23, Kim Gräsman wrote:
> On Sat, Nov 9, 2013 at 10:10 AM, Kim Gräsman <kim.grasman at gmail.com> wrote:
>> On Fri, Nov 8, 2013 at 8:52 PM, Reid Kleckner <rnk at google.com> wrote:
>>> Muahahaha:
>>>
>>> // foo.h
>>> struct Foo {
>>>   static const int x = 20;
>>> };
>>> // foo.cc
>>> int main() {
>>>   int r;
>>>   __asm {
>>>     mov ecx, Foo::x
>>>     mov r, ecx
>>>   };
>>>   return r;
>>> }
>>>
>>> Seems like a use that is relevant to IWYU.  :)
>> Count on compiler developers to prove me wrong :-)
>>
>> Patches most welcome!
> Actually, it turns out this already works in IWYU.
>
> So we'll just keep the InitializeNativeTarget* calls in main(), and
> life is good!

Good on x86, not so good when cross-compiling (cross-IWYUing?) from a
non-Intel architecture. The snippet I gave handles that as long as an
x86 target has been built in FWIW.

Alp.



>
> - Kim

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list