diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-08-23 05:05:18 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-08-23 05:05:18 +0000 |
commit | 7bdc8ae20b5baaf33429f48b651ea97d569c70cd (patch) | |
tree | 770c8ddfa06bac65582cd232ec5883cb534afe8c /clang | |
parent | f911597494869996e217b21cc9e037e336ecd292 (diff) | |
download | bcm5719-llvm-7bdc8ae20b5baaf33429f48b651ea97d569c70cd.tar.gz bcm5719-llvm-7bdc8ae20b5baaf33429f48b651ea97d569c70cd.zip |
array_pod_sort on the addresses of declaration pointers leads to
inconsistent ordering of results; instead, use use SmallPtrSet to
eliminate duplicates.
llvm-svn: 162429
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index cf3913bac00..247f3753f08 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -25,13 +25,11 @@ void CXXBasePaths::ComputeDeclsFound() { 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]; |