CodeGen: Preserve packed attribute in constStructWithPadding.
Otherwise the object may have an incorrect size due to tail padding.
Differential Revision: https://reviews.llvm.org/D59446
llvm-svn: 356328
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index c09077bb..80bdede 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1113,7 +1113,7 @@
}
if (NestedIntact && Values.size() == STy->getNumElements())
return constant;
- return llvm::ConstantStruct::getAnon(Values);
+ return llvm::ConstantStruct::getAnon(Values, STy->isPacked());
}
/// Replace all padding bytes in a given constant with either a pattern byte or