diff options
author | Joao Matos <ripzonetriton@gmail.com> | 2012-09-04 17:18:12 +0000 |
---|---|---|
committer | Joao Matos <ripzonetriton@gmail.com> | 2012-09-04 17:18:12 +0000 |
commit | 679fc9314c2bde5eb6bea33c790d1a035461e618 (patch) | |
tree | 00c8d18c8e6970114484d795b6fe59f8238b5e27 /lib/Sema | |
parent | 21a37047e56d717c7979fa653c9f30aae468608d (diff) |
Revert r163078 per chandlerc's request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 54 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 8 |
2 files changed, 20 insertions, 42 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index bf1c14338d..50d1117599 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -4149,50 +4149,20 @@ static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "uuid"; } -static bool hasOtherInheritanceAttr(Decl *D, AttributeList::Kind Kind, - int& Existing) { - if (Kind != AttributeList::AT_SingleInheritance && - D->hasAttr<SingleInheritanceAttr>()) { - Existing = 0; - return true; - } - else if (Kind != AttributeList::AT_MultipleInheritance && - D->hasAttr<MultipleInheritanceAttr>()) { - Existing = 1; - return true; - } - else if (Kind != AttributeList::AT_VirtualInheritance && - D->hasAttr<VirtualInheritanceAttr>()) { - Existing = 2; - return true; - } - return false; -} - static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) { - if (!S.LangOpts.MicrosoftExt) { + if (S.LangOpts.MicrosoftExt) { + AttributeList::Kind Kind = Attr.getKind(); + if (Kind == AttributeList::AT_SingleInheritance) + D->addAttr( + ::new (S.Context) SingleInheritanceAttr(Attr.getRange(), S.Context)); + else if (Kind == AttributeList::AT_MultipleInheritance) + D->addAttr( + ::new (S.Context) MultipleInheritanceAttr(Attr.getRange(), S.Context)); + else if (Kind == AttributeList::AT_VirtualInheritance) + D->addAttr( + ::new (S.Context) VirtualInheritanceAttr(Attr.getRange(), S.Context)); + } else S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); - return; - } - - AttributeList::Kind Kind = Attr.getKind(); - - int Existing; - if (hasOtherInheritanceAttr(D->getCanonicalDecl(), Kind, Existing)) { - S.Diag(Attr.getLoc(), diag::warn_ms_inheritance_already_declared) << Existing; - return; - } - - if (Kind == AttributeList::AT_SingleInheritance) { - D->addAttr( - ::new (S.Context) SingleInheritanceAttr(Attr.getRange(), S.Context)); - } else if (Kind == AttributeList::AT_MultipleInheritance) { - D->addAttr( - ::new (S.Context) MultipleInheritanceAttr(Attr.getRange(), S.Context)); - } else if (Kind == AttributeList::AT_VirtualInheritance) { - D->addAttr( - ::new (S.Context) VirtualInheritanceAttr(Attr.getRange(), S.Context)); - } } static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 68cd5cdcf8..82dccfa5f4 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1583,6 +1583,14 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, return QualType(); } + // In the Microsoft ABI, the class is allowed to be an incomplete + // type. In such cases, the compiler makes a worst-case assumption. + // We make no such assumption right now, so emit an error if the + // class isn't a complete type. + if (Context.getTargetInfo().getCXXABI() == CXXABI_Microsoft && + RequireCompleteType(Loc, Class, diag::err_incomplete_type)) + return QualType(); + return Context.getMemberPointerType(T, Class.getTypePtr()); } |