-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the __interface inheritence rules to work better with IUnknown an…
…d IDispatch __interface objects in MSVC are permitted to inherit from __interface types, and interface-like types. Additionally, there are two default interface-like types (IUnknown and IDispatch) that all interface-like types must inherit from. Differential Revision: https://reviews.llvm.org/D37308 llvm-svn: 313364
- Loading branch information
Erich Keane
committed
Sep 15, 2017
1 parent
f34537d
commit 58bd603
Showing
6 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s | ||
|
||
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown { | ||
void foo() {} | ||
}; | ||
|
||
// expected-error@+1{{interface type cannot inherit from}} | ||
__interface HasError : public IUnknown {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s | ||
|
||
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown { | ||
void foo(); | ||
}; | ||
|
||
__interface NoError : public IUnknown {}; | ||
void IUnknown::foo() {} | ||
// expected-error@+1{{interface type cannot inherit from}} | ||
__interface HasError : public IUnknown {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s | ||
|
||
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown { | ||
void foo(); | ||
}; | ||
struct IPropertyPageBase : public IUnknown {}; | ||
struct IPropertyPage : public IPropertyPageBase {}; | ||
__interface ISfFileIOPropertyPage : public IPropertyPage {}; | ||
|
||
|
||
namespace NS { | ||
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {}; | ||
// expected-error@+1 {{interface type cannot inherit from}} | ||
__interface IPropertyPageBase : public IUnknown {}; | ||
} | ||
// expected-error@+1 {{interface type cannot inherit from}} | ||
__interface IPropertyPageBase2 : public NS::IUnknown {}; | ||
|
||
__interface temp_iface {}; | ||
struct bad_base : temp_iface {}; | ||
// expected-error@+1 {{interface type cannot inherit from}} | ||
__interface bad_inherit : public bad_base{}; | ||
|
||
struct mult_inher_base : temp_iface, IUnknown {}; | ||
// expected-error@+1 {{interface type cannot inherit from}} | ||
__interface bad_inherit2 : public mult_inher_base{}; | ||
|
||
struct PageBase : public IUnknown {}; | ||
struct Page3 : public PageBase {}; | ||
struct Page4 : public PageBase {}; | ||
__interface PropertyPage : public Page4 {}; | ||
|
||
struct Page5 : public Page3, Page4{}; | ||
// expected-error@+1 {{interface type cannot inherit from}} | ||
__interface PropertyPage2 : public Page5 {}; | ||
|
||
__interface IF1 {}; | ||
__interface PP : IUnknown, IF1{}; | ||
__interface PP2 : PP, Page3, Page4{}; |