[LLVMdev] -version displays DEBUG on Visual C++ release build

Russell Wallace russell.wallace at gmail.com
Sat Feb 13 21:41:03 PST 2010

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";
        cout << "Optimized build";

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++.

I'd ideally like my compiler to report the version of llvm it was
linked with (as well as its own version), so output of incorrect
information is a problem. Does anyone know of a solution to this?

More information about the llvm-dev mailing list