From b2f4ac077217c6bab2a37c6f244322d5ec97bd36 Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 26 Jan 2013 15:52:55 +0100 Subject: [PATCH 1/3] Do not mix release and debug build for MSVC --- runtime/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 39cc92a9..07b657cc 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -315,10 +315,12 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix outlist_targ dc(${f} "${d_flags}" "${RUNTIME_DIR}" "${target_suffix}" DCRT_O DCRT_BC) endforeach() - # Always build zlib and other C parts of the runtime in release mode. - set_source_files_properties(${CORE_C} ${DCRT_C} PROPERTIES - COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}" - ) + if(NOT MSVC) + # Always build zlib and other C parts of the runtime in release mode. + set_source_files_properties(${CORE_C} ${DCRT_C} PROPERTIES + COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}" + ) + endif() if(EXISTS ${RUNTIME_DIR}) set(GCCBUILTINS "${PROJECT_BINARY_DIR}/gccbuiltins_x86.di") From 26385c55fe55531f7306ef5025ff947540235f31 Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 26 Jan 2013 16:27:20 +0100 Subject: [PATCH 2/3] More LLVM 3.3 changes to the AttributeSet class. --- gen/functions.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gen/functions.cpp b/gen/functions.cpp index 989bf6e2..238b0df5 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -612,7 +612,15 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati llvm::AttrListPtr oldAttrs = func->getAttributes(); #endif for (size_t i = 0; i < oldAttrs.getNumSlots(); ++i) { +#if LDC_LLVM_VER >= 303 + llvm::AttributeWithIndex curr = llvm::AttributeWithIndex::get(oldAttrs.getSlotIndex(i), + llvm::Attribute::get( + gIR->context(), + llvm::AttrBuilder(oldAttrs.getSlotAttributes(i), + oldAttrs.getSlotIndex(i)))); +#else llvm::AttributeWithIndex curr = oldAttrs.getSlot(i); +#endif bool found = false; for (size_t j = 0; j < newSize; ++j) { From c0284bac2b9124ea7f6a2363bc57321e904782af Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 26 Jan 2013 17:34:08 +0100 Subject: [PATCH 3/3] 2nd attempt on the latest LLVM 3.3 changes. The previous commit only worked on Windows. --- gen/functions.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index 238b0df5..b8d70f0c 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -613,11 +613,12 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati #endif for (size_t i = 0; i < oldAttrs.getNumSlots(); ++i) { #if LDC_LLVM_VER >= 303 - llvm::AttributeWithIndex curr = llvm::AttributeWithIndex::get(oldAttrs.getSlotIndex(i), + const unsigned Index = oldAttrs.getSlotIndex(i); + llvm::AttrBuilder &builder = llvm::AttrBuilder(oldAttrs.getSlotAttributes(i), Index).addAttribute(llvm::Attribute::None); + llvm::AttributeWithIndex curr = llvm::AttributeWithIndex::get(Index, llvm::Attribute::get( gIR->context(), - llvm::AttrBuilder(oldAttrs.getSlotAttributes(i), - oldAttrs.getSlotIndex(i)))); + builder)); #else llvm::AttributeWithIndex curr = oldAttrs.getSlot(i); #endif