@@ -2806,33 +2806,41 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
2806
2806
llvm::StructType* list_type = static_cast <llvm::StructType*>(
2807
2807
llvm_utils->get_type_from_ttype_t_util (x.m_type , module .get ()));
2808
2808
llvm::Constant *ptr = module ->getOrInsertGlobal (x.m_name , list_type);
2809
- module ->getNamedGlobal (x.m_name )->setInitializer (
2810
- llvm::ConstantStruct::get (list_type,
2811
- llvm::Constant::getNullValue (list_type)));
2809
+ if (!external) {
2810
+ module ->getNamedGlobal (x.m_name )->setInitializer (
2811
+ llvm::ConstantStruct::get (list_type,
2812
+ llvm::Constant::getNullValue (list_type)));
2813
+ }
2812
2814
llvm_symtab[h] = ptr;
2813
2815
} else if (x.m_type ->type == ASR::ttypeType::Tuple) {
2814
2816
llvm::StructType* tuple_type = static_cast <llvm::StructType*>(
2815
2817
llvm_utils->get_type_from_ttype_t_util (x.m_type , module .get ()));
2816
2818
llvm::Constant *ptr = module ->getOrInsertGlobal (x.m_name , tuple_type);
2817
- module ->getNamedGlobal (x.m_name )->setInitializer (
2818
- llvm::ConstantStruct::get (tuple_type,
2819
- llvm::Constant::getNullValue (tuple_type)));
2819
+ if (!external) {
2820
+ module ->getNamedGlobal (x.m_name )->setInitializer (
2821
+ llvm::ConstantStruct::get (tuple_type,
2822
+ llvm::Constant::getNullValue (tuple_type)));
2823
+ }
2820
2824
llvm_symtab[h] = ptr;
2821
2825
} else if (x.m_type ->type == ASR::ttypeType::Dict) {
2822
2826
llvm::StructType* dict_type = static_cast <llvm::StructType*>(
2823
2827
llvm_utils->get_type_from_ttype_t_util (x.m_type , module .get ()));
2824
2828
llvm::Constant *ptr = module ->getOrInsertGlobal (x.m_name , dict_type);
2825
- module ->getNamedGlobal (x.m_name )->setInitializer (
2826
- llvm::ConstantStruct::get (dict_type,
2827
- llvm::Constant::getNullValue (dict_type)));
2829
+ if (!external) {
2830
+ module ->getNamedGlobal (x.m_name )->setInitializer (
2831
+ llvm::ConstantStruct::get (dict_type,
2832
+ llvm::Constant::getNullValue (dict_type)));
2833
+ }
2828
2834
llvm_symtab[h] = ptr;
2829
2835
} else if (x.m_type ->type == ASR::ttypeType::Set) {
2830
2836
llvm::StructType* set_type = static_cast <llvm::StructType*>(
2831
2837
llvm_utils->get_type_from_ttype_t_util (x.m_type , module .get ()));
2832
2838
llvm::Constant *ptr = module ->getOrInsertGlobal (x.m_name , set_type);
2833
- module ->getNamedGlobal (x.m_name )->setInitializer (
2834
- llvm::ConstantStruct::get (set_type,
2835
- llvm::Constant::getNullValue (set_type)));
2839
+ if (!external) {
2840
+ module ->getNamedGlobal (x.m_name )->setInitializer (
2841
+ llvm::ConstantStruct::get (set_type,
2842
+ llvm::Constant::getNullValue (set_type)));
2843
+ }
2836
2844
llvm_symtab[h] = ptr;
2837
2845
} else if (x.m_type ->type == ASR::ttypeType::TypeParameter) {
2838
2846
// Ignore type variables
0 commit comments