| OLD | NEW |
| 1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// | 1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 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 declares various useful types and classes that have | 10 // This file declares various useful types and classes that have |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 // Wrapper around std::error_code for allowing multiple errors to be | 195 // Wrapper around std::error_code for allowing multiple errors to be |
| 196 // folded into one. The current implementation keeps track of the | 196 // folded into one. The current implementation keeps track of the |
| 197 // first error, which is likely to be the most useful one, and this | 197 // first error, which is likely to be the most useful one, and this |
| 198 // could be extended to e.g. collect a vector of errors. | 198 // could be extended to e.g. collect a vector of errors. |
| 199 class ErrorCode : public std::error_code { | 199 class ErrorCode : public std::error_code { |
| 200 ErrorCode(const ErrorCode &) = delete; | 200 ErrorCode(const ErrorCode &) = delete; |
| 201 ErrorCode &operator=(const ErrorCode &) = delete; | 201 ErrorCode &operator=(const ErrorCode &) = delete; |
| 202 | 202 |
| 203 public: | 203 public: |
| 204 ErrorCode() : HasError(false) {} | 204 ErrorCode() = default; |
| 205 void assign(ErrorCodes Code) { | 205 void assign(ErrorCodes Code) { |
| 206 if (!HasError) { | 206 if (!HasError) { |
| 207 HasError = true; | 207 HasError = true; |
| 208 std::error_code::assign(Code, std::generic_category()); | 208 std::error_code::assign(Code, std::generic_category()); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 void assign(int Code) { assign(static_cast<ErrorCodes>(Code)); } | 211 void assign(int Code) { assign(static_cast<ErrorCodes>(Code)); } |
| 212 | 212 |
| 213 private: | 213 private: |
| 214 bool HasError; | 214 bool HasError = false; |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 // Reverse range adaptors written in terms of llvm::make_range(). | 217 // Reverse range adaptors written in terms of llvm::make_range(). |
| 218 template <typename T> | 218 template <typename T> |
| 219 llvm::iterator_range<typename T::const_reverse_iterator> | 219 llvm::iterator_range<typename T::const_reverse_iterator> |
| 220 reverse_range(const T &Container) { | 220 reverse_range(const T &Container) { |
| 221 return llvm::make_range(Container.rbegin(), Container.rend()); | 221 return llvm::make_range(Container.rbegin(), Container.rend()); |
| 222 } | 222 } |
| 223 template <typename T> | 223 template <typename T> |
| 224 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { | 224 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { |
| 225 return llvm::make_range(Container.rbegin(), Container.rend()); | 225 return llvm::make_range(Container.rbegin(), Container.rend()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // Options for pooling and randomization of immediates | 228 // Options for pooling and randomization of immediates |
| 229 enum RandomizeAndPoolImmediatesEnum { RPI_None, RPI_Randomize, RPI_Pool }; | 229 enum RandomizeAndPoolImmediatesEnum { RPI_None, RPI_Randomize, RPI_Pool }; |
| 230 | 230 |
| 231 } // end of namespace Ice | 231 } // end of namespace Ice |
| 232 | 232 |
| 233 #endif // SUBZERO_SRC_ICEDEFS_H | 233 #endif // SUBZERO_SRC_ICEDEFS_H |
| OLD | NEW |