[llvm-commits] [PATCH] Minimal changes to compile under VS11

Benjamin Kramer benny.kra at googlemail.com
Thu Mar 1 12:02:10 PST 2012


On 01.03.2012, at 20:54, Michael Spencer wrote:

> diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
> index 0a5c02f..96f091b 100644
> --- a/cmake/modules/HandleLLVMOptions.cmake
> +++ b/cmake/modules/HandleLLVMOptions.cmake
> @@ -136,6 +136,10 @@ endif()
>  if( MSVC )
>    include(ChooseMSVCCRT)
>  
> +  if (MSVC11)
> +    add_llvm_definitions(-D_VARIADIC_MAX=10)
> +  endif()

ok

> +
>    # Add definitions that make MSVC much less annoying.
>    add_llvm_definitions(
>      # For some reason MS wants to deprecate a bunch of standard functions...
> diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> index 920f82d..006bc28 100644
> --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -530,7 +530,9 @@ unsigned DwarfDebug::GetOrCreateSourceID(StringRef FileName,
>  
>    std::map<std::pair<std::string, std::string>, unsigned>::iterator I;
>    bool NewlyInserted;
> -  tie(I, NewlyInserted) = SourceIdMap.insert(Entry);
> +  std::pair<std::map<std::pair<std::string, std::string>, unsigned>::iterator, bool> blah = SourceIdMap.insert(Entry);
> +  I = blah.first;
> +  NewlyInserted = blah.second;

ugly, but I don't see what's wrong here either. Can you write the declaration & initialization in a single line and make sure you don't violate 80 cols?

>    if (!NewlyInserted)
>      return I->second;
>  
> diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
> index 5ca592d..88c5635 100644
> --- a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
> +++ b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
> @@ -36,6 +36,8 @@
>  #define GET_SUBTARGETINFO_MC_DESC
>  #include "X86GenSubtargetInfo.inc"
>  
> +#include <intrin.h>
> +

<intrin.h> doesn't exist on non-windows platforms. Why is it needed here?

>  using namespace llvm;
>  
>  




More information about the llvm-commits mailing list