[Sema][ObjC] Use SmallSetVector to fix a failing test on the reverse

iteration bot.

This commit reverts r315639, which was causing clang to print
diagnostics that weren't printed before. Instead, it declares
OverrideSearch::Overridden as a SmallSetVector to fix the
non-deterministic behavior r315639 was trying to fix.

rdar://problem/36445528

llvm-svn: 324425
This commit is contained in:
Akira Hatanaka 2018-02-06 23:44:40 +00:00
parent cd07a3e2f9
commit 4c687f38c6
3 changed files with 26 additions and 6 deletions

View File

@ -3623,6 +3623,8 @@ void Sema::mergeObjCMethodDecls(ObjCMethodDecl *newMethod,
ni = newMethod->param_begin(), ne = newMethod->param_end();
ni != ne && oi != oe; ++ni, ++oi)
mergeParamDeclAttributes(*ni, *oi, *this);
CheckObjCMethodOverride(newMethod, oldMethod);
}
static void diagnoseVarDeclTypeMismatch(Sema &S, VarDecl *New, VarDecl* Old) {

View File

@ -4133,7 +4133,7 @@ class OverrideSearch {
public:
Sema &S;
ObjCMethodDecl *Method;
llvm::SmallPtrSet<ObjCMethodDecl*, 4> Overridden;
llvm::SmallSetVector<ObjCMethodDecl*, 4> Overridden;
bool Recursive;
public:
@ -4170,7 +4170,7 @@ public:
}
}
typedef llvm::SmallPtrSetImpl<ObjCMethodDecl*>::iterator iterator;
typedef decltype(Overridden)::iterator iterator;
iterator begin() const { return Overridden.begin(); }
iterator end() const { return Overridden.end(); }
@ -4338,10 +4338,6 @@ void Sema::CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
// Then merge the declarations.
mergeObjCMethodDecls(ObjCMethod, overridden);
}
for (ObjCMethodDecl *overridden : overrides) {
CheckObjCMethodOverride(ObjCMethod, overridden);
if (ObjCMethod->isImplicit() && overridden->isImplicit())
continue; // Conflicting properties are detected elsewhere.

View File

@ -154,3 +154,25 @@ struct __attribute__((objc_ownership(none))) S2 {}; // expected-error {{'objc_ow
@property (readwrite, weak) ControllerClass *weak_controller;
@end
@interface I3
@end
@interface D3 : I3
@end
@interface D3 (Cat1)
- (id)method;
@end
@interface I3 (Cat2)
// FIXME: clang should diagnose mismatch between methods in D3(Cat1) and
// I3(Cat2).
- (id)method __attribute__((ns_returns_retained));
@end
@implementation D3
- (id)method {
return (id)0;
}
@end