Change ASTContext::allocate(unsigned) to return a MutableArrayRef.

...rather than a raw pointer that points to a buffer with space for N
elements. Just because we *can* get N from context doesn't mean it's
convenient/safe.

No functionality change.

Swift SVN r11488
This commit is contained in:
Jordan Rose
2013-12-19 23:25:04 +00:00
parent 21518ab695
commit 308c6139f9
6 changed files with 19 additions and 16 deletions

View File

@@ -809,8 +809,8 @@ Optional<MutableArrayRef<Decl *>> ModuleFile::readMembers() {
return MutableArrayRef<Decl *>();
ASTContext &ctx = getContext();
MutableArrayRef<Decl *> members(ctx.Allocate<Decl *>(rawMemberIDs.size()),
rawMemberIDs.size());
MutableArrayRef<Decl *> members = ctx.Allocate<Decl *>(rawMemberIDs.size());
auto nextMember = members.begin();
for (DeclID rawID : rawMemberIDs) {
*nextMember = getDecl(rawID);