1//===-- Error.cpp -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "Error.h"
10
11#ifdef LLVM_ON_UNIX
12#include "llvm/Support/SystemZ/zOSSupport.h"
13#include <string.h>
14#endif // LLVM_ON_UNIX
15
16namespace llvm {
17namespace exegesis {
18
19char ClusteringError::ID;
20
21void ClusteringError::log(raw_ostream &OS) const { OS << Msg; }
22
23std::error_code ClusteringError::convertToErrorCode() const {
24 return inconvertibleErrorCode();
25}
26
27char SnippetExecutionFailure::ID;
28
29std::error_code SnippetExecutionFailure::convertToErrorCode() const {
30 return inconvertibleErrorCode();
31}
32
33char SnippetSegmentationFault::ID;
34
35void SnippetSegmentationFault::log(raw_ostream &OS) const {
36 OS << "The snippet encountered a segmentation fault at address "
37 << Twine::utohexstr(Val: Address);
38}
39
40char SnippetSignal::ID;
41
42void SnippetSignal::log(raw_ostream &OS) const {
43 OS << "snippet crashed while running";
44#ifdef LLVM_ON_UNIX
45 OS << ": " << strsignal(sig: SignalNumber);
46#else
47 (void)SignalNumber;
48#endif // LLVM_ON_UNIX
49}
50
51} // namespace exegesis
52} // namespace llvm
53