Handle RecordLayout and get the Alloc size.
Fix bug b/2901942 "hang in renderscript."
Change-Id: Ia33c64f47656a93f6de1eb95e3e983266289c8ba
diff --git a/slang_rs_export_func.cpp b/slang_rs_export_func.cpp
index 9c5ace7..aec673b 100644
--- a/slang_rs_export_func.cpp
+++ b/slang_rs_export_func.cpp
@@ -2,6 +2,8 @@
#include "slang_rs_export_func.hpp"
#include "slang_rs_export_type.hpp"
+#include "llvm/Target/TargetData.h" /* for class llvm::TargetData */
+
#include "clang/AST/Decl.h" /* for clang::*Decl */
namespace slang {
@@ -49,6 +51,8 @@
PI++, Index++)
ParamPacketType->mFields.push_back( new RSExportRecordType::Field((*PI)->getType(), (*PI)->getName(), ParamPacketType, Index) );
+ ParamPacketType->AllocSize = mContext->getTargetData()->getTypeAllocSize(ParamPacketType->getLLVMType());
+
mParamPacketType = ParamPacketType;
}