summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/ms-iunknown-template-function.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-09-29 21:06:00 +0000
committerErich Keane <erich.keane@intel.com>2017-09-29 21:06:00 +0000
commit3e08f66bb0f46d1065671afb6357d9162213606e (patch)
tree735c6f985fd3a187d8ebaf2035689ff7bed77e75 /clang/test/SemaCXX/ms-iunknown-template-function.cpp
parent345187338ed789c456f80a27d32620971dbe8871 (diff)
downloadbcm5719-llvm-3e08f66bb0f46d1065671afb6357d9162213606e.tar.gz
bcm5719-llvm-3e08f66bb0f46d1065671afb6357d9162213606e.zip
[Sema] Correct IUnknown to support Unknwnbase.h Header.
Apparently, the MSVC SDK has a strange implementation that causes a number of implicit functions as well as a template member function of the IUnknown type. This patch allows these as InterfaceLike types as well. Additionally, it corrects the behavior where extern-C++ wrapped around an Interface-Like type would permit an interface-like type to exist in a namespace. Differential Revision: https://reviews.llvm.org/D38303 llvm-svn: 314557
Diffstat (limited to 'clang/test/SemaCXX/ms-iunknown-template-function.cpp')
-rw-r--r--clang/test/SemaCXX/ms-iunknown-template-function.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/ms-iunknown-template-function.cpp b/clang/test/SemaCXX/ms-iunknown-template-function.cpp
new file mode 100644
index 00000000000..dc192238fbd
--- /dev/null
+++ b/clang/test/SemaCXX/ms-iunknown-template-function.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
+typedef long HRESULT;
+typedef unsigned long ULONG;
+typedef struct _GUID {
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+typedef GUID IID;
+
+// remove stdcall, since the warnings have nothing to do with
+// what is being tested.
+#define __stdcall
+
+extern "C" {
+extern "C++" {
+// expected-warning@+1 {{__declspec attribute 'novtable'}}
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable)
+ IUnknown {
+public:
+ virtual HRESULT __stdcall QueryInterface(
+ const IID &riid,
+ void **ppvObject) = 0;
+
+ virtual ULONG __stdcall AddRef(void) = 0;
+
+ virtual ULONG __stdcall Release(void) = 0;
+
+ template <class Q>
+ HRESULT __stdcall QueryInterface(Q **pp) {
+ return QueryInterface(__uuidof(Q), (void **)pp);
+ }
+};
+}
+}
+
+__interface ISfFileIOPropertyPage : public IUnknown{};
+
OpenPOWER on IntegriCloud