Rename removeAllMetadata to clearMetadataHashEntries and simplify
authorDan Gohman <gohman@apple.com>
Tue, 20 Jul 2010 22:25:04 +0000 (22:25 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 20 Jul 2010 22:25:04 +0000 (22:25 +0000)
it to just do the things that need to be done when an instruction
is deleted.

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

include/llvm/Instruction.h
lib/VMCore/Instruction.cpp
lib/VMCore/Metadata.cpp

index 45959ccc6e59acee127e3af07cfdbf17e9d2d0aa..88f5ce1b2622ec176ed771422a0efec9ec3bdca1 100644 (file)
@@ -189,7 +189,7 @@ private:
   void getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,MDNode*> > &)const;
   void getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
                                            MDNode*> > &) const;
-  void removeAllMetadata();
+  void clearMetadataHashEntries();
 public:
   //===--------------------------------------------------------------------===//
   // Predicates and helper methods.
index 9792adaaa122d889c26fa7a6d7677396bc1b9ca3..05bed4c64316fa77e406ec96153c6ccd0c700bd0 100644 (file)
@@ -49,8 +49,8 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
 // Out of line virtual method, so the vtable, etc has a home.
 Instruction::~Instruction() {
   assert(Parent == 0 && "Instruction still linked in the program!");
-  if (hasMetadata())
-    removeAllMetadata();
+  if (hasMetadataHashEntry())
+    clearMetadataHashEntries();
 }
 
 
index 22e758763d63297271b56a8042d63102935e8f30..023799ceb82b032f5e0fa9714287a98334672986 100644 (file)
@@ -563,13 +563,11 @@ getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
 }
 
 
-/// removeAllMetadata - Remove all metadata from this instruction.
-void Instruction::removeAllMetadata() {
-  assert(hasMetadata() && "Caller should check");
-  DbgLoc = DebugLoc();
-  if (hasMetadataHashEntry()) {
-    getContext().pImpl->MetadataStore.erase(this);
-    setHasMetadataHashEntry(false);
-  }
+/// clearMetadataHashEntries - Clear all hashtable-based metadata from
+/// this instruction.
+void Instruction::clearMetadataHashEntries() {
+  assert(hasMetadataHashEntry() && "Caller should check");
+  getContext().pImpl->MetadataStore.erase(this);
+  setHasMetadataHashEntry(false);
 }