Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed...
[oota-llvm.git] / include / llvm / ADT / Trie.h
index 8835dff4a978aa22ff39da195d091cfb5f8a0337..6b150c8fffa0441f52a86f40e7317d7ddfb2c033 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/Support/DOTGraphTraits.h"
 
+#include <cassert>
 #include <vector>
 
 namespace llvm {
@@ -41,13 +42,13 @@ public:
     typedef typename NodeVectorType::const_iterator const_iterator;
 
   private:
-    typedef enum {
+    enum QueryResult {
       Same           = -3,
       StringIsPrefix = -2,
       LabelIsPrefix  = -1,
       DontMatch      = 0,
       HaveCommonPart
-    } QueryResult;
+    };
 
     struct NodeCmp {
       bool operator() (Node* N1, Node* N2) {
@@ -118,12 +119,12 @@ public:
 
 #if 0
     inline void dump() {
-      std::cerr << "Node: " << this << "\n"
+      llvm::cerr << "Node: " << this << "\n"
                 << "Label: " << Label << "\n"
                 << "Children:\n";
 
       for (iterator I = Children.begin(), E = Children.end(); I != E; ++I)
-        std::cerr << (*I)->Label << "\n";
+        llvm::cerr << (*I)->Label << "\n";
     }
 #endif
 
@@ -279,9 +280,13 @@ struct GraphTraits<Trie<Payload> > {
   typedef typename TrieType::Node NodeType;
   typedef typename NodeType::iterator ChildIteratorType;
 
-  static inline NodeType *getEntryNode(const TrieType& T) { return T.getRoot(); }
+  static inline NodeType *getEntryNode(const TrieType& T) {
+    return T.getRoot();
+  }
 
-  static inline ChildIteratorType child_begin(NodeType *N) { return N->begin(); }
+  static inline ChildIteratorType child_begin(NodeType *N) {
+    return N->begin();
+  }
   static inline ChildIteratorType child_end(NodeType *N) { return N->end(); }
 
   typedef typename std::vector<NodeType*>::const_iterator nodes_iterator;