Skip to content

Commit 7a629a8

Browse files
[NFC] Don't compute sizes manually in GenericFunctionType::get.
1 parent 196f358 commit 7a629a8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/AST/ASTContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,9 +3075,8 @@ GenericFunctionType *GenericFunctionType::get(GenericSignature sig,
30753075
return funcTy;
30763076
}
30773077

3078-
void *mem = ctx.Allocate(sizeof(GenericFunctionType) +
3079-
sizeof(AnyFunctionType::Param) * params.size(),
3080-
alignof(GenericFunctionType));
3078+
size_t allocSize = totalSizeToAlloc<AnyFunctionType::Param>(params.size());
3079+
void *mem = ctx.Allocate(allocSize, alignof(GenericFunctionType));
30813080

30823081
auto properties = getGenericFunctionRecursiveProperties(params, result);
30833082
auto funcTy = new (mem) GenericFunctionType(sig, params, result, info,

0 commit comments

Comments
 (0)