Change the key of CGRecordLayouts from being an llvm type* to being a decl*. LLVM
Type*'s can change as types are refined, so we can't use them as a stable key in
the map. Decls don't change, so use them instead.
This patch was written by Anders, but he's too shy to commit it himself :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46743 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprConstant.cpp b/CodeGen/CGExprConstant.cpp
index fbf65aa..f72994d 100644
--- a/CodeGen/CGExprConstant.cpp
+++ b/CodeGen/CGExprConstant.cpp
@@ -104,8 +104,9 @@
llvm::Constant *EmitStructInitialization(InitListExpr *ILE,
const llvm::StructType *SType) {
+ TagDecl *TD = ILE->getType()->getAsRecordType()->getDecl();
std::vector<llvm::Constant*> Elts;
- const CGRecordLayout *CGR = CGM.getTypes().getCGRecordLayout(SType);
+ const CGRecordLayout *CGR = CGM.getTypes().getCGRecordLayout(TD);
unsigned NumInitElements = ILE->getNumInits();
unsigned NumElements = SType->getNumElements();