Automated porting of druntime to new platforms using libclang

Joakim joakim at airpost.net
Tue Jan 7 03:17:33 PST 2014


On Tuesday, 7 January 2014 at 07:36:36 UTC, Jacob Carlborg wrote:
>> I'm not sure if libclang
>> provides for a way to handle architecture-specific 
>> declarations either.
>
> Unfortunately it doesn't. I need some way to deal with the 
> preprocessor in DStep as well, also the Clang developers have 
> showed interested in be able to deal with the preprocesssor 
> from libclang.
>
> Clang can of course deal with this. We probably need to expose 
> an libclang API for PPCallbacks: 
> http://clang.llvm.org/doxygen/classclang_1_1PPCallbacks.html

That's too bad, as the preprocessor is important in the headers.  
Perhaps this can be finessed by passing various architectures or 
other preprocessor defines to the input of clang/libclang and 
then comparing the output of the various preprocessed files?  For 
the limited uses of the preprocessor that are translated for 
druntime, maybe that will be enough.

>> I don't have any experience with libclang, so I thought I'd 
>> run the idea
>> by you all first.  Let me know if you see any problems with 
>> this idea.
>
> Any help on improving DStep is much appreciated. I can help you 
> out if you have an questions about DStep and probably on 
> libclang as well.

At this point, I don't need such a tool, as I'm done doing most 
of it manually for Android/x86.  Maybe later, when we split linux 
from glibc and Android into linux and bionic or when I add 
Android/ARM support, we can look into building such a tool.


More information about the digitalmars-d-ldc mailing list