]> git.tdb.fi Git - builder.git/blobdiff - source/msvclinker.cpp
Replace basic for loops with range-based loops or algorithms
[builder.git] / source / msvclinker.cpp
index 46d89f7194a5565692b0a1c032f0d2a206180cc2..49744288fcc1ffaefb4e57a4eec29430646fe741 100644 (file)
@@ -35,9 +35,9 @@ Target *MsvcLinker::create_target(const list<Target *> &sources, const string &a
                throw invalid_argument("MsvcLinker::create_target");
 
        list<ObjectFile *> objs;
-       for(list<Target *>::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+       for(Target *s: sources)
        {
-               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(*i))
+               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
                        objs.push_back(obj);
                else
                        throw invalid_argument("MsvcLinker::create_target");
@@ -80,10 +80,10 @@ void MsvcLinker::do_prepare()
        system_path.push_back(win_sdk_dir/"lib"/win_sdk_ver/"um"/arch_dir);
 
        string path;
-       for(SearchPath::const_iterator i=system_path.begin(); i!=system_path.end(); ++i)
+       for(const FS::Path &p: system_path)
        {
-               append(path, ";", i->str());
-               builder.get_logger().log("tools", format("Got %s system path: %s", tag, *i));
+               append(path, ";", p.str());
+               builder.get_logger().log("tools", format("Got %s system path: %s", tag, p));
        }
 
        setenv("LIB", path);
@@ -105,8 +105,8 @@ Task *MsvcLinker::run(const Target &target) const
        BuildInfo binfo;
        target.collect_build_info(binfo);
 
-       /*for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
-               argv.push_back("/LIBPATH:"+i->str());*/
+       /*for(const FS::Path &p: binfo.libpath)
+               argv.push_back("/LIBPATH:"+p.str());*/
        if(binfo.strip)
                argv.push_back("/INCREMENTAL:NO");
        else
@@ -114,11 +114,10 @@ Task *MsvcLinker::run(const Target &target) const
 
        argv.push_back("/OUT:"+relative(bin.get_path(), work_dir).str());
 
-       const Target::Dependencies &depends = target.get_dependencies();
-       for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i)
+       for(Target *d: target.get_dependencies())
        {
-               FileTarget *file = dynamic_cast<FileTarget *>(*i);
-               Target *tgt = (*i)->get_real_target();
+               FileTarget *file = dynamic_cast<FileTarget *>(d);
+               Target *tgt = d->get_real_target();
 
                if(ObjectFile *obj = dynamic_cast<ObjectFile *>(tgt))
                        argv.push_back(relative(obj->get_path(), work_dir).str());