[cfe-dev] Cross Translation Unit Support in Clang

Jacob Carlborg via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 30 01:53:58 PDT 2017


On 2017-06-28 19:48, Noah L via cfe-dev wrote:

> Ok, so converting a source file (potentially) modifies the file itself
> and any included header files as well. The problem is when multiple
> source files include the same header file, because conversion of a
> source file requires the included header files to be in their original
> form. They can't have been modified by a previous conversion of another
> source file. So after (individually) converting all the source files in
> a project, you can end up with multiple versions of a header file that
> were modified in different ways by the conversions of different source
> files. Right? (An example[2].)

What if you only modify the file that was given to the tool? I.e. don't 
modify the header files. Would that work?

In my tool I ignore everything that is not declared in the file given to 
the tool [1].

You could also copy the files and do the transformation on the copies. 
Might be a better idea anyway, to avoid overwriting the original files.

[1] 
https://github.com/jacob-carlborg/dstep/blob/master/dstep/translator/Translator.d#L315

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list