summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-23 15:18:31 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-23 15:18:31 +0000
commit91c6b6a9331a7a492e1c316c6b8f17760ce4607c (patch)
treebeeeacd6be8f503ec496c34eba162f89ea2f3d16 /clang/lib/AST/CXXInheritance.cpp
parent6b441d62e9d22e3ebd81e232c1755ff42a5bf54c (diff)
downloadbcm5719-llvm-91c6b6a9331a7a492e1c316c6b8f17760ce4607c.tar.gz
bcm5719-llvm-91c6b6a9331a7a492e1c316c6b8f17760ce4607c.zip
Unique CXXBasePath decls with the SmallVector/pod_sort/std::unique idiom instead of employing a wasteful std::set.
llvm-svn: 151255
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r--clang/lib/AST/CXXInheritance.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp
index f29bfd13192..f6ce983399b 100644
--- a/clang/lib/AST/CXXInheritance.cpp
+++ b/clang/lib/AST/CXXInheritance.cpp
@@ -23,12 +23,15 @@ using namespace clang;
void CXXBasePaths::ComputeDeclsFound() {
assert(NumDeclsFound == 0 && !DeclsFound &&
"Already computed the set of declarations");
-
- std::set<NamedDecl *> Decls;
- for (CXXBasePaths::paths_iterator Path = begin(), PathEnd = end();
- Path != PathEnd; ++Path)
- Decls.insert(*Path->Decls.first);
-
+
+ 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());
+ std::unique(Decls.begin(), Decls.end());
+
NumDeclsFound = Decls.size();
DeclsFound = new NamedDecl * [NumDeclsFound];
std::copy(Decls.begin(), Decls.end(), DeclsFound);
OpenPOWER on IntegriCloud