Mapping of installed files

David Nolden zwabel+kde at
Thu Jun 26 18:10:35 UTC 2008

Am Donnerstag, 26. Juni 2008 19:48:36 schrieb Andreas Pakulat:
> On 26.06.08 17:46:16, David Nolden wrote:
> > For a better editing experience, the C++ Language support will need some
> > more information from the build-system. Namely we need to be able to map
> > back from installed files to their source-files, so we:
> > 1. Don't end up accidentally editing installed files that will be
> > overwritten during the next installation
> > 2. Can do refactoring across project/target boundaries
> > 3. Have better navigation
> > 4. Source changes can already take effect within kdevelop before the
> > project is installed
> Ok, so do you want this to work for .h only, or also for targets
> (libs/executables), datafiles and so on?

C++ support only needs it for source files(.h, .hpp, however they're called)

> Would it be enough for C++ support if you can prefer in-project-headers
> before out-of-project headers? That is if we provide a method to tell
> you "this include dir is inside the project source or builddir and this
> other is not"? Or do you really want something like

No, because the C++ support precisely follows the include-path, and needs to 
know where in the source a specific installed header is located. Just 
guessing the correct location by using the filename or the parsed content 
would be a not very reliable hack, although it would be a good idea as 
fallback solution when the build-system doesn't know(like custom makefiles).

> ProjectItem* getSourceForInstalledFile( const KUrl& url )
> Note that the latter might be a lot slower than the former (or more
> memory-extensive due to storing a reverse map of installed files to
> source files).

Yes but this would be the right solution. It would cost nearly no additional 
memory if we'd use a map IndexedString -> IndexedString, because the 
file-names will be indexed anyway by the du-chain(so its just integers 
mapping to integers).

Thinking of it, maybe the simplest solution would be just adding 
an "addMap(IndexedString installed, IndexedString source)" function to 
DUChain, and the build-system could call that function while parsing the 
project files.

Greetings, David

More information about the KDevelop-devel mailing list