From: Mikko Rasa Date: Fri, 8 Jun 2012 22:56:34 +0000 (+0300) Subject: Use the tool to create headers X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7c0fc22e2ecd8d8c1843f797d52b36610d880227;p=builder.git Use the tool to create headers --- diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index bff2886..0ada219 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -64,9 +64,9 @@ FileTarget *VirtualFileSystem::find_header(const string &name, const SearchPath FileTarget *tgt = 0; for(SearchPath::const_iterator j=path.begin(); (!tgt && j!=path.end()); ++j) - tgt = get_header(FS::Path(*j)/name); + tgt = get_header(FS::Path(*j)/name, *tool); for(Tool::SearchPath::const_iterator j=syspath.begin(); (!tgt && j!=syspath.end()); ++j) - tgt = get_header(FS::Path(*j)/name); + tgt = get_header(FS::Path(*j)/name, *tool); include_cache.insert(TargetMap::value_type(id, tgt)); @@ -101,17 +101,14 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath return tgt; } -FileTarget *VirtualFileSystem::get_header(const FS::Path &fn) +FileTarget *VirtualFileSystem::get_header(const FS::Path &fn, const Tool &tool) { - FileTarget *tgt = get_target(fn); - if(tgt) + if(FileTarget *tgt = get_target(fn)) return tgt; if(FS::is_reg(fn)) - { - tgt = new CSourceFile(builder, fn); - return tgt; - } + return dynamic_cast(tool.create_source(fn)); + return 0; } diff --git a/source/virtualfilesystem.h b/source/virtualfilesystem.h index 592f6bf..7246585 100644 --- a/source/virtualfilesystem.h +++ b/source/virtualfilesystem.h @@ -48,7 +48,7 @@ private: target of one was found, or a new SystemHeader target if there was no known target but the file exists. */ - FileTarget *get_header(const Msp::FS::Path &); + FileTarget *get_header(const Msp::FS::Path &, const Tool &); FileTarget *get_library(const std::string &, const Msp::FS::Path &, LibMode);