Mercurial > projects > ldc
changeset 191:2900754a6989 trunk
[svn r207] Fixed: the runtime support didn't handle string switch.
author | lindquist |
---|---|
date | Mon, 12 May 2008 14:58:55 +0200 |
parents | 36044016709a |
children | 67ed21bf16af |
files | gen/runtime.cpp |
diffstat | 1 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/runtime.cpp Mon May 12 14:32:29 2008 +0200 +++ b/gen/runtime.cpp Mon May 12 14:58:55 2008 +0200 @@ -696,6 +696,40 @@ const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); } + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + // int _d_switch_string(char[][] table, char[] ca) + { + std::string fname("_d_switch_string"); + std::vector<const llvm::Type*> types; + types.push_back(rt_array(stringTy)); + types.push_back(stringTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + + // int _d_switch_ustring(wchar[][] table, wchar[] ca) + { + std::string fname("_d_switch_ustring"); + std::vector<const llvm::Type*> types; + types.push_back(rt_array(wstringTy)); + types.push_back(wstringTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + + // int _d_switch_dstring(dchar[][] table, dchar[] ca) + { + std::string fname("_d_switch_dstring"); + std::vector<const llvm::Type*> types; + types.push_back(rt_array(dstringTy)); + types.push_back(dstringTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } }