]> granicus.if.org Git - clang/commitdiff
Add more compiler workarounds. Should fix the build with old GCCs and MSVC.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 12 Jul 2011 18:37:23 +0000 (18:37 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 12 Jul 2011 18:37:23 +0000 (18:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index 90bdd5caf6c7dd23aef614f7f79d9c2f4e8b24b6..1d955041dd80c24247a04e81841398c6f3ce9615 100644 (file)
@@ -475,20 +475,24 @@ CodeGenFunction::EmitReferenceBindingToExpr(const Expr *E,
     case Qualifiers::OCL_Strong: {
       bool precise = VD && VD->hasAttr<ObjCPreciseLifetimeAttr>();
       CleanupKind cleanupKind = getARCCleanupKind();
-      pushDestroy(cleanupKind, ReferenceTemporary,
-                  ObjCARCReferenceLifetimeType,
-                  precise ? destroyARCStrongPrecise : destroyARCStrongImprecise,
-                  cleanupKind & EHCleanup);
+      // This local is a GCC and MSVC compiler workaround.
+      Destroyer *destroyer = precise ? &destroyARCStrongPrecise :
+                                       &destroyARCStrongImprecise;
+      pushDestroy(cleanupKind, ReferenceTemporary, ObjCARCReferenceLifetimeType,
+                  *destroyer, cleanupKind & EHCleanup);
       break;
     }
         
-    case Qualifiers::OCL_Weak:
+    case Qualifiers::OCL_Weak: {
+      // This local is a GCC and MSVC compiler workaround.
+      Destroyer *destroyer = &destroyARCWeak;
       // __weak objects always get EH cleanups; otherwise, exceptions
       // could cause really nasty crashes instead of mere leaks.
       pushDestroy(NormalAndEHCleanup, ReferenceTemporary,
-                  ObjCARCReferenceLifetimeType, destroyARCWeak, true);
+                  ObjCARCReferenceLifetimeType, *destroyer, true);
       break;        
     }
+    }
   }
   
   return RValue::get(Value);