Add convenience method FoldingSetImpl::InsertNode(Node *N) that asserts if the node...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 12 Jul 2010 20:47:08 +0000 (20:47 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 12 Jul 2010 20:47:08 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108192 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/FoldingSet.h

index c03ee5e8d1be0904effbc81931ba8b6d5c573ab8..fc8490abf739d45ee63d73401542f7206dc9cf6f 100644 (file)
@@ -166,6 +166,14 @@ public:
   /// FindNodeOrInsertPos.
   void InsertNode(Node *N, void *InsertPos);
 
+  /// InsertNode - Insert the specified node into the folding set, knowing that
+  /// it is not already in the folding set.
+  void InsertNode(Node *N) {
+    Node *Inserted = GetOrInsertNode(N);
+    (void)Inserted;
+    assert(Inserted == N && "Node already inserted!");
+  }
+
   /// size - Returns the number of nodes in the folding set.
   unsigned size() const { return NumNodes; }