[cfe-commits] r114060 - in /cfe/trunk/lib/CodeGen: CGExprAgg.cpp CGValue.h

John McCall rjmccall at apple.com
Wed Sep 15 20:13:23 PDT 2010


Author: rjmccall
Date: Wed Sep 15 22:13:23 2010
New Revision: 114060

URL: http://llvm.org/viewvc/llvm-project?rev=114060&view=rev
Log:
Initialize AggValueSlot's flags along all paths, plus minor beautification.
Prospective fix for broken commit in r114045.


Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/lib/CodeGen/CGValue.h

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=114060&r1=114059&r2=114060&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Sep 15 22:13:23 2010
@@ -39,7 +39,7 @@
     // If the destination slot requires garbage collection, we can't
     // use the real return value slot, because we have to use the GC
     // API.
-    if (Dest.isRequiresGCollection()) return ReturnValueSlot();
+    if (Dest.requiresGCollection()) return ReturnValueSlot();
 
     return ReturnValueSlot(Dest.getAddr(), Dest.isVolatile());
   }
@@ -177,7 +177,7 @@
 /// directly into the return value slot.  If GC does interfere, a final
 /// move will be performed.
 void AggExprEmitter::EmitGCMove(const Expr *E, RValue Src) {
-  if (Dest.isRequiresGCollection()) {
+  if (Dest.requiresGCollection()) {
     std::pair<uint64_t, unsigned> TypeInfo = 
       CGF.getContext().getTypeInfo(E->getType());
     unsigned long size = TypeInfo.first/8;
@@ -210,7 +210,7 @@
     Dest = CGF.CreateAggTemp(E->getType(), "agg.tmp");
   }
 
-  if (Dest.isRequiresGCollection()) {
+  if (Dest.requiresGCollection()) {
     std::pair<uint64_t, unsigned> TypeInfo = 
     CGF.getContext().getTypeInfo(E->getType());
     unsigned long size = TypeInfo.first/8;

Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=114060&r1=114059&r2=114060&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Wed Sep 15 22:13:23 2010
@@ -347,14 +347,16 @@
   /// \param LifetimeExternallyManaged - true if the slot's lifetime
   ///   is being externally managed; false if a destructor should be
   ///   registered for any temporaries evaluated into the slot
+  /// \param RequiresGCollection - true if the slot is located
+  ///   somewhere that ObjC GC calls should be emitted for
   static AggValueSlot forAddr(llvm::Value *Addr, bool Volatile,
                               bool LifetimeExternallyManaged,
                               bool RequiresGCollection=false) {
     AggValueSlot AV;
     AV.AddrAndFlags = reinterpret_cast<uintptr_t>(Addr);
-    if (Volatile) AV.VolatileFlag = 1;
-    if (LifetimeExternallyManaged) AV.LifetimeFlag = 1;
-    if (RequiresGCollection) AV.RequiresGCollection = 1;
+    AV.VolatileFlag = Volatile;
+    AV.LifetimeFlag = LifetimeExternallyManaged;
+    AV.RequiresGCollection = RequiresGCollection;
     return AV;
   }
 
@@ -368,18 +370,18 @@
     return LifetimeFlag;
   }
   void setLifetimeExternallyManaged() {
-    LifetimeFlag = 1;
+    LifetimeFlag = true;
   }
 
   bool isVolatile() const {
     return VolatileFlag;
   }
 
-  bool isRequiresGCollection() const {
+  bool requiresGCollection() const {
     return RequiresGCollection;
   }
   void setRequiresGCollection() {
-    RequiresGCollection = 1;
+    RequiresGCollection = true;
   }
   
   llvm::Value *getAddr() const {





More information about the cfe-commits mailing list