list<ObjectFile *> objs;
for(Target *s: sources)
- {
- if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
- objs.push_back(obj);
- else
- throw invalid_argument("GnuArchiver::create_target");
- }
+ objs.push_back(&dynamic_cast<ObjectFile &>(*s));
const Component &comp = *objs.front()->get_component();
StaticLibrary *lib = new StaticLibrary(builder, comp, objs);
Linker *linker = default_linker;
for(Target *s: sources)
{
- if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
- {
- objs.push_back(obj);
- if(obj->get_tool()->get_tag()=="CXX")
- linker = cxx_linker;
- }
- else
- throw invalid_argument("GnuLinker::create_target");
+ ObjectFile &obj = dynamic_cast<ObjectFile &>(*s);
+ objs.push_back(&obj);
+ if(obj.get_tool()->get_tag()=="CXX")
+ linker = cxx_linker;
}
const Component &comp = *objs.front()->get_component();
list<ObjectFile *> objs;
for(Target *s: sources)
- {
- if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
- objs.push_back(obj);
- else
- throw invalid_argument("MsvcArchiver::create_target");
- }
+ objs.push_back(&dynamic_cast<ObjectFile &>(*s));
const Component &comp = *objs.front()->get_component();
StaticLibrary *lib = new StaticLibrary(builder, comp, objs);
list<ObjectFile *> objs;
for(Target *s: sources)
- {
- if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
- objs.push_back(obj);
- else
- throw invalid_argument("MsvcLinker::create_target");
- }
+ objs.push_back(&dynamic_cast<ObjectFile &>(*s));
const Component &comp = *objs.front()->get_component();
Binary *bin = 0;