aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-25 00:51:18 +0000
committerDavid Robillard <d@drobilla.net>2012-12-25 00:51:18 +0000
commit12314c754187ae246bc38aceb827bf51d1669d73 (patch)
tree920e8855c6e933a8da19c6402b27e9b52ac3a474 /src/llvm.cpp
parentbf757dcc9b66ebb3bf7e2df8e8c7d3a011ddd6dc (diff)
downloadresp-12314c754187ae246bc38aceb827bf51d1669d73.tar.gz
resp-12314c754187ae246bc38aceb827bf51d1669d73.tar.bz2
resp-12314c754187ae246bc38aceb827bf51d1669d73.zip
Use C++11 range-based for loops.
git-svn-id: http://svn.drobilla.net/resp/trunk@444 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp24
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;
}
}