forked from OSchip/llvm-project
[arcmt] The hard-coded list of weak-incompatible classes is no longer necessary.
rdar://10673816 llvm-svn: 152879
This commit is contained in:
parent
99282b783e
commit
ecbe8b4fab
|
@ -29,42 +29,6 @@ ASTTraverser::~ASTTraverser() { }
|
||||||
// Helpers.
|
// Helpers.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// \brief True if the class is one that does not support weak.
|
|
||||||
static bool isClassInWeakBlacklist(ObjCInterfaceDecl *cls) {
|
|
||||||
if (!cls)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool inList = llvm::StringSwitch<bool>(cls->getName())
|
|
||||||
.Case("NSColorSpace", true)
|
|
||||||
.Case("NSFont", true)
|
|
||||||
.Case("NSFontPanel", true)
|
|
||||||
.Case("NSImage", true)
|
|
||||||
.Case("NSLazyBrowserCell", true)
|
|
||||||
.Case("NSWindow", true)
|
|
||||||
.Case("NSWindowController", true)
|
|
||||||
.Case("NSViewController", true)
|
|
||||||
.Case("NSMenuView", true)
|
|
||||||
.Case("NSPersistentUIWindowInfo", true)
|
|
||||||
.Case("NSTableCellView", true)
|
|
||||||
.Case("NSATSTypeSetter", true)
|
|
||||||
.Case("NSATSGlyphStorage", true)
|
|
||||||
.Case("NSLineFragmentRenderingContext", true)
|
|
||||||
.Case("NSAttributeDictionary", true)
|
|
||||||
.Case("NSParagraphStyle", true)
|
|
||||||
.Case("NSTextTab", true)
|
|
||||||
.Case("NSSimpleHorizontalTypesetter", true)
|
|
||||||
.Case("_NSCachedAttributedString", true)
|
|
||||||
.Case("NSStringDrawingTextStorage", true)
|
|
||||||
.Case("NSTextView", true)
|
|
||||||
.Case("NSSubTextStorage", true)
|
|
||||||
.Default(false);
|
|
||||||
|
|
||||||
if (inList)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return isClassInWeakBlacklist(cls->getSuperClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool trans::canApplyWeak(ASTContext &Ctx, QualType type,
|
bool trans::canApplyWeak(ASTContext &Ctx, QualType type,
|
||||||
bool AllowOnUnknownClass) {
|
bool AllowOnUnknownClass) {
|
||||||
if (!Ctx.getLangOpts().ObjCRuntimeHasWeak)
|
if (!Ctx.getLangOpts().ObjCRuntimeHasWeak)
|
||||||
|
@ -88,8 +52,6 @@ bool trans::canApplyWeak(ASTContext &Ctx, QualType type,
|
||||||
return false; // forward classes are not verifiable, therefore not safe.
|
return false; // forward classes are not verifiable, therefore not safe.
|
||||||
if (Class->isArcWeakrefUnavailable())
|
if (Class->isArcWeakrefUnavailable())
|
||||||
return false;
|
return false;
|
||||||
if (isClassInWeakBlacklist(Class))
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue