[cfe-commits] r99884 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGObjC.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Mar 30 04:36:44 PDT 2010


Author: d0k
Date: Tue Mar 30 06:36:44 2010
New Revision: 99884

URL: http://llvm.org/viewvc/llvm-project?rev=99884&view=rev
Log:
Replace some constant-sized SmallVectors.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGObjC.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=99884&r1=99883&r2=99884&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Mar 30 06:36:44 2010
@@ -714,10 +714,8 @@
   ASTContext &Context = CGM.getContext();
 
   /* Function type */
-  llvm::SmallVector<llvm::DIDescriptor, 16> STys;
-  STys.push_back(getOrCreateType(Context.IntTy, Unit));
-  llvm::DIArray SElements =
-    DebugFactory.GetOrCreateArray(STys.data(), STys.size());
+  llvm::DIDescriptor STy = getOrCreateType(Context.IntTy, Unit);
+  llvm::DIArray SElements = DebugFactory.GetOrCreateArray(&STy, 1);
   llvm::DIType SubTy =
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_subroutine_type,
                                      Unit, "", Unit,
@@ -1070,11 +1068,9 @@
   uint64_t NumElems = Ty->getNumElements();
   if (NumElems > 0)
     --NumElems;
-  llvm::SmallVector<llvm::DIDescriptor, 8> Subscripts;
-  Subscripts.push_back(DebugFactory.GetOrCreateSubrange(0, NumElems));
 
-  llvm::DIArray SubscriptArray =
-    DebugFactory.GetOrCreateArray(Subscripts.data(), Subscripts.size());
+  llvm::DIDescriptor Subscript = DebugFactory.GetOrCreateSubrange(0, NumElems);
+  llvm::DIArray SubscriptArray = DebugFactory.GetOrCreateArray(&Subscript, 1);
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=99884&r1=99883&r2=99884&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Mar 30 06:36:44 2010
@@ -464,12 +464,13 @@
   static const unsigned NumItems = 16;
 
   // Get selector
-  llvm::SmallVector<IdentifierInfo*, 3> II;
-  II.push_back(&CGM.getContext().Idents.get("countByEnumeratingWithState"));
-  II.push_back(&CGM.getContext().Idents.get("objects"));
-  II.push_back(&CGM.getContext().Idents.get("count"));
-  Selector FastEnumSel = CGM.getContext().Selectors.getSelector(II.size(),
-                                                                &II[0]);
+  IdentifierInfo *II[] = {
+    &CGM.getContext().Idents.get("countByEnumeratingWithState"),
+    &CGM.getContext().Idents.get("objects"),
+    &CGM.getContext().Idents.get("count")
+  };
+  Selector FastEnumSel =
+    CGM.getContext().Selectors.getSelector(llvm::array_lengthof(II), &II[0]);
 
   QualType ItemsTy =
     getContext().getConstantArrayType(getContext().getObjCIdType(),





More information about the cfe-commits mailing list