From: Ted Kremenek Date: Thu, 15 Apr 2010 01:14:12 +0000 (+0000) Subject: Teach ASTVector::append() about the case where 'NumInputs' is 0. This hopefully... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b13c170a280673f4cf4d7d11ec818392407254d4;p=clang Teach ASTVector::append() about the case where 'NumInputs' is 0. This hopefully fixes a crash in InitListExpr's ctor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101328 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTVector.h b/include/clang/AST/ASTVector.h index a23ce87a91..217dfade52 100644 --- a/include/clang/AST/ASTVector.h +++ b/include/clang/AST/ASTVector.h @@ -176,6 +176,10 @@ public: template void append(ASTContext &C, in_iter in_start, in_iter in_end) { size_type NumInputs = std::distance(in_start, in_end); + + if (NumInputs == 0) + return; + // Grow allocated space if needed. if (NumInputs > size_type(this->capacity_ptr()-this->end())) this->grow(C, this->size()+NumInputs);