[patch] Let ms inline asm understand using statements and record names in addition to typedefs
Nico Weber
thakis at chromium.org
Mon May 5 20:20:43 PDT 2014
r208053, thanks!
On Mon, May 5, 2014 at 2:30 PM, Reid Kleckner <rnk at google.com> wrote:
> LGTM
>
> I looked at this once before, but I thought MSVC only supported lookup
> through typedefs. Turns out I was wrong. MSVC doesn't accept your test
> case, but they do accept:
>
> struct A {
> int a;
> int b;
> };
> int foo(A *a) {
> __asm {
> mov eax, a
> mov eax, [eax]A.b
> }
> }
>
>
> On Sat, May 3, 2014 at 5:26 PM, Nico Weber <thakis at chromium.org> wrote:
>>
>> Hi,
>>
>> while looking at something else, I learned that with -fasm-blocks,
>> clang understands
>>
>> typedef struct {
>> int a;
>> int b;
>> } A;
>> __asm mov eax, [eax].A.b
>>
>> It only supports typedefs though, not the same thing with `using A =
>> struct { ... };`, and also not the direct `struct A { ... }`. This
>> seems inconsistent, so the attached patch adds support for that. I
>> don't know if adding such support is useful or desirable, but since I
>> already wrote the 4 lines to make it work I figured I could at least
>> send out the patch :-)
>>
>> Nico
>>
>> ps: Fun fact: With s/struct/class/ in the snippet above, clang does
>> print "error: 'b' is a private member of 'A'" (yay!) but does so
>> without a source location (boo!, but understandable I suppose.)
>
>
More information about the cfe-commits
mailing list