]> granicus.if.org Git - clang/commitdiff
Sema: Give a typically small DenseMap some inline capacity.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 12 Apr 2013 15:22:25 +0000 (15:22 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 12 Apr 2013 15:22:25 +0000 (15:22 +0000)
Also reflow code a bit, no change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179382 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Template.h
lib/Sema/SemaTemplateInstantiate.cpp

index 492e5800bdad6e53a7da5a04202b9ee56b307cda..8ee8f35ccba12476ffca3a02dd68a6b1307f2fc9 100644 (file)
@@ -187,10 +187,10 @@ namespace clang {
     /// this template instantiation.
     Sema &SemaRef;
 
-    typedef llvm::DenseMap<const Decl *, 
-                           llvm::PointerUnion<Decl *, DeclArgumentPack *> >
-      LocalDeclsMap;
-    
+    typedef llvm::SmallDenseMap<
+        const Decl *, llvm::PointerUnion<Decl *, DeclArgumentPack *>, 4>
+    LocalDeclsMap;
+
     /// \brief A mapping from local declarations that occur
     /// within a template to their instantiations.
     ///
index f755b8ca452d047766530e9c1fb003252aa33c8d..7ef04e964dc664759acb3d69a96d848ed837d6f0 100644 (file)
@@ -2701,11 +2701,10 @@ void LocalInstantiationScope::InstantiatedLocal(const Decl *D, Decl *Inst) {
   llvm::PointerUnion<Decl *, DeclArgumentPack *> &Stored = LocalDecls[D];
   if (Stored.isNull())
     Stored = Inst;
-  else if (Stored.is<Decl *>()) {
+  else if (DeclArgumentPack *Pack = Stored.dyn_cast<DeclArgumentPack *>())
+    Pack->push_back(Inst);
+  else
     assert(Stored.get<Decl *>() == Inst && "Already instantiated this local");
-    Stored = Inst;
-  } else
-    LocalDecls[D].get<DeclArgumentPack *>()->push_back(Inst);
 }
 
 void LocalInstantiationScope::InstantiatedLocalPackArg(const Decl *D,