erichkeane requested changes to this revision.
erichkeane added a comment.
This revision now requires changes to proceed.

When forming 'diffs', please make sure you do so against the current status of 
Clang.  Your latest diff seems to be only against your first commit, so the 
diff is crazy looking, and also not submit-able.

@aaron.ballman : The purpose of this patch is to allow this to succeed (Zahira, 
please correct me if I'm wrong):

  struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {}; 
  __interface ISfFileIOPropertyPage : public IUnknown {};

Previously, clang's implementation only permitted __interface to inherit from 
public __interfaces.  You can see these examples in 
test/SemaCXX/ms-interface.cpp.

However, our testers discovered that there is an exception to this case:  When 
the base struct/class has attribute "uuid" defined.  Apparently while 
researching, @zahiraam also discovered that EVEN IF the inherited struct/class 
has UUID, any attribute on the __interface makes said inheritance an error.

THAT SAID, in researching this to try to explain this better, I just discovered 
that this diagnosis is actually not correct.  It seems that CL has some 
'special cases' for the inheritence from a struct/class.  For example:

  struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
  __interface ISfFileIOPropertyPage : public IUnknown {};

Correctly compiles in CL.

  class __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
  __interface ISfFileIOPropertyPage : public IUnknown {};

DOES NOT, with the only difference being struct->class.

Additionally,

  struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown2 {};
  __interface ISfFileIOPropertyPage : public IUnknown2 {};
  
  struct __declspec(uuid("00000000-0000-0000-C000-000000000045")) IUnknown {};
  __interface ISfFileIOPropertyPage : public IUnknown {};

Fails in CL, with the only difference being changing the UUID by 1 character.

On the other hand,

  struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
  __interface ISfFileIOPropertyPage :  IUnknown {};

DOES compile in CL (note the lack of 'public' inheritence, 'private' there also 
permits this to compile.

Additionally if IUnknown is not empty (i tried adding 'int x;' to it), this 
ALSO fails in CL.

Fails to compile in CL.  Note that the ONLY change I made was to rename the 
base-struct.  I believe that this commit is being way too liberal in this case. 
 A solution to this SHOULD happen, since this extensively affects the Windows 
SDK, however @zahiraam likely needs to figure out what the ACTUAL exceptions in 
CL are.  I suspect strongly that the exception here is going to be:
-Base is struct
-base has the UUID (listed above)
-Base is named "IUnknown"
-Base is empty.


https://reviews.llvm.org/D37308



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to