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 | 11f9f8acdec0685d39099ea25ac2cb49f82003a9 (patch) | |
tree | 6e59af817088865427f48a1f3fa743e90dce77e5 /clang/lib/ARCMigrate/TransGCAttrs.cpp | |
parent | c7816800d87f848907b1c86d6fc614ad03585c46 (diff) | |
download | bcm5719-llvm-11f9f8acdec0685d39099ea25ac2cb49f82003a9.tar.gz bcm5719-llvm-11f9f8acdec0685d39099ea25ac2cb49f82003a9.zip |
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. :)
llvm-svn: 339638
Diffstat (limited to 'clang/lib/ARCMigrate/TransGCAttrs.cpp')
-rw-r--r-- | clang/lib/ARCMigrate/TransGCAttrs.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp index 06f8a23e7ee..fb45cd92c1f 100644 --- a/clang/lib/ARCMigrate/TransGCAttrs.cpp +++ b/clang/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) |