diff options
author | Reid Kleckner <rnk@google.com> | 2018-08-14 01:55:37 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-08-14 01:55:37 +0000 |
commit | 3ae8feb8a46079a603edbec37886faa2adf4afcd (patch) | |
tree | 3a2b70524709e98e84a880caaed9917d49366715 /lib/ARCMigrate | |
parent | ef79af91f9f62c03777d469dc81996f1f06650fb (diff) |
Revert r339623 "Model type attributes as regular Attrs."
This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid
in some way, but we put a lot of work into accepting it, and I'm sure
rejecting it was not an intended consequence of this refactoring. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate')
-rw-r--r-- | lib/ARCMigrate/TransGCAttrs.cpp | 15 | ||||
-rw-r--r-- | lib/ARCMigrate/Transforms.cpp | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/ARCMigrate/TransGCAttrs.cpp b/lib/ARCMigrate/TransGCAttrs.cpp index 06f8a23e7e..fb45cd92c1 100644 --- a/lib/ARCMigrate/TransGCAttrs.cpp +++ b/lib/ARCMigrate/TransGCAttrs.cpp @@ -81,11 +81,10 @@ public: } bool handleAttr(AttributedTypeLoc TL, Decl *D = nullptr) { - auto *OwnershipAttr = TL.getAttrAs<ObjCOwnershipAttr>(); - if (!OwnershipAttr) + if (TL.getAttrKind() != AttributedType::attr_objc_ownership) return false; - SourceLocation Loc = OwnershipAttr->getLocation(); + SourceLocation Loc = TL.getAttrNameLoc(); unsigned RawLoc = Loc.getRawEncoding(); if (MigrateCtx.AttrSet.count(RawLoc)) return true; @@ -94,7 +93,13 @@ public: SourceManager &SM = Ctx.getSourceManager(); if (Loc.isMacroID()) Loc = SM.getImmediateExpansionRange(Loc).getBegin(); - StringRef Spell = OwnershipAttr->getKind()->getName(); + SmallString<32> Buf; + bool Invalid = false; + StringRef Spell = Lexer::getSpelling( + SM.getSpellingLoc(TL.getAttrEnumOperandLoc()), + Buf, SM, Ctx.getLangOpts(), &Invalid); + if (Invalid) + return false; MigrationContext::GCAttrOccurrence::AttrKind Kind; if (Spell == "strong") Kind = MigrationContext::GCAttrOccurrence::Strong; @@ -279,7 +284,7 @@ static void checkAllAtProps(MigrationContext &MigrateCtx, } for (unsigned i = 0, e = ATLs.size(); i != e; ++i) { - SourceLocation Loc = ATLs[i].first.getAttr()->getLocation(); + SourceLocation Loc = ATLs[i].first.getAttrNameLoc(); if (Loc.isMacroID()) Loc = MigrateCtx.Pass.Ctx.getSourceManager() .getImmediateExpansionRange(Loc) diff --git a/lib/ARCMigrate/Transforms.cpp b/lib/ARCMigrate/Transforms.cpp index a403744de7..4a7af28588 100644 --- a/lib/ARCMigrate/Transforms.cpp +++ b/lib/ARCMigrate/Transforms.cpp @@ -359,7 +359,7 @@ MigrationContext::~MigrationContext() { bool MigrationContext::isGCOwnedNonObjC(QualType T) { while (!T.isNull()) { if (const AttributedType *AttrT = T->getAs<AttributedType>()) { - if (AttrT->getAttrKind() == attr::ObjCOwnership) + if (AttrT->getAttrKind() == AttributedType::attr_objc_ownership) return !AttrT->getModifiedType()->isObjCRetainableType(); } |