[cfe-commits] r162056 - /cfe/trunk/lib/AST/DeclTemplate.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Thu Aug 16 15:51:34 PDT 2012
Author: rsmith
Date: Thu Aug 16 17:51:34 2012
New Revision: 162056
URL: http://llvm.org/viewvc/llvm-project?rev=162056&view=rev
Log:
Fix misaligned allocation of TemplateParameterList objects.
Modified:
cfe/trunk/lib/AST/DeclTemplate.cpp
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=162056&r1=162055&r2=162056&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Thu Aug 16 17:51:34 2012
@@ -43,7 +43,8 @@
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);
More information about the cfe-commits
mailing list