On Aug 4, 2015 7:51 AM, "Benjamin Kramer" <benny....@googlemail.com> wrote:
>
> Author: d0k
> Date: Tue Aug  4 09:46:06 2015
> New Revision: 243987
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243987&view=rev
> Log:
> [Sema] Allocate SmallVector to the right size.
>
> 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.

Could try adding an assert and self hosting to find a non-singular case?
But yeah, I get that's probably not worth it.

Should we rename set_size something more intimidating/scary? That, or I'd
love to remove it...

>
> Found by inspection.
>
> Modified:
>     cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=243987&r1=243986&r2=243987&view=diff
>
==============================================================================
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Aug  4
09:46:06 2015
> @@ -1657,7 +1657,7 @@ TemplateDeclInstantiator::VisitCXXMethod
>    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);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to