OLD | NEW |
1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===// |
2 // PNaCl bitcode header reader. | 2 // PNaCl bitcode header reader. |
3 // | 3 // |
4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
5 // | 5 // |
6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 // | 10 // |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 Abbrev->OperandList.push_back(Op); | 114 Abbrev->OperandList.push_back(Op); |
115 } | 115 } |
116 return Abbrev; | 116 return Abbrev; |
117 } | 117 } |
118 | 118 |
119 bool NaClBitCodeAbbrev::isValid() const { | 119 bool NaClBitCodeAbbrev::isValid() const { |
120 // Verify that an array op appears can only appear if it is the | 120 // Verify that an array op appears can only appear if it is the |
121 // second to last element. | 121 // second to last element. |
122 unsigned NumOperands = getNumOperandInfos(); | 122 unsigned NumOperands = getNumOperandInfos(); |
| 123 if (NumOperands == 0) return false; |
123 for (unsigned i = 0; i < NumOperands; ++i) { | 124 for (unsigned i = 0; i < NumOperands; ++i) { |
124 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i); | 125 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i); |
125 if (Op.isArrayOp() && i + 2 != NumOperands) | 126 if (Op.isArrayOp() && i + 2 != NumOperands) |
126 return false; | 127 return false; |
127 } | 128 } |
128 return true; | 129 return true; |
129 } | 130 } |
OLD | NEW |