]> granicus.if.org Git - clang/commitdiff
[Sema] Allocate SmallVector to the right size.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 4 Aug 2015 14:46:06 +0000 (14:46 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 4 Aug 2015 14:46:06 +0000 (14:46 +0000)
SmallVector::set_size does not reallocate the vector. Sadly I have no
idea how to test this. The vector never has more than one member in all
of the regression tests.

Found by inspection.

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

lib/Sema/SemaTemplateInstantiateDecl.cpp

index aff2d1c96676c663dc88b2c4c8ddbd494160b365..0fa7f42fa5cf460c9a0deb9a1b27184028028a37 100644 (file)
@@ -1657,7 +1657,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
   SmallVector<TemplateParameterList *, 4> TempParamLists;
   unsigned NumTempParamLists = 0;
   if (isFriend && (NumTempParamLists = D->getNumTemplateParameterLists())) {
-    TempParamLists.set_size(NumTempParamLists);
+    TempParamLists.resize(NumTempParamLists);
     for (unsigned I = 0; I != NumTempParamLists; ++I) {
       TemplateParameterList *TempParams = D->getTemplateParameterList(I);
       TemplateParameterList *InstParams = SubstTemplateParams(TempParams);