const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty);
return new llvm::GlobalVariable(CGM.getModule(), LTy,
Ty.isConstant(getContext()), Linkage,
- llvm::Constant::getNullValue(LTy), Name,
- 0, D.isThreadSpecified(),
- Ty.getAddressSpace());
+ CGM.EmitNullConstant(D.getType()), Name, 0,
+ D.isThreadSpecified(), Ty.getAddressSpace());
}
void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
llvm::Constant *CodeGenModule::EmitNullConstant(QualType T) {
// Always return an LLVM null constant for now; this will change when we
// get support for IRGen of member pointers.
- return llvm::Constant::getNullValue(getTypes().ConvertType(T));
+ return llvm::Constant::getNullValue(getTypes().ConvertTypeForMem(T));
}
// exists. A use may still exists, however, so we still may need
// to do a RAUW.
assert(!ASTTy->isIncompleteType() && "Unexpected incomplete type");
+ Init = EmitNullConstant(D->getType());
Init = llvm::Constant::getNullValue(getTypes().ConvertTypeForMem(ASTTy));
} else {
Init = EmitConstantExpr(D->getInit(), D->getType());