[cfe-dev] Compiler arguments for clang_parseTranslationUnit

Douglas Gregor dgregor at apple.com
Tue Feb 15 14:34:32 PST 2011


On Feb 15, 2011, at 2:30 PM, Stefan Seefeld wrote:

> On 2011-02-15 17:11, Douglas Gregor wrote:
>> 
>> 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.
> 
> I see, thanks. How are the built-in macros determined that clang defines ? Can I disable them with something similar to -nostdinc ?

No, those depend on the target (which you can hack with -ccc-host-triple) and on language-setting flags.

> The current Synopsis logic allows users to specify a compiler to emulate.
> If this is a GCC variant, I query the compiler itself for macros and headers (via `g++ -E -v -dD ...`)
> If it is a MSVC compiler, I use hardcoded sets of flags.
> 
> This logic requires that the parser then doesn't add its own set of macros, as those may actually conflict with what I feed in from the above.

I don't have a good solution for this. Clang knows how to emulate other compilers to some extent; you're probably better off using -ccc-host-triple to pick an appropriate target.

	- Doug



More information about the cfe-dev mailing list