forked from OSchip/llvm-project
Fix misaligned allocation of TemplateParameterList objects.
llvm-svn: 162056
This commit is contained in:
parent
b899c1b417
commit
426f78555e
|
@ -43,7 +43,8 @@ TemplateParameterList::Create(const ASTContext &C, SourceLocation TemplateLoc,
|
||||||
unsigned NumParams, SourceLocation RAngleLoc) {
|
unsigned NumParams, SourceLocation RAngleLoc) {
|
||||||
unsigned Size = sizeof(TemplateParameterList)
|
unsigned Size = sizeof(TemplateParameterList)
|
||||||
+ sizeof(NamedDecl *) * NumParams;
|
+ sizeof(NamedDecl *) * NumParams;
|
||||||
unsigned Align = llvm::AlignOf<TemplateParameterList>::Alignment;
|
unsigned Align = std::max(llvm::alignOf<TemplateParameterList>(),
|
||||||
|
llvm::alignOf<NamedDecl*>());
|
||||||
void *Mem = C.Allocate(Size, Align);
|
void *Mem = C.Allocate(Size, Align);
|
||||||
return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
|
return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
|
||||||
NumParams, RAngleLoc);
|
NumParams, RAngleLoc);
|
||||||
|
|
Loading…
Reference in New Issue