[llvm-branch-commits] [cfe-branch] r134816 - in /cfe/branches/type-system-rewrite: ./ lib/CodeGen/CGDecl.cpp test/SemaCXX/warn-unreachable.cpp tools/driver/cc1_main.cpp

Chris Lattner sabre at nondot.org
Sat Jul 9 09:23:40 PDT 2011


Author: lattner
Date: Sat Jul  9 11:23:40 2011
New Revision: 134816

URL: http://llvm.org/viewvc/llvm-project?rev=134816&view=rev
Log:
Merging r134806 through r134815 from mainline.


Modified:
    cfe/branches/type-system-rewrite/   (props changed)
    cfe/branches/type-system-rewrite/lib/CodeGen/CGDecl.cpp
    cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/type-system-rewrite/tools/driver/cc1_main.cpp

Propchange: cfe/branches/type-system-rewrite/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul  9 11:23:40 2011
@@ -1,2 +1,2 @@
-/cfe/trunk:134685-134804
+/cfe/trunk:134685-134804,134806-134815
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGDecl.cpp?rev=134816&r1=134815&r2=134816&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGDecl.cpp Sat Jul  9 11:23:40 2011
@@ -1099,13 +1099,23 @@
 
 CodeGenFunction::Destroyer &
 CodeGenFunction::getDestroyer(QualType::DestructionKind kind) {
-  // GCC 4.2 requires the *& on these function references.
+  // This is surprisingly compiler-dependent.  GCC 4.2 can't bind
+  // references to functions directly in returns, and using '*&foo'
+  // confuses MSVC.  Luckily, the following code pattern works in both.
+  Destroyer *destroyer = 0;
   switch (kind) {
   case QualType::DK_none: llvm_unreachable("no destroyer for trivial dtor");
-  case QualType::DK_cxx_destructor: return *&destroyCXXObject;
-  case QualType::DK_objc_strong_lifetime: return *&destroyARCStrongPrecise;
-  case QualType::DK_objc_weak_lifetime: return *&destroyARCWeak;
+  case QualType::DK_cxx_destructor:
+    destroyer = &destroyCXXObject;
+    break;
+  case QualType::DK_objc_strong_lifetime:
+    destroyer = &destroyARCStrongPrecise;
+    break;
+  case QualType::DK_objc_weak_lifetime:
+    destroyer = &destroyARCWeak;
+    break;
   }
+  return *destroyer;
 }
 
 void CodeGenFunction::pushDestroy(CleanupKind cleanupKind, llvm::Value *addr,

Propchange: cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul  9 11:23:40 2011
@@ -1 +1 @@
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,134685-134804
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,134685-134804,134806-134815

Modified: cfe/branches/type-system-rewrite/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/tools/driver/cc1_main.cpp?rev=134816&r1=134815&r2=134816&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/tools/driver/cc1_main.cpp (original)
+++ cfe/branches/type-system-rewrite/tools/driver/cc1_main.cpp Sat Jul  9 11:23:40 2011
@@ -126,6 +126,7 @@
 
   // Initialize targets first, so that --version shows registered targets.
   llvm::InitializeAllTargets();
+  llvm::InitializeAllMCSubtargetInfos();
   llvm::InitializeAllAsmPrinters();
   llvm::InitializeAllAsmParsers();
 





More information about the llvm-branch-commits mailing list