aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-16 22:51:34 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-16 22:51:34 +0000
commit1a30edb995924b007044ca7abd97d7fbea22007f (patch)
tree6c3999f195777543478ef57c65ac68a47604523b
parent2f648515c8bf964c87eb3b6ce37bb816d7d9b2bc (diff)
Fix misaligned allocation of TemplateParameterList objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162056 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclTemplate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp
index 5aebc2b764..a7e89994af 100644
--- a/lib/AST/DeclTemplate.cpp
+++ b/lib/AST/DeclTemplate.cpp
@@ -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);