aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-08-23 05:05:18 +0000
committerDouglas Gregor <dgregor@apple.com>2012-08-23 05:05:18 +0000
commit925d58c20aba52ef3901db7402a2067266ed12ea (patch)
treebff3a271b43d7107b6c50a5bba1360fdfdf5c91c /lib/AST/CXXInheritance.cpp
parent4e90bc39f052ea0046d40aebbb42732ad1f21f50 (diff)
array_pod_sort on the addresses of declaration pointers leads to
inconsistent ordering of results; instead, use use SmallPtrSet to eliminate duplicates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CXXInheritance.cpp')
-rw-r--r--lib/AST/CXXInheritance.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp
index cf3913bac0..247f3753f0 100644
--- a/lib/AST/CXXInheritance.cpp
+++ b/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];