comparison gen/arrays.cpp @ 1381:44c8eef6e6ee

Fixed filename in array bounds check for mixed in imported template function. Fixes ticket #295 .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Sun, 17 May 2009 14:56:29 +0200
parents 229e02867307
children a3af393d1936
comparison
equal deleted inserted replaced
1380:98d435fa2a2d 1381:44c8eef6e6ee
1022 gIR->scope() = IRScope(failbb, okbb); 1022 gIR->scope() = IRScope(failbb, okbb);
1023 1023
1024 std::vector<LLValue*> args; 1024 std::vector<LLValue*> args;
1025 1025
1026 // file param 1026 // file param
1027 // get the filename from the function symbol instead of the current module 1027 // we might be generating for an imported template function
1028 // it's wrong for instantiations of imported templates. Fixes LDC bug #271
1029 Module* funcmodule = gIR->func()->decl->getModule(); 1028 Module* funcmodule = gIR->func()->decl->getModule();
1030 args.push_back(DtoLoad(getIrModule(NULL)->fileName)); 1029 const char* cur_file = funcmodule->srcfile->name->toChars();
1030 if (loc.filename && strcmp(loc.filename, cur_file) != 0)
1031 {
1032 args.push_back(DtoConstString(loc.filename));
1033 }
1034 else
1035 {
1036 IrModule* irmod = getIrModule(funcmodule);
1037 args.push_back(DtoLoad(irmod->fileName));
1038 }
1031 1039
1032 // line param 1040 // line param
1033 LLConstant* c = DtoConstUint(loc.linnum); 1041 LLConstant* c = DtoConstUint(loc.linnum);
1034 args.push_back(c); 1042 args.push_back(c);
1035 1043