[cfe-dev] Build one translation-unit out of multiple source-files

Douglas Gregor dgregor at apple.com
Mon Mar 21 04:17:06 PDT 2011


On Mar 21, 2011, at 11:35 AM, Hendrik vP wrote:

> As the subject says: Is it possible to build one translation-unit out of multiple source-files?
> I copied the source to create a compilerinstance from
> https://github.com/gwaredd/reflector/blob/master/src/Reflector.cpp
> For every inputfile, the FileManager, SourceManager, Preprocessor, ASTContext and
> Sema will be recreated. Thus, every sourcefile ends up in it's own TranslationUnit.
> I am aware of the possibility to simply include all given sourcefiles inside a temporary 
> sourcefile - it works, but it feels 'hacky'. 
> Any suggestions?

I don't think there's a better way to do it within the Clang parser. You might be able to link the bitcode files together using the LLVM linker (llvm-ld).

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110321/cbd21333/attachment.html>


More information about the cfe-dev mailing list