svn commit: r243781 - stable/9/contrib/llvm/tools/clang/lib/CodeGen

Dimitry Andric dim at FreeBSD.org
Sun Dec 2 00:31:23 UTC 2012


Author: dim
Date: Sun Dec  2 00:31:23 2012
New Revision: 243781
URL: http://svnweb.freebsd.org/changeset/base/243781

Log:
  Pull in r158245 from upstream clang:
  
    [C++11 Compat] Fix breaking change in C++11 pair copyctor.
  
    While this code is valid C++98, it is not valid C++11. The problem
    can be reduced to:
  
    class MDNode;
  
    class DIType {
      operator MDNode*() const {return 0;}
    };
  
    class WeakVH {
      WeakVH(MDNode*) {}
    };
  
    int main() {
      DIType di;
      std::pair<void*, WeakVH> p(std::make_pair((void*)0, di)));
    }
  
    This was not detected by any of the bots we have because they either
    compile C++98 with libstdc++ (which allows it), or C++11 with libc++
    (which incorrectly allows it). I ran into the problem when compiling
    with VS 2012 RC.
  
    Thanks to Richard for explaining the issue.
  
  This fixes building clang 3.1 on stable/9 with libc++ in C++11 mode.
  
  This is a direct commit to stable/9, since there is no separate commit
  in head which has just this particular change, and I do not want to do a
  full import at this time.
  
  Reported by:	Marco Bröder <marco.broeder at gmx.eu>

Modified:
  stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp

Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Sat Dec  1 22:13:38 2012	(r243780)
+++ stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Sun Dec  2 00:31:23 2012	(r243781)
@@ -1692,7 +1692,8 @@ llvm::DIType CGDebugInfo::getOrCreateTyp
 
   llvm::DIType TC = getTypeOrNull(Ty);
   if (TC.Verify() && TC.isForwardDecl())
-    ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(), TC));
+    ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(),
+                                        static_cast<llvm::Value*>(TC)));
   
   // And update the type cache.
   TypeCache[Ty.getAsOpaquePtr()] = Res;
@@ -1803,7 +1804,8 @@ llvm::DIType CGDebugInfo::getOrCreateLim
   llvm::DIType Res = CreateLimitedTypeNode(Ty, Unit);
 
   if (T.Verify() && T.isForwardDecl())
-    ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(), T));
+    ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(),
+                                        static_cast<llvm::Value*>(T)));
 
   // And update the type cache.
   TypeCache[Ty.getAsOpaquePtr()] = Res;


More information about the svn-src-all mailing list