-static void exitWithErrorCode(const std::error_code &Error, StringRef Whence = "") {
- if (Error.category() == instrprof_category()) {
- instrprof_error instrError = static_cast<instrprof_error>(Error.value());
- if (instrError == instrprof_error::unrecognized_format) {
- // Hint for common error of forgetting -sample for sample profiles.
- exitWithError(Error.message(), Whence,
- "Perhaps you forgot to use the -sample option?");
- }
- }
- exitWithError(Error.message(), Whence);
-}
-