llvm::GlobalVariable *GV =
CreateStaticBlockVarDecl(D, ".", llvm::GlobalValue::InternalLinkage);
+ // Store into LocalDeclMap before generating initializer to handle
+ // circular references.
+ DMEntry = GV;
+
if (D.getInit()) {
llvm::Constant *Init = CGM.EmitConstantExpr(D.getInit(), this);
if (D.getAttr<UsedAttr>())
CGM.AddUsedGlobal(GV);
+ // We may have to cast the constant because of the initializer
+ // mismatch above.
+ //
+ // FIXME: It is really dangerous to store this in the map; if anyone
+ // RAUW's the GV uses of this constant will be invalid.
const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(D.getType());
const llvm::Type *LPtrTy =
llvm::PointerType::get(LTy, D.getType().getAddressSpace());
static int *p[] = { &g19 };
}
+// RUN: grep '@g20.l0 = internal global .struct.g20_s1 <{ .struct.g20_s0\* null, .struct.g20_s0\*\* getelementptr (.struct.g20_s1\* @g20.l0, i32 0, i32 0) }>' %t &&
+
+struct g20_s0;
+struct g20_s1 {
+ struct g20_s0 *f0, **f1;
+};
+void *g20(void) {
+ static struct g20_s1 l0 = { ((void*) 0), &l0.f0 };
+ return l0.f1;
+}
+
// RUN: true