]> git.tdb.fi Git - builder.git/blobdiff - source/gnuarchiver.cpp
Use dynamic_cast to reference when incorrect type is not acceptable
[builder.git] / source / gnuarchiver.cpp
index 7e79ec08d7749efab9a52567df947b2fdf64f545..f802031f0ee8ea83d12eba4da1019dcb9d2e7142 100644 (file)
@@ -28,12 +28,7 @@ Target *GnuArchiver::create_target(const list<Target *> &sources, const string &
 
        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);
@@ -41,11 +36,6 @@ Target *GnuArchiver::create_target(const list<Target *> &sources, const string &
        return lib;
 }
 
-string GnuArchiver::create_build_signature(const BuildInfo &) const
-{
-       return FS::basename(executable->get_path());
-}
-
 Task *GnuArchiver::run(const Target &target) const
 {
        const StaticLibrary &lib = dynamic_cast<const StaticLibrary &>(target);