It was brought up in response to my last implementation for
this struct-as-interface features that at least 1 header in
the MS SDK uses "extern C++" around an IUnknown declaration.
The previous implementation demanded that this type exist
in the TranslationUnit DeclContext. This small change simply
also allows in the situation where we're extern "C++".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314235
91177308-0d34-0410-b5e6-
96231b3b80d8
// Check "Special" types.
const auto *Uuid = getAttr<UuidAttr>();
- if (Uuid && isStruct() && getDeclContext()->isTranslationUnit() &&
+ if (Uuid && isStruct() && (getDeclContext()->isTranslationUnit() ||
+ getDeclContext()->isExternCXXContext()) &&
((getName() == "IUnknown" &&
Uuid->getGuid() == "00000000-0000-0000-C000-000000000046") ||
(getName() == "IDispatch" &&
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
-struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
+extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
void foo();
};
struct IPropertyPageBase : public IUnknown {};