[llvm-commits] [llvm] r111535 - /llvm/trunk/lib/CodeGen/SplitKit.cpp

Michael J. Spencer bigcheesegs at gmail.com
Thu Aug 19 11:16:39 PDT 2010


Author: mspencer
Date: Thu Aug 19 13:16:39 2010
New Revision: 111535

URL: http://llvm.org/viewvc/llvm-project?rev=111535&view=rev
Log:
Fix the msvc 2010 build.

The Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
implements parts of C++0x based on the draft standard. An old version of
the draft had a bug that makes std::pair<T1*, T2*>(something, 0) fail to
compile. This is because the template<class U, class V> pair(U&& x, V&& y)
constructor is selected, even though it later fails to implicitly convert
U and V to frist_type and second_type.

This has been fixed in n3090, but it seems that Microsoft is not going to
update msvc.

Modified:
    llvm/trunk/lib/CodeGen/SplitKit.cpp

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=111535&r1=111534&r2=111535&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Aug 19 13:16:39 2010
@@ -352,7 +352,16 @@
 
   // This is a complex def. Mark with a NULL in valueMap.
   VNInfo *OldVNI =
-    valueMap_.insert(ValueMap::value_type(ParentVNI, 0)).first->second;
+    valueMap_.insert(
+      ValueMap::value_type(ParentVNI, static_cast<VNInfo *>(0))).first->second;
+      // The static_cast<VNInfo *> is only needed to work around a bug in an
+      // old version of the C++0x standard which the following compilers
+      // implemented and have yet to fix:
+      //
+      // Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
+      // Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
+      //
+      // If/When we move to C++0x, this can be replaced by nullptr.
   (void)OldVNI;
   assert(OldVNI == 0 && "Simple/Complex values mixed");
 
@@ -371,7 +380,15 @@
 
   // Use insert for lookup, so we can add missing values with a second lookup.
   std::pair<ValueMap::iterator,bool> InsP =
-    valueMap_.insert(ValueMap::value_type(ParentVNI, 0));
+    valueMap_.insert(ValueMap::value_type(ParentVNI, static_cast<VNInfo *>(0)));
+    // The static_cast<VNInfo *> is only needed to work around a bug in an
+    // old version of the C++0x standard which the following compilers
+    // implemented and have yet to fix:
+    //
+    // Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
+    // Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
+    //
+    // If/When we move to C++0x, this can be replaced by nullptr.
 
   // This was an unknown value. Create a simple mapping.
   if (InsP.second)





More information about the llvm-commits mailing list