diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-12-18 23:44:18 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-12-18 23:44:18 +0000 |
commit | 8edb5c2081daf48c1bff1df7bb37a3ccedddee37 (patch) | |
tree | b30cc3079fbf8b9e2d68f407f077f4a3f237f1ed /clang/lib/AST | |
parent | 1c09b264e3729f87810cdb3b265d4f91ebdc8724 (diff) | |
download | bcm5719-llvm-8edb5c2081daf48c1bff1df7bb37a3ccedddee37.tar.gz bcm5719-llvm-8edb5c2081daf48c1bff1df7bb37a3ccedddee37.zip |
Refactor the Microsoft inheritance attribute handling so that it no longer has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes.
llvm-svn: 197629
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/AttrImpl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/MicrosoftCXXABI.cpp | 22 |
2 files changed, 12 insertions, 12 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) |