From 54fa62beae635275029b843f8f3a5dffb7650c63 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 8 Apr 2014 12:53:36 +0100 Subject: [PATCH] Initialize the class layout in the new parser. --- src/CppParser/Parser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 003bb56c..3441ce98 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -495,11 +495,13 @@ void Parser::WalkVTable(clang::CXXRecordDecl* RD, Class* C) assert(RD->isDynamicClass() && "Only dynamic classes have virtual tables"); + if (!C->Layout) + C->Layout = new ClassLayout(); + switch(TargetABI) { case TargetCXXABI::Microsoft: { - C->Layout = new ClassLayout(); C->Layout->ABI = CppAbi::Microsoft; MicrosoftVTableContext VTContext(*AST); @@ -613,6 +615,8 @@ void Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, Class* RC) if (hasLayout) { Layout = &C->getASTContext().getASTRecordLayout(Record); + if (!RC->Layout) + RC->Layout = new ClassLayout(); RC->Layout->Alignment = (int)Layout-> getAlignment().getQuantity(); RC->Layout->Size = (int)Layout->getSize().getQuantity(); RC->Layout->DataSize = (int)Layout->getDataSize().getQuantity();