Is there a reason not to use SetVector here? This seems to be what it was designed for...
On Wed, Aug 22, 2012 at 10:05 PM, Douglas Gregor <[email protected]> wrote: > Author: dgregor > Date: Thu Aug 23 00:05:18 2012 > New Revision: 162429 > > URL: http://llvm.org/viewvc/llvm-project?rev=162429&view=rev > Log: > array_pod_sort on the addresses of declaration pointers leads to > inconsistent ordering of results; instead, use use SmallPtrSet to > eliminate duplicates. > > Modified: > cfe/trunk/lib/AST/CXXInheritance.cpp > > Modified: cfe/trunk/lib/AST/CXXInheritance.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=162429&r1=162428&r2=162429&view=diff > > ============================================================================== > --- cfe/trunk/lib/AST/CXXInheritance.cpp (original) > +++ cfe/trunk/lib/AST/CXXInheritance.cpp Thu Aug 23 00:05:18 2012 > @@ -25,13 +25,11 @@ > assert(NumDeclsFound == 0 && !DeclsFound && > "Already computed the set of declarations"); > > + llvm::SmallPtrSet<NamedDecl *, 8> KnownDecls; > SmallVector<NamedDecl *, 8> Decls; > for (paths_iterator Path = begin(), PathEnd = end(); Path != PathEnd; > ++Path) > - Decls.push_back(*Path->Decls.first); > - > - // Eliminate duplicated decls. > - llvm::array_pod_sort(Decls.begin(), Decls.end()); > - Decls.erase(std::unique(Decls.begin(), Decls.end()), Decls.end()); > + if (KnownDecls.insert(*Path->Decls.first)) > + Decls.push_back(*Path->Decls.first); > > NumDeclsFound = Decls.size(); > DeclsFound = new NamedDecl * [NumDeclsFound]; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
