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

Michael Spencer bigcheesegs at gmail.com
Thu Mar 1 13:18:33 PST 2012


On Thu, Mar 1, 2012 at 12:02 PM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
>
> 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;
>>
>>

Ugg, I sent the wrong version of the patch. I already fixed both of
those issues. intrin.h is needed for __cpuid.

Attached is the correct version.

- Michael Spencer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vs11-2.patch
Type: application/octet-stream
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120301/117f1b42/attachment.obj>


More information about the llvm-commits mailing list