]> git.tdb.fi Git - builder.git/commitdiff
Use a covariant return type for get_real_target in FileTarget
authorMikko Rasa <tdb@tdb.fi>
Sun, 12 Mar 2023 13:18:10 +0000 (15:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 12 Mar 2023 13:18:41 +0000 (15:18 +0200)
source/lib/filetarget.h
source/lib/installedfile.cpp
source/lib/installedfile.h
source/lib/objectfile.cpp

index 64128d690bb4adbebc374a6281311d505788dac8..4a969b81b2d138a6164d4ce3942896e28ab40fd1 100644 (file)
@@ -37,6 +37,8 @@ public:
        /// Changes the mtime of the target to the current time.
        void touch();
 
+       FileTarget *get_real_target() override { return this; }
+
 protected:
        void check_rebuild() override;
 
index bf542b0082feafe7ad427c04180511f020e0964d..78a7c3a1575100a063d56451abc22f8c94349640 100644 (file)
@@ -54,7 +54,7 @@ void InstalledFile::set_symlink(const FS::Path &l)
        builder.get_vfs().register_path(link, this);
 }
 
-Target *InstalledFile::get_real_target()
+FileTarget *InstalledFile::get_real_target()
 {
        return source.get_real_target();
 }
index e9dfe17673a94570c3a4707b635b1b55d485ed54..30379825d2aaad9b112d44e3ebc2968ef73bd562 100644 (file)
@@ -29,7 +29,7 @@ public:
 
        const Msp::FS::Path &get_symlink() const { return link; }
 
-       Target *get_real_target() override;
+       FileTarget *get_real_target() override;
 private:
        void check_rebuild() override;
 
index 63a8e6b2b7c44a61c6699b71eb7f5d94e5ac2862..46ec607119d82c10511eef32ef23e9d50657b958 100644 (file)
@@ -52,7 +52,7 @@ void ObjectFile::find_dependencies(FileTarget &tgt, vector<FileTarget *> &header
 {
        tgt.prepare();
 
-       FileTarget *rtgt = dynamic_cast<FileTarget *>(tgt.get_real_target());
+       FileTarget *rtgt = tgt.get_real_target();
        Dependencies deps_to_add = rtgt->get_transitive_dependencies();
        if(rtgt!=&tgt)
        {