aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/ASTVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/ASTVector.h')
-rw-r--r--include/clang/AST/ASTVector.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/clang/AST/ASTVector.h b/include/clang/AST/ASTVector.h
index 217dfade525f..4ff5ea37b882 100644
--- a/include/clang/AST/ASTVector.h
+++ b/include/clang/AST/ASTVector.h
@@ -374,7 +374,7 @@ void ASTVector<T>::grow(ASTContext &C, size_t MinSize) {
NewCapacity = MinSize;
// Allocate the memory from the ASTContext.
- T *NewElts = new (C) T[NewCapacity];
+ T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
// Copy the elements over.
if (llvm::is_class<T>::value) {
@@ -387,7 +387,7 @@ void ASTVector<T>::grow(ASTContext &C, size_t MinSize) {
memcpy(NewElts, Begin, CurSize * sizeof(T));
}
- C.Deallocate(Begin);
+ // ASTContext never frees any memory.
Begin = NewElts;
End = NewElts+CurSize;
Capacity = Begin+NewCapacity;