[llvm-commits] [llvm] r75830 - in /llvm/trunk: include/llvm/Constants.h lib/VMCore/Constants.cpp lib/VMCore/LLVMContext.cpp

Owen Anderson resistor at mac.com
Wed Jul 15 14:00:46 PDT 2009


Author: resistor
Date: Wed Jul 15 16:00:46 2009
New Revision: 75830

URL: http://llvm.org/viewvc/llvm-project?rev=75830&view=rev
Log:
Move the ConstantStruct factory methods over to LLVMContext.

Modified:
    llvm/trunk/include/llvm/Constants.h
    llvm/trunk/lib/VMCore/Constants.cpp
    llvm/trunk/lib/VMCore/LLVMContext.cpp

Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=75830&r1=75829&r2=75830&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Wed Jul 15 16:00:46 2009
@@ -379,12 +379,6 @@
   /// get() - Static factory methods - Return objects of the specified value
   ///
   static Constant *get(const StructType *T, const std::vector<Constant*> &V);
-  static Constant *get(const std::vector<Constant*> &V, bool Packed = false);
-  static Constant *get(Constant*const* Vals, unsigned NumVals,
-                       bool Packed = false) {
-    // FIXME: make this the primary ctor method.
-    return get(std::vector<Constant*>(Vals, Vals+NumVals), Packed);
-  }
   
   /// Transparently provide more efficient getOperand methods.
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);

Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=75830&r1=75829&r2=75830&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Wed Jul 15 16:00:46 2009
@@ -1371,14 +1371,6 @@
   return ConstantAggregateZero::get(Ty);
 }
 
-Constant *ConstantStruct::get(const std::vector<Constant*> &V, bool packed) {
-  std::vector<const Type*> StructEls;
-  StructEls.reserve(V.size());
-  for (unsigned i = 0, e = V.size(); i != e; ++i)
-    StructEls.push_back(V[i]->getType());
-  return get(StructType::get(StructEls, packed), V);
-}
-
 // destroyConstant - Remove the constant from the constant table...
 //
 void ConstantStruct::destroyConstant() {

Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=75830&r1=75829&r2=75830&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContext.cpp (original)
+++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 15 16:00:46 2009
@@ -146,13 +146,18 @@
 }
 
 Constant* LLVMContext::getConstantStruct(const std::vector<Constant*>& V,
-                                         bool Packed) {
-  return ConstantStruct::get(V, Packed);
+                                         bool packed) {
+  std::vector<const Type*> StructEls;
+  StructEls.reserve(V.size());
+  for (unsigned i = 0, e = V.size(); i != e; ++i)
+    StructEls.push_back(V[i]->getType());
+  return getConstantStruct(getStructType(StructEls, packed), V);
 }
 
 Constant* LLVMContext::getConstantStruct(Constant* const *Vals,
                                          unsigned NumVals, bool Packed) {
-  return ConstantStruct::get(Vals, NumVals, Packed);
+  // FIXME: make this the primary ctor method.
+  return getConstantStruct(std::vector<Constant*>(Vals, Vals+NumVals), Packed);
 }
 
 





More information about the llvm-commits mailing list