[PATCH] error_code for dynamically generated error messages

kledzik at apple.com kledzik at apple.com
Thu May 22 18:35:50 PDT 2014


================
Comment at: lib/Core/Error.cpp:189
@@ +188,3 @@
+private:
+  std::vector<std::string> _messages;
+  llvm::sys::SmartMutex<true> _mutex;
----------------
Shankar Easwaran wrote:
> How do we use the vector of messages ? Are these for predefined messages ? If so should it be a vector of StringRef ?
Each time make_dynamic_error_code() is called it copies the string to the vector which dynamically creates a new error code value.  So rather that fixed error values and messages, we get dynamic error values and messages.  Of course, this only makes sense if the clients never look at the value (other than testing against zero).

http://reviews.llvm.org/D3881






More information about the llvm-commits mailing list