Fix misaligned allocation of TemplateParameterList objects.

llvm-svn: 162056
This commit is contained in:
Richard Smith 2012-08-16 22:51:34 +00:00
parent b899c1b417
commit 426f78555e
1 changed files with 2 additions and 1 deletions

View File

@ -43,7 +43,8 @@ TemplateParameterList::Create(const ASTContext &C, SourceLocation TemplateLoc,
unsigned NumParams, SourceLocation RAngleLoc) {
unsigned Size = sizeof(TemplateParameterList)
+ 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);
return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
NumParams, RAngleLoc);