[cfe-dev] Clang as a compiler-only tool

Roman Divacky rdivacky at freebsd.org
Sun Nov 18 04:16:38 PST 2012


Hi,

In FreeBSD we recently switched to clang as the default compiler. We have
clang/llvm sources imported in FreeBSD and build it using our own buildsystem.
We use clang only as a compiler, we dont need ARCMT, StaticAnalyzer, Rewriter,
etc.

Currently there's no simple way how to compile clang as compiler-only tool.
ARCMT, StaticAnalyzer etc. are always compiled and linked in. In FreeBSD
this only takes time and space. There is no way how to disable building
and linking of ARCMT, StaticAnalyzer etc.

I would like to ask about your opinion on the attached trivial patch, which
introduces #ifndef CLANG_IS_COMPILER_ONLY in two places. This enables
me to not compile/link:

ASTMatchers, StaticAnalyzer, Edit, Rewrite, ARCMigrate and Serialization

Resulting in significant reduction in compile time of clang and ~2MB in
the size of the clang binary.

I intend this to be used in FreeBSD buildsystem but it can be easily added
to autotools/cmake builds as well if people find it useful.

Do you think this is useful? Should it be done like this or in some other way?
Is the patch ok to be committed?

Thanks, Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-as-a-compiler-only.patch
Type: text/x-diff
Size: 1359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121118/3a489235/attachment.patch>


More information about the cfe-dev mailing list