diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/AttrImpl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/MicrosoftCXXABI.cpp | 22 | ||||
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 5 |
5 files changed, 18 insertions, 21 deletions
diff --git a/clang/lib/AST/AttrImpl.cpp b/clang/lib/AST/AttrImpl.cpp index 7af3c8b1626..0bf6bcd9092 100644 --- a/clang/lib/AST/AttrImpl.cpp +++ b/clang/lib/AST/AttrImpl.cpp @@ -24,6 +24,4 @@ void InheritableAttr::anchor() { } void InheritableParamAttr::anchor() { } -void MSInheritanceAttr::anchor() { } - #include "clang/AST/AttrImpl.inc" diff --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp index 4a93ea1f417..f4037abebbe 100644 --- a/clang/lib/AST/MicrosoftCXXABI.cpp +++ b/clang/lib/AST/MicrosoftCXXABI.cpp @@ -92,19 +92,21 @@ static bool usesMultipleInheritanceModel(const CXXRecordDecl *RD) { return false; } -static MSInheritanceModel MSInheritanceAttrToModel(attr::Kind Kind) { - switch (Kind) { - default: llvm_unreachable("expected MS inheritance attribute"); - case attr::SingleInheritance: return MSIM_Single; - case attr::MultipleInheritance: return MSIM_Multiple; - case attr::VirtualInheritance: return MSIM_Virtual; - case attr::UnspecifiedInheritance: return MSIM_Unspecified; - } +static MSInheritanceModel MSInheritanceAttrToModel(MSInheritanceAttr *Attr) { + if (Attr->IsSingle()) + return MSIM_Single; + else if (Attr->IsMultiple()) + return MSIM_Multiple; + else if (Attr->IsVirtual()) + return MSIM_Virtual; + + assert(Attr->IsUnspecified() && "Expected unspecified inheritance attr"); + return MSIM_Unspecified; } MSInheritanceModel CXXRecordDecl::getMSInheritanceModel() const { - if (Attr *IA = this->getAttr<MSInheritanceAttr>()) - return MSInheritanceAttrToModel(IA->getKind()); + if (MSInheritanceAttr *IA = this->getAttr<MSInheritanceAttr>()) + return MSInheritanceAttrToModel(IA); // If there was no explicit attribute, the record must be defined already, and // we can figure out the inheritance model from its other properties. if (this->getNumVBases() > 0) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 2d6523cfe41..4f86ba42db2 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -998,7 +998,7 @@ void Parser::ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs) { IdentifierInfo *AttrName = Tok.getIdentifierInfo(); SourceLocation AttrNameLoc = ConsumeToken(); attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0, - AttributeList::AS_GNU); + AttributeList::AS_Keyword); } } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index b44506c0a3f..01a1bed0d41 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4091,12 +4091,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_Uuid: handleUuidAttr(S, D, Attr); break; - case AttributeList::AT_SingleInheritance: - handleSimpleAttribute<SingleInheritanceAttr>(S, D, Attr); break; - case AttributeList::AT_MultipleInheritance: - handleSimpleAttribute<MultipleInheritanceAttr>(S, D, Attr); break; - case AttributeList::AT_VirtualInheritance: - handleSimpleAttribute<VirtualInheritanceAttr>(S, D, Attr); break; + case AttributeList::AT_MSInheritance: + handleSimpleAttribute<MSInheritanceAttr>(S, D, Attr); break; case AttributeList::AT_ForceInline: handleSimpleAttribute<ForceInlineAttr>(S, D, Attr); break; case AttributeList::AT_SelectAny: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 59b965b38c9..961d14f6190 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1773,8 +1773,9 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, // figure out the inheritance model. for (CXXRecordDecl::redecl_iterator I = RD->redecls_begin(), E = RD->redecls_end(); I != E; ++I) { - I->addAttr(::new (Context) UnspecifiedInheritanceAttr( - RD->getSourceRange(), Context)); + I->addAttr(::new (Context) MSInheritanceAttr(RD->getSourceRange(), + Context, + MSInheritanceAttr::UnspecifiedSpellingIndex)); } } } |