diff --git a/Chapter05/tinylang/lib/CodeGen/CGModule.cpp b/Chapter05/tinylang/lib/CodeGen/CGModule.cpp index afd80b2..58babd2 100644 --- a/Chapter05/tinylang/lib/CodeGen/CGModule.cpp +++ b/Chapter05/tinylang/lib/CodeGen/CGModule.cpp @@ -47,7 +47,9 @@ void CGModule::run(ModuleDeclaration *Mod) { llvm::GlobalVariable *V = new llvm::GlobalVariable( *M, convertType(Var->getType()), /*isConstant=*/false, - llvm::GlobalValue::PrivateLinkage, nullptr, + llvm::GlobalValue::PrivateLinkage, + llvm::ConstantAggregateZero::get( + convertType(Var->getType())), mangleName(Var)); Globals[Var] = V; } else if (auto *Proc = diff --git a/Chapter06/tinylang/lib/CodeGen/CGModule.cpp b/Chapter06/tinylang/lib/CodeGen/CGModule.cpp index 4ea5561..ade4e0b 100644 --- a/Chapter06/tinylang/lib/CodeGen/CGModule.cpp +++ b/Chapter06/tinylang/lib/CodeGen/CGModule.cpp @@ -86,7 +86,9 @@ void CGModule::run(ModuleDeclaration *Mod) { llvm::GlobalVariable *V = new llvm::GlobalVariable( *M, convertType(Var->getType()), /*isConstant=*/false, - llvm::GlobalValue::PrivateLinkage, nullptr, + llvm::GlobalValue::PrivateLinkage, + llvm::ConstantAggregateZero::get( + convertType(Var->getType())), mangleName(Var)); Globals[Var] = V; } else if (auto *Proc = diff --git a/Chapter07/tinylang/lib/CodeGen/CGModule.cpp b/Chapter07/tinylang/lib/CodeGen/CGModule.cpp index 9963d2c..b178c0d 100644 --- a/Chapter07/tinylang/lib/CodeGen/CGModule.cpp +++ b/Chapter07/tinylang/lib/CodeGen/CGModule.cpp @@ -100,7 +100,9 @@ void CGModule::run(ModuleDeclaration *Mod) { llvm::GlobalVariable *V = new llvm::GlobalVariable( *M, convertType(Var->getType()), /*isConstant=*/false, - llvm::GlobalValue::PrivateLinkage, nullptr, + llvm::GlobalValue::PrivateLinkage, + llvm::ConstantAggregateZero::get( + convertType(Var->getType())), mangleName(Var)); Globals[Var] = V; if (CGDebugInfo *Dbg = getDbgInfo()) diff --git a/Chapter08/tinylang/lib/CodeGen/CGModule.cpp b/Chapter08/tinylang/lib/CodeGen/CGModule.cpp index 9963d2c..b178c0d 100644 --- a/Chapter08/tinylang/lib/CodeGen/CGModule.cpp +++ b/Chapter08/tinylang/lib/CodeGen/CGModule.cpp @@ -100,7 +100,9 @@ void CGModule::run(ModuleDeclaration *Mod) { llvm::GlobalVariable *V = new llvm::GlobalVariable( *M, convertType(Var->getType()), /*isConstant=*/false, - llvm::GlobalValue::PrivateLinkage, nullptr, + llvm::GlobalValue::PrivateLinkage, + llvm::ConstantAggregateZero::get( + convertType(Var->getType())), mangleName(Var)); Globals[Var] = V; if (CGDebugInfo *Dbg = getDbgInfo())