Fifth time's a charm! Remove ourselves as abstract type listeners once we've
authorNick Lewycky <nicholas@mxc.ca>
Mon, 14 Sep 2009 02:25:19 +0000 (02:25 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Mon, 14 Sep 2009 02:25:19 +0000 (02:25 +0000)
been told that the type is no longer abstract.

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

lib/VMCore/Verifier.cpp

index 7b2afde0a0e8a37aa62122a7431b14a81d31ac8b..140e6bd8b15a78c1ffeefa091b28afc4247bc77a 100644 (file)
@@ -107,8 +107,9 @@ PreVer("preverify", "Preliminary module verification");
 static const PassInfo *const PreVerifyID = &PreVer;
 
 namespace {
-  struct TypeSet : public AbstractTypeUser {
-    SmallSetVector<const Type *, 16> Types;
+  class TypeSet : public AbstractTypeUser {
+  public:
+    TypeSet() {}
 
     /// Insert a type into the set of types.
     bool insert(const Type *Ty) {
@@ -138,8 +139,20 @@ namespace {
       Types.remove(OldTy);
       OldTy->removeAbstractTypeUser(this);
     }
-    void typeBecameConcrete(const DerivedType *AbsTy) {}
+
+    /// Stop listening for changes to a type which is no longer abstract.
+    void typeBecameConcrete(const DerivedType *AbsTy) {
+      AbsTy->removeAbstractTypeUser(this);
+    }
+
     void dump() const {}
+
+  private:
+    SmallSetVector<const Type *, 16> Types;
+
+    // Disallow copying.
+    TypeSet(const TypeSet &);
+    TypeSet &operator=(const TypeSet &);
   };
 
   struct Verifier : public FunctionPass, public InstVisitor<Verifier> {