From: Eli Friedman Date: Tue, 4 Oct 2011 20:31:48 +0000 (+0000) Subject: Remove a nonsensical bit of code from InitListChecker::getStructuredSubobjectInit... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=118c6c0dd659d34af2ab17a126f45c1e3e02e94a;p=clang Remove a nonsensical bit of code from InitListChecker::getStructuredSubobjectInit which was increasing the reserved size for an init list past its maximum possible size. Fixes PR11056, a case where we were reserving a bunch of memory for arrays that was never actually used. (No testcase because I don't think we have any way to actually write a testcase for this; the chosen value of NumElements has no effects on anything other than performance and memory usage.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141106 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 451abd4534..145a7ecaba 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -2037,9 +2037,6 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index, RDecl->field_end()); } - if (NumElements < NumInits) - NumElements = IList->getNumInits(); - Result->reserveInits(SemaRef.Context, NumElements); // Link this new initializer list into the structured initializer