[cfe-commits] r68174 - in /cfe/trunk/lib/CodeGen: CGObjCGNU.cpp CodeGenTypes.cpp

Chris Lattner sabre at nondot.org
Tue Mar 31 19:00:48 PDT 2009


Author: lattner
Date: Tue Mar 31 21:00:48 2009
New Revision: 68174

URL: http://llvm.org/viewvc/llvm-project?rev=68174&view=rev
Log:
tidy some code.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=68174&r1=68173&r2=68174&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue Mar 31 21:00:48 2009
@@ -728,21 +728,19 @@
     SuperClassName = SuperClassDecl->getNameAsString();
 
   // Get the class name
-  ObjCInterfaceDecl * ClassDecl = (ObjCInterfaceDecl*)OID->getClassInterface();
+  ObjCInterfaceDecl *ClassDecl =
+    const_cast<ObjCInterfaceDecl *>(OID->getClassInterface());
   std::string ClassName = ClassDecl->getNameAsString();
 
+  // This is required by newer ObjC runtimes.
+  assert(!LateBoundIVars() &&"Late-bound instance variables not yet supported");
+
   // Get the size of instances.  For runtimes that support late-bound instances
   // this should probably be something different (size just of instance
   // varaibles in this class, not superclasses?).
-  int instanceSize = 0;
-  const llvm::Type *ObjTy = 0;
-  if (!LateBoundIVars()) {
-    ObjTy = CGM.getTypes().ConvertType(Context.getObjCInterfaceType(ClassDecl));
-    instanceSize = CGM.getTargetData().getTypePaddedSize(ObjTy);
-  } else {
-    // This is required by newer ObjC runtimes.
-    assert(0 && "Late-bound instance variables not yet supported");
-  }
+  const llvm::Type *ObjTy =
+    CGM.getTypes().ConvertType(Context.getObjCInterfaceType(ClassDecl));
+  int instanceSize = CGM.getTargetData().getTypePaddedSize(ObjTy);
 
   // Collect information about instance variables.
   llvm::SmallVector<llvm::Constant*, 16> IvarNames;

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=68174&r1=68173&r2=68174&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Tue Mar 31 21:00:48 2009
@@ -99,7 +99,7 @@
 }
 
 const llvm::Type *CodeGenTypes::ConvertTypeRecursive(QualType T) {
-  T = Context.getCanonicalType(T);;
+  T = Context.getCanonicalType(T);
   
   // See if type is already cached.
   llvm::DenseMap<Type *, llvm::PATypeHolder>::iterator





More information about the cfe-commits mailing list