[llvm] a7cebfe - Relax assertions when there's really no entries. [NFC]

Michael Liao via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 12:26:44 PDT 2019


Author: Michael Liao
Date: 2019-10-22T15:26:30-04:00
New Revision: a7cebfe9c03d0561500d3ab6d7ca2cea4a197904

URL: https://github.com/llvm/llvm-project/commit/a7cebfe9c03d0561500d3ab6d7ca2cea4a197904
DIFF: https://github.com/llvm/llvm-project/commit/a7cebfe9c03d0561500d3ab6d7ca2cea4a197904.diff

LOG: Relax assertions when there's really no entries. [NFC]

Added: 
    

Modified: 
    llvm/utils/TableGen/SequenceToOffsetTable.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/SequenceToOffsetTable.h b/llvm/utils/TableGen/SequenceToOffsetTable.h
index 8a826eff311d..327da39f4774 100644
--- a/llvm/utils/TableGen/SequenceToOffsetTable.h
+++ b/llvm/utils/TableGen/SequenceToOffsetTable.h
@@ -83,7 +83,7 @@ class SequenceToOffsetTable {
   bool empty() const { return Seqs.empty(); }
 
   unsigned size() const {
-    assert(Entries && "Call layout() before size()");
+    assert((empty() || Entries) && "Call layout() before size()");
     return Entries;
   }
 
@@ -113,7 +113,7 @@ class SequenceToOffsetTable {
   void emit(raw_ostream &OS,
             void (*Print)(raw_ostream&, ElemT),
             const char *Term = "0") const {
-    assert(Entries && "Call layout() before emit()");
+    assert((empty() || Entries) && "Call layout() before emit()");
     for (typename SeqMap::const_iterator I = Seqs.begin(), E = Seqs.end();
          I != E; ++I) {
       OS << "  /* " << I->second << " */ ";


        


More information about the llvm-commits mailing list