[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 13 06:29:27 PDT 2024


Meinersbur wrote:

@AaronBallman Thanks for having a look.

> With this patch, I get errors when loading a visual studio solution generated with these change, and all of clang's libraries are placed at the top level. The error is a dialog box saying "The solution already contains an item named 'clang'."

I got similar errors with "Unittest" and "UnitTest". I only solved it by using "Unit". I am assuming this is because there is something else already with that name but inconsistent case. I never for this for "Clang"/"clang", but it could be when not all patches from the series are applied. Specifically I think clang-tools-extra may use "Clang"/"clang".

> Another thing (that is existing behavior) worth noting is that at some point, we lost the ability to browse directly to files in Visual Studio. Instead of going to `Clang Libraries->clangDriver->Source Files->ToolChain.cpp`, you have to go to `Object Libraries->obj.clangDriver->Source Files->ToolChain.cpp` which is pretty strange. Your patch doesn't change this, but if we're correcting folder structure behavior, we should probably address that at the same time if we can.

This is how CMake handles object libraries. There is one target `obj.clangDriver` that builds all the *.obj file, and a library that is not used. The target `clangDriver` then has a dependency on `obj.clangDriver` and has its *.obj files added, but not the source files. This is to be able to link a static library (`clangDriver_static`) and a dynamic library (`clangDriver`) at the [same time](https://github.com/llvm/llvm-project/blob/ca1bd5995f6ed934f9187305190a5abfac049173/llvm/cmake/modules/AddLLVM.cmake#L593) but compiling the source files just once. I don't know the reason, but in contrast to other subprojects Clang uses this build mode [even when building just one library](https://github.com/llvm/llvm-project/blob/ca1bd5995f6ed934f9187305190a5abfac049173/clang/cmake/modules/AddClang.cmake#L102). 

There is an exception for XCode, and we could do the same for MSVC (or add the source files as `ADDITIONAL_HEADERS` to make them show up). However, for this patch series I did not intent to change anything about how the build system works.

https://github.com/llvm/llvm-project/pull/89743


More information about the llvm-branch-commits mailing list