[cfe-dev] Compiler arguments for clang_parseTranslationUnit
dgregor at apple.com
Tue Feb 15 14:11:46 PST 2011
On Feb 15, 2011, at 1:51 PM, Stefan Seefeld wrote:
> On 2011-02-15 16:19, Douglas Gregor wrote:
>> On Feb 15, 2011, at 1:10 PM, Ehsan Akhgari wrote:
>>> I think the idea is that you just pass in argc and argv to that function so that your tool can be used as a drop-in replacement for a real compiler.
>> Yes, this is the intent.
>> And the best place to look for documentation on the command-line options Clang accepts is... the GCC documentation. Clang doesn't have a user manual describing all of its command-line options :)
> Fair enough. But which GCC would that be ? Different versions use different defaults. Can I change what compiler Clang targets / emulates ?
> For example, I have a Cell cross-compiler installed on my laptop (giving me 'ppu-g++' and 'spu-g++'). How can I make Clang use their sysroots and related flags ?
> To illustrate my use-case a little:
> I'm working on a portable library that targets different platforms. Depending on how I compile it, different backends are picked up. I'd like to be able to process that library with Synopsis to "see" all the active backends in the generated documentation, which requires it to emulate the different compilers I'd normally compile the library with.
The *real* answer would be if this actually existed:
However, you'll likely need to use -nostdinc/-nostdinc++ and a bunch of -isystem options to teach Clang to look in the right include directories.
More information about the cfe-dev