[cfe-dev] Clang++ can't compile a simple hello world program.

Dimitry Andric dimitry at andric.com
Sat Sep 11 05:32:09 PDT 2010


On 2010-09-11 13:18, Anton Korobeynikov wrote:
>> http://llvm.org/bugs/show_bug.cgi?id=7276#c3
>>
>> I have no idea why this isn't committed yet...
> Committed, thanks. For me it looks like slightly hacky, I don't pretty
> much like OS checks in the driver.
> Is it possible to move the check somewhere else? To some target-dependent part?

Probably, but this kind of stuff is done all over in Tools.cpp:

   // Enable -mconstructor-aliases except on darwin, where we have to
   // work around a linker bug;  see <rdar://problem/7651567>.
   if (getToolChain().getTriple().getOS() != llvm::Triple::Darwin)
     CmdArgs.push_back("-mconstructor-aliases");

...

   // -fms-extensions=0 is default.
   if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
                    getToolChain().getTriple().getOS() == llvm::Triple::Win32))
     CmdArgs.push_back("-fms-extensions");

...

   // -fnext-runtime defaults to on Darwin and when rewriting Objective-C, and is
   // -the -cc1 default.
   bool NeXTRuntimeIsDefault =
     IsRewriter || getToolChain().getTriple().getOS() == llvm::Triple::Darwin;
   if (!Args.hasFlag(options::OPT_fnext_runtime, options::OPT_fgnu_runtime,
                     NeXTRuntimeIsDefault))
     CmdArgs.push_back("-fgnu-runtime");

I think it falls under the category "ugly but necessary". :)



More information about the cfe-dev mailing list