[LLVMdev] Labeling builds as Release/Debug (was: -version displays DEBUG on Visual C++ release build)

Óscar Fuentes ofv at wanadoo.es
Mon Feb 15 03:57:39 PST 2010

Russell Wallace <russell.wallace at gmail.com> writes:

> C:\llvm\bin>llc -version
> Low Level Virtual Machine (http://llvm.org/):
>   llvm version 2.6svn
>   DEBUG build.
>   Built Jan 31 2010(20:46:01).
>   Registered Targets:
>     x86    - 32-bit X86: Pentium-Pro and above
>     x86-64 - 64-bit X86: EM64T and AMD64
> I did specify the release build with cmake; the lack of crashing on
> exit of programs compiled therewith confirms that :-) As far as I can
> see, the reason for the incorrect reporting is in CommandLine.cpp:
> #ifndef __OPTIMIZE__
>         cout << "DEBUG build";
> #else
>         cout << "Optimized build";
> #endif
> According to a Google search, gcc sets __OPTIMIZE__ when -O2 or better
> is used, so presumably that's the intent of the above and the reason
> it doesn't work with Visual C++.

This doesn't seems right to me. A debug build is has debug symbols and
asserts enabled, while a release build has not. The activation of
optimizations doesn't imply a release build. A slightly better criteria
is the presence of NDEBUG, which is enabled by default on release builds
by configure and cmake, and has the advantage of being portable.

More information about the llvm-dev mailing list