| OLD | NEW |
| 1 //===- NaClBitcodeMungeUtils.h - Munge bitcode records --------*- C++ -*-===// | 1 //===- NaClBitcodeMungeUtils.h - Munge bitcode records --------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file defines utility class NaClMungedBitcode to edit a base | 10 // This file defines utility class NaClMungedBitcode to edit a base |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 /// \param AddHeader Add header block when true. | 231 /// \param AddHeader Add header block when true. |
| 232 /// \param Flags Write flags to use. | 232 /// \param Flags Write flags to use. |
| 233 /// | 233 /// |
| 234 /// \return Returns the results of the write. | 234 /// \return Returns the results of the write. |
| 235 WriteResults writeMaybeRepair( | 235 WriteResults writeMaybeRepair( |
| 236 SmallVectorImpl<char> &Buffer, bool AddHeader, | 236 SmallVectorImpl<char> &Buffer, bool AddHeader, |
| 237 const WriteFlags &Flags) const; | 237 const WriteFlags &Flags) const; |
| 238 | 238 |
| 239 bool write(SmallVectorImpl<char> &Buffer, bool AddHeader, | 239 bool write(SmallVectorImpl<char> &Buffer, bool AddHeader, |
| 240 const WriteFlags &Flags) const { | 240 const WriteFlags &Flags) const { |
| 241 return writeMaybeRepair(Buffer, AddHeader, Flags).NumErrors == 0; | 241 WriteResults Results = writeMaybeRepair(Buffer, AddHeader, Flags); |
| 242 return Results.NumErrors == 0 |
| 243 || (Flags.getTryToRecover() && Results.NumErrors == Results.NumRepairs); |
| 242 } | 244 } |
| 243 | 245 |
| 244 bool write(SmallVectorImpl<char> &Buffer, bool AddHeader) const { | 246 bool write(SmallVectorImpl<char> &Buffer, bool AddHeader) const { |
| 245 WriteFlags Flags; | 247 WriteFlags Flags; |
| 246 return write(Buffer, AddHeader, Flags); | 248 return write(Buffer, AddHeader, Flags); |
| 247 } | 249 } |
| 248 | 250 |
| 249 /// \brief The types of editing actions that can be applied. | 251 /// \brief The types of editing actions that can be applied. |
| 250 enum EditAction { | 252 enum EditAction { |
| 251 AddBefore, // Insert new record before base record at index. | 253 AddBefore, // Insert new record before base record at index. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 454 } |
| 453 | 455 |
| 454 // \brief Moves the iterator to the position of the next edited | 456 // \brief Moves the iterator to the position of the next edited |
| 455 // record. | 457 // record. |
| 456 void updatePosition(); | 458 void updatePosition(); |
| 457 }; | 459 }; |
| 458 | 460 |
| 459 } // end namespace llvm. | 461 } // end namespace llvm. |
| 460 | 462 |
| 461 #endif // LLVM_BITCODE_NACL_NACLBITCODEMUNGE_H | 463 #endif // LLVM_BITCODE_NACL_NACLBITCODEMUNGE_H |
| OLD | NEW |