It's pulling in all kinds of unused things (e.g, at this time of
writing, clang-tidy!). This needlessly slows down every build of lldb.
This passes check-lldb.
Differential D22987
[lldb][cmake] Remove libclang as an lldbBase dependency (NFCI) vsk on Jul 29 2016, 5:16 PM. Authored by
Details It's pulling in all kinds of unused things (e.g, at this time of This passes check-lldb.
Diff Detail
Event TimelineComment Actions Along with D22986, this patch removes 453 dependencies from the lldb target. Pre-patch : ninja lldb 3814.81s user 340.08s system 361% cpu 19:08.84 total Post-patch: ninja lldb 2485.63s user 227.54s system 371% cpu 12:09.50 total So, a roughly 36% decrease in the time it takes to do a clean build. I didn't average the trial runs (1 sample each) or run perf stabilization. Ultimately, Comment Actions For me: with patch: command took 0:8:6.80 (486.80s total) without patch: command took 0:10:49.74 (649.74s total) So almost exactly a 25% savings. Pretty respectable. Do we at least need to add a dependency on the clang-tblgen target? Or is this ok without that? Comment Actions I can't find any #includes of headers installed by the 'install-clang-headers' There could be a 'gotcha' here if there's some library we're not building along For now, I don't think we need to add a 'clang-tblgen' dependency. Comment Actions check-lldb isn't the problem so as much as simply guaranteeing that the clang headers are auto-generated *before* we compile any part of LLDB that attempts to #include them. I don't know what the exact right target is to build in this case, but we need a way to ensure that headers are auto-generated before compiling a library that #includes those headers. In fact, I just did a clean build with the patch and got errors: -- Build files have been written to: D:/src/llvmbuild/ninja [368/2856] Building CXX object tools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectMemory.cpp.obj FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLDB_DISABLE_CURSES -DLLDB_DISABLE_LIBEDIT -DLLDB_PYTHON_HOME=\"C:/Python35\" -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\lldb\source\Commands -ID:\src\llvm\tools\lldb\source\Commands -ID:\src\llvm\tools\lldb\include -Itools\lldb\include -Iinclude -ID:\src\llvm\include -IC:\Python35\Include -ID:\src\llvm\tools\clang\include -Itools\lldb\..\clang\include -ID:\src\llvm\tools\lldb\source\. /DWIN32 /D_WINDOWS /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /Zc:sizedDealloc- /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -wd4018 -wd4068 -wd4150 -wd4251 -wd4521 -wd4530 /D _UNICODE /D UNICODE /EHs-c- /GR- /showIncludes /Fotools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectMemory.cpp.obj /Fdtools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\ /FS -c D:\src\llvm\tools\lldb\source\Commands\CommandObjectMemory.cpp D:\src\llvm\tools\clang\include\clang/Basic/DiagnosticIDs.h(53): fatal error C1083: Cannot open include file: 'clang/Basic/DiagnosticCommonKinds.inc': No such file or directory [368/2856] Building CXX object tools\lldb\source\Breakpoint\CMakeFiles\lldbBreakpoint.dir\Watchpoint.cpp.obj FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLDB_DISABLE_CURSES -DLLDB_DISABLE_LIBEDIT -DLLDB_PYTHON_HOME=\"C:/Python35\" -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\lldb\source\Breakpoint -ID:\src\llvm\tools\lldb\source\Breakpoint -ID:\src\llvm\tools\lldb\include -Itools\lldb\include -Iinclude -ID:\src\llvm\include -IC:\Python35\Include -ID:\src\llvm\tools\clang\include -Itools\lldb\..\clang\include -ID:\src\llvm\tools\lldb\source\. /DWIN32 /D_WINDOWS /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /Zc:sizedDealloc- /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -wd4018 -wd4068 -wd4150 -wd4251 -wd4521 -wd4530 /D _UNICODE /D UNICODE /EHs-c- /GR- /showIncludes /Fotools\lldb\source\Breakpoint\CMakeFiles\lldbBreakpoint.dir\Watchpoint.cpp.obj /Fdtools\lldb\source\Breakpoint\CMakeFiles\lldbBreakpoint.dir\ /FS -c D:\src\llvm\tools\lldb\source\Breakpoint\Watchpoint.cpp D:\src\llvm\tools\clang\include\clang/AST/ASTFwd.h(22): fatal error C1083: Cannot open include file: 'clang/AST/DeclNodes.inc': No such file or directory [368/2856] Building CXX object tools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectArgs.cpp.obj FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLDB_DISABLE_CURSES -DLLDB_DISABLE_LIBEDIT -DLLDB_PYTHON_HOME=\"C:/Python35\" -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\lldb\source\Commands -ID:\src\llvm\tools\lldb\source\Commands -ID:\src\llvm\tools\lldb\include -Itools\lldb\include -Iinclude -ID:\src\llvm\include -IC:\Python35\Include -ID:\src\llvm\tools\clang\include -Itools\lldb\..\clang\include -ID:\src\llvm\tools\lldb\source\. /DWIN32 /D_WINDOWS /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /Zc:sizedDealloc- /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -wd4018 -wd4068 -wd4150 -wd4251 -wd4521 -wd4530 /D _UNICODE /D UNICODE /EHs-c- /GR- /showIncludes /Fotools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectArgs.cpp.obj /Fdtools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\ /FS -c D:\src\llvm\tools\lldb\source\Commands\CommandObjectArgs.cpp D:\src\llvm\tools\clang\include\clang/AST/ASTFwd.h(22): fatal error C1083: Cannot open include file: 'clang/AST/DeclNodes.inc': No such file or directory [368/2856] Building CXX object tools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectFrame.cpp.obj FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLDB_DISABLE_CURSES -DLLDB_DISABLE_LIBEDIT -DLLDB_PYTHON_HOME=\"C:/Python35\" -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\lldb\source\Commands -ID:\src\llvm\tools\lldb\source\Commands -ID:\src\llvm\tools\lldb\include -Itools\lldb\include -Iinclude -ID:\src\llvm\include -IC:\Python35\Include -ID:\src\llvm\tools\clang\include -Itools\lldb\..\clang\include -ID:\src\llvm\tools\lldb\source\. /DWIN32 /D_WINDOWS /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /Zc:sizedDealloc- /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -wd4018 -wd4068 -wd4150 -wd4251 -wd4521 -wd4530 /D _UNICODE /D UNICODE /EHs-c- /GR- /showIncludes /Fotools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectFrame.cpp.obj /Fdtools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\ /FS -c D:\src\llvm\tools\lldb\source\Commands\CommandObjectFrame.cpp D:\src\llvm\tools\clang\include\clang/AST/ASTFwd.h(22): fatal error C1083: Cannot open include file: 'clang/AST/DeclNodes.inc': No such file or directory [368/2856] Python script building LLDB Python wrapper ninja: build stopped: subcommand failed. I didn't get any errors the previous time because it wasn't a clean build. The headers had already been generated. So we do need to add some kind of dependency (even if it is not a link time dependency as it was with libclang) Comment Actions I can reproduce that if I build CommandObjectFrame.cpp.o in isolation. I'll take Comment Actions Make it possible to build single object files in lldb libraries. This is done by making each library depend on all CLANG_USED_LIBS. Building a single object file now forces clang-tblgen to run, so we end up with the right headers in place. We still see the speed benefit of removing the libclang dependency:
Comment Actions Are the timing results the same with this patch and the original patch, or is this one a little bit slower?
Comment Actions I'm glad you asked! While I was measuring this I went back to double-check what In this updated diff, I added an include of LLDBDependencies.cmake to make sure Here are some less bogus numbers. I've highlighted the number which changed:
Comment Actions
Comment Actions As long as everything builds and the bots are happy I am good with this as long as the other cmake experts are |