[cfe-commits] r101328 - /cfe/trunk/include/clang/AST/ASTVector.h

Ted Kremenek kremenek at apple.com
Wed Apr 14 18:14:12 PDT 2010


Author: kremenek
Date: Wed Apr 14 20:14:12 2010
New Revision: 101328

URL: http://llvm.org/viewvc/llvm-project?rev=101328&view=rev
Log:
Teach ASTVector::append() about the case where 'NumInputs' is 0.  This hopefully fixes
a crash in InitListExpr's ctor.

Modified:
    cfe/trunk/include/clang/AST/ASTVector.h

Modified: cfe/trunk/include/clang/AST/ASTVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTVector.h?rev=101328&r1=101327&r2=101328&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTVector.h (original)
+++ cfe/trunk/include/clang/AST/ASTVector.h Wed Apr 14 20:14:12 2010
@@ -176,6 +176,10 @@
   template<typename in_iter>
   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);





More information about the cfe-commits mailing list