[llvm] r292597 - Add an assertion to PlaceholderQueue destructor, ensuring it has been flushed

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 02:18:32 PST 2017


Author: mehdi_amini
Date: Fri Jan 20 04:18:32 2017
New Revision: 292597

URL: http://llvm.org/viewvc/llvm-project?rev=292597&view=rev
Log:
Add an assertion to PlaceholderQueue destructor, ensuring it has been flushed

Modified:
    llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp?rev=292597&r1=292596&r2=292597&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp Fri Jan 20 04:18:32 2017
@@ -358,6 +358,9 @@ class PlaceholderQueue {
   std::deque<DistinctMDOperandPlaceholder> PHs;
 
 public:
+  ~PlaceholderQueue() {
+    assert(empty() && "PlaceholderQueue hasn't been flushed before being destroyed");
+  }
   bool empty() { return PHs.empty(); }
   DistinctMDOperandPlaceholder &getPlaceholderOp(unsigned ID);
   void flush(BitcodeReaderMetadataList &MetadataList);




More information about the llvm-commits mailing list