[cfe-dev] clang and options

Chris Lattner clattner at apple.com
Mon Jul 23 14:57:50 PDT 2007


<cc'ing cfe dev>

On Jul 23, 2007, at 2:48 PM, Jeroen Ruigrok van der Werven wrote:

> what I find funny/odd is the fact that clang supports neither -c or  
> -o, fairly
> standardized option flags.
> Even OpenGroup specifies them for c99:
> http://www.opengroup.org/onlinepubs/000095399/utilities/c99.html

> This causes typical .SUFFIX rules for .c.o such as this to fail:
>
> .c.o:
>         ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
>
> This is pretty common for the BSD's with their /usr/share/mk/*.mk  
> files.

Yep, they are completely missing.

The clang codegen support is extremely limited right now.  At present  
it only handles simple scalars, arrays and vectors.  It have very  
limited support for complex numbers and no support for structs/ 
unions.  If you want to try it out, use the -emit-llvm option, which  
will emit a LLVM ".ll" file to standard out.  To compile it, use  
something like:

$ clang test.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -o  
test.s

At some point, I'll hook up -S to do that, and -c to do that plus  
invoke the system assembler.  In the meantime, it's a good thing that  
we don't pretend that codegen is ready :)


In the short term, we're focusing primarily on getting -fsyntax-only  
right.  There are a small (and shrinking) collection of semantic  
checks that we don't perform (i.e. invalid code that should be  
rejected).  We also do not emit many important warnings that GCC and  
other compilers do, and these are very important for end users (and  
thus, is a requirement before clang can be generally useful for  
developers).  That said, to me at least, warnings are less important  
than codegen.

-Chris



More information about the cfe-dev mailing list