Author: ahatanak Date: Thu Oct 12 16:24:38 2017 New Revision: 315639 URL: http://llvm.org/viewvc/llvm-project?rev=315639&view=rev Log: [Sema][ObjC] Complete merging ObjC methods before checking their overriding methods.
This should fix test case Analysis/retain-release.m that was failing on the reverse iteration bot: http://lab.llvm.org:8011/builders/reverse-iteration The test used to fail because the loop in CheckObjCMethodOverrides would merge attribute ns_returns_retained on methods while checking whether the overriding methods were compatible. Since OverrideSearch::Overridden is a SmallPtrSet and the order in which the elements of the set are visited is non-deterministic, the test would fail when method 'clone' of the protocol 'F18P' was visited before F18(Cat)'s method 'clone' was visited. Modified: cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclObjC.cpp Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=315639&r1=315638&r2=315639&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct 12 16:24:38 2017 @@ -3580,8 +3580,6 @@ void Sema::mergeObjCMethodDecls(ObjCMeth 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) { Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=315639&r1=315638&r2=315639&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Oct 12 16:24:38 2017 @@ -4223,6 +4223,10 @@ void Sema::CheckObjCMethodOverrides(ObjC // 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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits