[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Sep 3 09:46:02 PDT 2003


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.59 -> 1.60

---
Log message:

No need to rescan types when they are created.


---
Diffs of the changes:

Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.59 llvm/lib/VMCore/Type.cpp:1.60
--- llvm/lib/VMCore/Type.cpp:1.59	Tue Sep  2 17:52:49 2003
+++ llvm/lib/VMCore/Type.cpp	Wed Sep  3 09:44:53 2003
@@ -343,35 +343,42 @@
                            bool IsVarArgs) : DerivedType(FunctionTyID), 
     ResultType(PATypeHandle(Result, this)),
     isVarArgs(IsVarArgs) {
+  bool isAbstract = Result->isAbstract();
   ParamTys.reserve(Params.size());
-  for (unsigned i = 0; i < Params.size(); ++i)
+  for (unsigned i = 0; i < Params.size(); ++i) {
     ParamTys.push_back(PATypeHandle(Params[i], this));
+    isAbstract |= Params[i]->isAbstract();
+  }
 
-  setAbstract(true);
-  setDerivedTypeProperties();
+  // Calculate whether or not this type is abstract
+  setAbstract(isAbstract);
 }
 
 StructType::StructType(const std::vector<const Type*> &Types)
   : CompositeType(StructTyID) {
   ETypes.reserve(Types.size());
+  bool isAbstract = false;
   for (unsigned i = 0; i < Types.size(); ++i) {
     assert(Types[i] != Type::VoidTy && "Void type in method prototype!!");
     ETypes.push_back(PATypeHandle(Types[i], this));
+    isAbstract |= Types[i]->isAbstract();
   }
-  setAbstract(true);
-  setDerivedTypeProperties();
+
+  // Calculate whether or not this type is abstract
+  setAbstract(isAbstract);
 }
 
 ArrayType::ArrayType(const Type *ElType, unsigned NumEl)
   : SequentialType(ArrayTyID, ElType) {
   NumElements = NumEl;
-  setAbstract(true);
-  setDerivedTypeProperties();
+
+  // Calculate whether or not this type is abstract
+  setAbstract(ElType->isAbstract());
 }
 
 PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) {
-  setAbstract(true);
-  setDerivedTypeProperties();
+  // Calculate whether or not this type is abstract
+  setAbstract(E->isAbstract());
 }
 
 OpaqueType::OpaqueType() : DerivedType(OpaqueTyID) {





More information about the llvm-commits mailing list