clang and options

<cc'ing cfe dev>

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:

This causes typical .SUFFIX rules for .c.o such as this to fail:

        ${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 :slight_smile:

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.