diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-23 16:06:01 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-23 16:06:01 +0000 |
commit | 8c43dccdae3083e73061cb1b2f517b77d35876a0 (patch) | |
tree | 72e0ec57b6bf7bdfaa7ce0735afa446ca084f2ea | |
parent | d0e49e587afd15ccc6c2f910a979f0d3d602d166 (diff) |
Replace some DenseSets with SmallPtrSets. Apart from the "small" optimization, the current implementation is also a denser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151257 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index c5215c016c..6512929c2f 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -32,7 +32,6 @@ #include "clang/Sema/ParsedTemplate.h" #include "clang/Basic/PartialDiagnostic.h" #include "clang/Lex/Preprocessor.h" -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/STLExtras.h" #include <map> @@ -6469,7 +6468,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, // need to be repeated. struct UserData { - llvm::DenseSet<const CXXRecordDecl*> Bases; + llvm::SmallPtrSet<const CXXRecordDecl*, 4> Bases; static bool collect(const CXXRecordDecl *Base, void *OpaqueData) { UserData *Data = reinterpret_cast<UserData*>(OpaqueData); diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index d3a31ede67..5507c5770d 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -31,7 +31,6 @@ #include "clang/AST/ExprCXX.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/LangOptions.h" -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" @@ -1263,7 +1262,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, if (I == E) return false; // We have at least added all these contexts to the queue. - llvm::DenseSet<DeclContext*> Visited; + llvm::SmallPtrSet<DeclContext*, 8> Visited; Visited.insert(StartDC); // We have not yet looked into these namespaces, much less added @@ -1274,7 +1273,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, // with its using-children. for (; I != E; ++I) { NamespaceDecl *ND = (*I)->getNominatedNamespace()->getOriginalNamespace(); - if (Visited.insert(ND).second) + if (Visited.insert(ND)) Queue.push_back(ND); } @@ -1323,7 +1322,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, for (llvm::tie(I,E) = ND->getUsingDirectives(); I != E; ++I) { NamespaceDecl *Nom = (*I)->getNominatedNamespace(); - if (Visited.insert(Nom).second) + if (Visited.insert(Nom)) Queue.push_back(Nom); } } |