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

Kim Gräsman kim.grasman at gmail.com
Sat Nov 9 01:10:50 PST 2013


On Fri, Nov 8, 2013 at 8:52 PM, Reid Kleckner <rnk at google.com> wrote:
> On Fri, Nov 8, 2013 at 1:12 AM, Kim Gräsman <kim.grasman at gmail.com> wrote:
>>
>> Hi Alp,
>>
>> On Fri, Nov 8, 2013 at 8:01 AM, Alp Toker <alp at nuanti.com> wrote:
>> >
>> > Now that we've dealt with the underlying crash, we can start to look at
>> > how to handle this cleanly.
>> >
>> > I'd like to understand your requirements first..
>> >
>> > For your use cases, would it be acceptable to skip over the MS inline
>> > assembly without parsing it, ie. having a special mode that turns this
>> > into a soft error in parse-only tools?
>>
>> For me, I think so.
>>
>> We ran into this in IWYU [1], and I don't think inline assembly would
>> introduce a "use" of any significance...
>
>
> 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!

- Kim




More information about the cfe-dev mailing list