diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-04-15 01:14:12 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-04-15 01:14:12 +0000 |
commit | b13c170a280673f4cf4d7d11ec818392407254d4 (patch) | |
tree | 7fbc661b3088ffd62b04b641f1e11476c604f42b | |
parent | 66cf36dc9803443723c824b246ef8c065aba8d86 (diff) |
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
-rw-r--r-- | include/clang/AST/ASTVector.h | 4 |
1 files changed, 4 insertions, 0 deletions
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<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); |