Reland "[llvm-readobj] Simplify usage of -codeview flag"
[oota-llvm.git] / utils / TableGen / SequenceToOffsetTable.h
index a4f16ca9a6a2ec3ecb6a6e4d97f84366bcd5a763..66506ea0638f0bc6618923180b20ca168e6d6c5d 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef TBLGEN_SEQUENCE_TO_OFFSET_TABLE_H
-#define TBLGEN_SEQUENCE_TO_OFFSET_TABLE_H
+#ifndef LLVM_UTILS_TABLEGEN_SEQUENCETOOFFSETTABLE_H
+#define LLVM_UTILS_TABLEGEN_SEQUENCETOOFFSETTABLE_H
 
 #include "llvm/Support/raw_ostream.h"
-#include <functional>
 #include <algorithm>
-#include <vector>
 #include <cassert>
 #include <cctype>
+#include <functional>
+#include <map>
+#include <vector>
 
 namespace llvm {
 
@@ -83,8 +84,13 @@ public:
 
   bool empty() const { return Seqs.empty(); }
 
+  unsigned size() const {
+    assert(Entries && "Call layout() before size()");
+    return Entries;
+  }
+
   /// layout - Computes the final table layout.
-  unsigned layout() {
+  void layout() {
     assert(Entries == 0 && "Can only call layout() once");
     // Lay out the table in Seqs iteration order.
     for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E;
@@ -93,7 +99,6 @@ public:
       // Include space for a terminator.
       Entries += I->first.size() + 1;
     }
-    return Entries;
   }
 
   /// get - Returns the offset of Seq in the final table.