Fix a typo (the the => the)
[oota-llvm.git] / include / llvm / ADT / Trie.h
index 47a3f4d59fd601be51479961904d70b8e0e70dd7..845af015b052d7a4919cb30463ffa1c3eba41bc9 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Anton Korobeynikov and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -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
 
@@ -219,8 +220,7 @@ bool Trie<Payload>::addString(const std::string& s, const Payload& data) {
         assert(0 && "FIXME!");
         return false;
       case Node::DontMatch:
-        assert(0 && "Impossible!");
-        return false;
+        llvm_unreachable("Impossible!");
       case Node::LabelIsPrefix:
         s1 = s1.substr(nNode->label().length());
         cNode = nNode;
@@ -257,8 +257,7 @@ const Payload& Trie<Payload>::lookup(const std::string& s) const {
       case Node::StringIsPrefix:
         return Empty;
       case Node::DontMatch:
-        assert(0 && "Impossible!");
-        return Empty;
+        llvm_unreachable("Impossible!");
       case Node::LabelIsPrefix:
         s1 = s1.substr(nNode->label().length());
         cNode = nNode;
@@ -279,9 +278,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;