From: Devang Patel Date: Tue, 29 Sep 2009 20:01:19 +0000 (+0000) Subject: Use assertion instead of early exit to catch malformed custom metadata store. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1d957e4d0d09eed90386688a503350cf2ccc2793;p=oota-llvm.git Use assertion instead of early exit to catch malformed custom metadata store. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83102 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 8ae7d309b31..0a8e865cff6 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -351,15 +351,14 @@ const StringMap *MetadataContext::getHandlerNames() { 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::ValueIsDeleted(const Instruction *Inst) { 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.