diff --git a/gen/llvmhelpers.h b/gen/llvmhelpers.h index 4a9ec3f8..ab4c8d45 100644 --- a/gen/llvmhelpers.h +++ b/gen/llvmhelpers.h @@ -220,4 +220,17 @@ void printLabelName(std::ostream& target, const char* func_mangle, const char* l void AppendFunctionToLLVMGlobalCtorsDtors(llvm::Function* func, const uint32_t priority, const bool isCtor); +template +LLConstant* toConstantArray(LLType* ct, LLArrayType* at, T* str, size_t len, bool nullterm = true) +{ + std::vector vals; + vals.reserve(len+1); + for (size_t i = 0; i < len; ++i) { + vals.push_back(LLConstantInt::get(ct, str[i], false)); + } + if (nullterm) + vals.push_back(LLConstantInt::get(ct, 0, false)); + return LLConstantArray::get(at, vals); +} + #endif diff --git a/gen/toir.cpp b/gen/toir.cpp index 7170453e..5b801236 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -423,21 +423,6 @@ LLConstant* ComplexExp::toConstElem(IRState* p) ////////////////////////////////////////////////////////////////////////////////////////// -template -static inline LLConstant* toConstantArray(LLType* ct, LLArrayType* at, T* str, size_t len, bool nullterm = true) -{ - std::vector vals; - vals.reserve(len+1); - for (size_t i = 0; i < len; ++i) { - vals.push_back(LLConstantInt::get(ct, str[i], false)); - } - if (nullterm) - vals.push_back(LLConstantInt::get(ct, 0, false)); - return LLConstantArray::get(at, vals); -} - -////////////////////////////////////////////////////////////////////////////////////////// - DValue* StringExp::toElem(IRState* p) { Logger::print("StringExp::toElem: %s @ %s\n", toChars(), type->toChars());