[llvm-commits] [llvm] r83102 - /llvm/trunk/lib/VMCore/Metadata.cpp

Devang Patel dpatel at apple.com
Tue Sep 29 13:01:19 PDT 2009


Author: dpatel
Date: Tue Sep 29 15:01:19 2009
New Revision: 83102

URL: http://llvm.org/viewvc/llvm-project?rev=83102&view=rev
Log:
Use assertion instead of early exit to catch malformed custom metadata store.

Modified:
    llvm/trunk/lib/VMCore/Metadata.cpp

Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=83102&r1=83101&r2=83102&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Sep 29 15:01:19 2009
@@ -351,15 +351,14 @@
 void MetadataContext::ValueIsDeleted(const Instruction *Inst) {
   // Find Metadata handles for this instruction.
   MDStoreTy::iterator I = MetadataStore.find(Inst);
-  if (I == MetadataStore.end())
-    return;
+  assert (I != MetadataStore.end() && "Invalid custom metadata info!");
   MDMapTy &Info = I->second;
   
   // FIXME : Give all metadata handlers a chance to adjust.
   
   // Remove the entries for this instruction.
   Info.clear();
-  MetadataStore.erase(Inst);
+  MetadataStore.erase(I);
 }
 
 /// ValueIsCloned - This handler is used to update metadata store
@@ -367,8 +366,7 @@
 void MetadataContext::ValueIsCloned(const Instruction *In1, Instruction *In2) {
   // Find Metadata handles for In1.
   MDStoreTy::iterator I = MetadataStore.find(In1);
-  if (I == MetadataStore.end())
-    return;
+  assert (I != MetadataStore.end() && "Invalid custom metadata info!");
 
   // FIXME : Give all metadata handlers a chance to adjust.
 





More information about the llvm-commits mailing list