Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -413,6 +413,12 @@ endif() endif () +if (MSVC) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /FS") + endif() +endif() + # Determine HOST_LINK_VERSION on Darwin. set(HOST_LINK_VERSION) if (APPLE) Index: clang/lib/ASTMatchers/Dynamic/CMakeLists.txt =================================================================== --- clang/lib/ASTMatchers/Dynamic/CMakeLists.txt +++ clang/lib/ASTMatchers/Dynamic/CMakeLists.txt @@ -3,15 +3,6 @@ Support ) -# The registry source file ends up generating a lot of sections for each -# matcher. Each matcher appears to get a vtable and several methods. Each -# method needs .text, .pdata, .xdata, and .debug sections, adding to the -# section multiplier. By default MSVC has a 2^16 limit on the number of -# sections in an object file, and this needs more than that. -if (MSVC) - set_source_files_properties(Registry.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() - add_clang_library(clangDynamicASTMatchers Diagnostics.cpp Marshallers.cpp Index: clang/lib/CodeGen/CMakeLists.txt =================================================================== --- clang/lib/CodeGen/CMakeLists.txt +++ clang/lib/CodeGen/CMakeLists.txt @@ -35,10 +35,6 @@ set(codegen_deps) endif() -if (MSVC) - set_source_files_properties(CodeGenModule.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() - add_clang_library(clangCodeGen BackendUtil.cpp CGAtomic.cpp Index: clang/lib/Sema/CMakeLists.txt =================================================================== --- clang/lib/Sema/CMakeLists.txt +++ clang/lib/Sema/CMakeLists.txt @@ -3,15 +3,6 @@ Support ) -if (MSVC) - set_source_files_properties(SemaDeclAttr.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SemaExpr.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SemaExprCXX.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SemaTemplate.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SemaTemplateDeduction.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SemaOpenMP.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() - clang_tablegen(OpenCLBuiltins.inc -gen-clang-opencl-builtins SOURCE OpenCLBuiltins.td TARGET ClangOpenCLBuiltinsImpl Index: clang/unittests/AST/CMakeLists.txt =================================================================== --- clang/unittests/AST/CMakeLists.txt +++ clang/unittests/AST/CMakeLists.txt @@ -3,9 +3,6 @@ Support ) -if (MSVC) - set_source_files_properties(ASTImporterTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() add_clang_unittest(ASTTests ASTContextParentMapTest.cpp Index: clang/unittests/ASTMatchers/CMakeLists.txt =================================================================== --- clang/unittests/ASTMatchers/CMakeLists.txt +++ clang/unittests/ASTMatchers/CMakeLists.txt @@ -3,15 +3,6 @@ Support ) -# By default MSVC has a 2^16 limit on the number of sections in an object file, -# and this needs more than that. -if (MSVC) - set_source_files_properties(InternalASTMatchersTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(NodeMatchersTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(NarrowingMatchersTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(ASTTraversalMatchersTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() - add_clang_unittest(ASTMatchersTests ASTMatchersInternalTest.cpp ASTMatchersNodeTest.cpp Index: clang/unittests/Tooling/CMakeLists.txt =================================================================== --- clang/unittests/Tooling/CMakeLists.txt +++ clang/unittests/Tooling/CMakeLists.txt @@ -4,14 +4,6 @@ Support ) -# By default MSVC has a 2^16 limit on the number of sections in an object file, -# and this needs more than that. -if (MSVC) - set_source_files_properties(RecursiveASTVisitorTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(RecursiveASTVisitorTestExprVisitor.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(RecursiveASTVisitorTests/Callbacks.cpp PROPERTIES COMPILE_FLAGS /bigobj) - set_source_files_properties(SourceCodeTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() add_clang_unittest(ToolingTests ASTSelectionTest.cpp Index: lldb/source/API/CMakeLists.txt =================================================================== --- lldb/source/API/CMakeLists.txt +++ lldb/source/API/CMakeLists.txt @@ -126,9 +126,6 @@ set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH "${PYTHON_RPATH}") endif() -if (MSVC) - set_source_files_properties(SBReproducer.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() if(lldb_python_wrapper) add_dependencies(liblldb swig_wrapper) Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ llvm/CMakeLists.txt @@ -600,6 +600,12 @@ message(FATAL_ERROR "Cannot enable BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB. We recommend disabling BUILD_SHARED_LIBS.") endif() +if (MSVC) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") + endif() +endif() + option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF) if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS OR CMAKE_CONFIGURATION_TYPES))) set(LLVM_USE_HOST_TOOLS ON) Index: llvm/lib/Passes/CMakeLists.txt =================================================================== --- llvm/lib/Passes/CMakeLists.txt +++ llvm/lib/Passes/CMakeLists.txt @@ -1,7 +1,3 @@ -if (MSVC) - set_source_files_properties(PassBuilder.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() - add_llvm_component_library(LLVMPasses PassBuilder.cpp PassPlugin.cpp Index: mlir/lib/Dialect/SPIRV/CMakeLists.txt =================================================================== --- mlir/lib/Dialect/SPIRV/CMakeLists.txt +++ mlir/lib/Dialect/SPIRV/CMakeLists.txt @@ -1,6 +1,3 @@ -if (MSVC) - set_source_files_properties(SPIRVDialect.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() set(LLVM_TARGET_DEFINITIONS SPIRVCanonicalization.td) mlir_tablegen(SPIRVCanonicalization.inc -gen-rewriters)