]> granicus.if.org Git - clang/commitdiff
use CodeGenModule::EmitNullConstant in a couple of places.
authorAnders Carlsson <andersca@mac.com>
Sun, 2 Aug 2009 21:18:22 +0000 (21:18 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 2 Aug 2009 21:18:22 +0000 (21:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77915 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CodeGenModule.cpp

index 7028e7449198b5a13c63a725b7b02f902c2c6cd9..9fd571b8164bc54387b4c0029f1527bd9582f5ca 100644 (file)
@@ -105,9 +105,8 @@ CodeGenFunction::CreateStaticBlockVarDecl(const VarDecl &D,
   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) { 
index dbb1bdcc6e3d609cf6d3eeeb9ee7a0bfb0096c78..3a1eac9e04b1738ced96e60592ec1dc9a841500f 100644 (file)
@@ -772,5 +772,5 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
 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));
 }
index ec9a97aabd6618f3c2f60899d8591c1a7201ace4..c37fbe2efcdf01e6d87f795cd8e56d1f890aa715 100644 (file)
@@ -810,6 +810,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
     // 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());