[PATCH] IRGen: Add more tests for dll attributes

Nico Rieck nico.rieck at gmail.com
Fri May 23 18:56:59 PDT 2014


On 24.05.2014 03:25, Hans Wennborg wrote:
>> +// Declarations are not exported.
>> +__declspec(dllexport) extern int ExternGlobalDecl;
> 
> Should this have a check line of some sort?

It could use a negative check, but FileCheck lacks a true NOT check.
Current NOT doesn't mix well with DAG. Not sure if that's an issue here,
I'll check.

>> +// MO2-DAG: define weak_odr dllexport void @f()
> 
> This should just be CHECK-DAG, and I suppose we should move it down to
> the "Functions" section.. in fact, it's probably already covered in
> there :)

Indeed, seems to be a left-over.

> [...]
> All the FIXMEs in this file seem to pass now, presumably because of r208925.

You mean r209549 (emitting functions with in-class definitions)? I've
removed the FIXMEs and added some more nested tests.

BTW: The problem solved by r209549 also exists for static data members
with in-class initializer. Previously the loop could just be extended
with a VarDecl check, but it's now invoked for functions only.

>> +// Declarations are not exported.
> 
> Should there be tests here, or is the comment superfluous?

It's just a note, and in the past it was nicer when diffing Sema/IRGen
and dllimport/dllexport tests with each other.

> Should the inline members have tests that check they get
> availablexternally definitions at O1?

Yeah, I'll add them.

>> +  // MSC-DAG: @"\01?StaticField at ImportMembers@@2HA"               = external dllimport global i32
>> +  // MSC-DAG: @"\01?StaticConstField at ImportMembers@@2HB"          = external dllimport constant i32
>> +  // MSC-DAG-FIXME: @"\01?StaticConstFieldEqualInit at ImportMembers@@2HB" = available_externally dllimport constant i32 1, align 4
>> +  // MSC-DAG-FIXME: @"\01?StaticConstFieldBraceInit at ImportMembers@@2HB" = available_externally dllimport constant i32 1, align 4
>> +  // MSC-DAG-FIXME: @"\01?ConstexprField at ImportMembers@@2HB"            = available_externally dllimport constant i32 1, align 4
> 
> Are the FIXMEs here just because we always inline the value of the
> static member?

This currently hits an IR verifier assert because they get linkonce_odr
linkage (that's why the actual member definitions are guarded with
-DMSABI). I have a patch fixing this.

Thanks for checking!

-Nico



More information about the cfe-commits mailing list