]> granicus.if.org Git - clang/commitdiff
Initialize AggValueSlot's flags along all paths, plus minor beautification.
authorJohn McCall <rjmccall@apple.com>
Thu, 16 Sep 2010 03:13:23 +0000 (03:13 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 16 Sep 2010 03:13:23 +0000 (03:13 +0000)
Prospective fix for broken commit in r114045.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114060 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGValue.h

index d28071197c0b17973234d9f507c3ff539ba4f5e7..bd773f2dad6bd3e51557af941072424a36bb7985 100644 (file)
@@ -39,7 +39,7 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> {
     // 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 @@ bool AggExprEmitter::TypeRequiresGCollection(QualType T) {
 /// 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 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, RValue Src, bool Ignore) {
     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;
index fa4cb3db04398c6da3d53feeacb7ca82305a2436..04467c564fde55949eec939d9ddd8ff6ca9098a9 100644 (file)
@@ -347,14 +347,16 @@ public:
   /// \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 @@ public:
     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 {