diff options
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r-- | src/llvm.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index 93bf066..2bd1930 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -219,8 +219,8 @@ LLVMEngine::llType(const AST* t, const char* name) return NULL; vector<Type*> cprot; - FOREACHP(ATuple::const_iterator, i, protT) { - Type* lt = llType(*i); + for (const auto& i : *protT) { + Type* lt = llType(i); if (!lt) return NULL; cprot.push_back(lt); @@ -414,11 +414,11 @@ LLVMEngine::compileProt( Function::LinkageTypes linkage = Function::ExternalLinkage; vector<Type*> cprot; - FOREACHP(ATuple::const_iterator, i, argsT) { - const CType iT = ((*i)->to_symbol()) - ? compileType(cenv, (*i)->str(), cenv.resolveType(*i)) - : compileType(cenv, (*i)->as_tuple()->fst()->str(), *i); - THROW_IF(!iT, Cursor(), string("non-concrete parameter :: ") + (*i)->str()); + for (const auto& i : *argsT) { + const CType iT = (i->to_symbol()) + ? compileType(cenv, i->str(), cenv.resolveType(i)) + : compileType(cenv, i->as_tuple()->fst()->str(), i); + THROW_IF(!iT, Cursor(), string("non-concrete parameter :: ") + i->str()); cprot.push_back((Type*)iT); } @@ -436,8 +436,8 @@ LLVMEngine::compileProt( // Set argument names in generated code if (args) { Function::arg_iterator a = f->arg_begin(); - for (ATuple::const_iterator i = args->begin(); i != args->end(); ++a, ++i) - a->setName((*i)->as_symbol()->sym()); + for (const auto& i : *args) + (a++)->setName(i->as_symbol()->sym()); } // Define function in the environment so any calls that get compiled before @@ -694,13 +694,13 @@ LLVMEngine::call(CEnv& cenv, CFunc f, const AST* retT) } else if (retT->str() == "String") { const std::string s(((char* (*)())fp)()); ss << "\""; - for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) { - switch (*i) { + for (auto c : s) { + switch (c) { case '\"': case '\\': ss << '\\'; default: - ss << *i; + ss << c; break; } } |