diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-15 01:41:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-15 01:41:43 +0000 |
commit | 47467041f629aa287a988be3073e230de3e56a3c (patch) | |
tree | 5147fd9c2d4d37ba8d302780ac726caa05d26d79 /lib/AST/NestedNameSpecifier.cpp | |
parent | 97f6026f460c3aaa250fc9dcd7c2b8b6c1f3ba69 (diff) |
Use the right alignment when allocating NestedNameSpecifier objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/NestedNameSpecifier.cpp')
-rw-r--r-- | lib/AST/NestedNameSpecifier.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp index dbf267bd65..49b119b8e0 100644 --- a/lib/AST/NestedNameSpecifier.cpp +++ b/lib/AST/NestedNameSpecifier.cpp @@ -18,6 +18,7 @@ #include "clang/AST/PrettyPrinter.h" #include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" +#include "llvm/Support/AlignOf.h" #include "llvm/Support/raw_ostream.h" #include <cassert> @@ -33,7 +34,8 @@ NestedNameSpecifier::FindOrInsert(const ASTContext &Context, NestedNameSpecifier *NNS = Context.NestedNameSpecifiers.FindNodeOrInsertPos(ID, InsertPos); if (!NNS) { - NNS = new (Context, 4) NestedNameSpecifier(Mockup); + NNS = new (Context, llvm::alignOf<NestedNameSpecifier>()) + NestedNameSpecifier(Mockup); Context.NestedNameSpecifiers.InsertNode(NNS, InsertPos); } @@ -107,7 +109,9 @@ NestedNameSpecifier::Create(const ASTContext &Context, IdentifierInfo *II) { NestedNameSpecifier * NestedNameSpecifier::GlobalSpecifier(const ASTContext &Context) { if (!Context.GlobalNestedNameSpecifier) - Context.GlobalNestedNameSpecifier = new (Context, 4) NestedNameSpecifier(); + Context.GlobalNestedNameSpecifier = + new (Context, llvm::alignOf<NestedNameSpecifier>()) + NestedNameSpecifier(); return Context.GlobalNestedNameSpecifier; } @@ -630,4 +634,3 @@ NestedNameSpecifierLocBuilder::getWithLocInContext(ASTContext &Context) const { memcpy(Mem, Buffer, BufferSize); return NestedNameSpecifierLoc(Representation, Mem); } - |