[llvm-dev] Can I build llvm with only a handful of source files compiled for debug?

Mark de Wever via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 17 03:46:25 PDT 2019


On Wed, Aug 14, 2019 at 06:40:17PM +0000, Robert Henry via llvm-dev wrote:
> In order to minimize edit/compile/debug turn time, is there a way to
> compile llvm tools so that the majority of the files are compiled as
> if for release (eg, no debug symbols), and only the handful of files
> that I have touched are compiled for debugging? This will reduce the
> load on the file system, linker and gdb tremendously.  At present,
> AFAICT, it's all or nothing.

Disclaimer I have only tested this while working on Clang, but I assume
it works for the entire LLVM project.

I have enabled shared libraries in CMake. Then I add the following lines
to the CMakeLists.txt, for example clang/lib/Parse/CMakeLists.txt

set_source_files_properties(
  ParseDeclCXX.cpp
  ParseDecl.cpp
  Parser.cpp
  ParseStmt.cpp
  ParseExpr.cpp
  ParseExprCXX.cpp
  ParseInit.cpp

  PROPERTIES
  COMPILE_FLAGS "-O0 -g"
)

Then rebuild the clangParse target and have the debug symbols available.
Hope this helps.


Kind regards,
Mark de Wever


More information about the llvm-dev mailing list