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 | |
16 | namespace llvm { |
17 | namespace exegesis { |
18 | |
19 | char ClusteringError::ID; |
20 | |
21 | void ClusteringError::log(raw_ostream &OS) const { OS << Msg; } |
22 | |
23 | std::error_code ClusteringError::convertToErrorCode() const { |
24 | return inconvertibleErrorCode(); |
25 | } |
26 | |
27 | char SnippetExecutionFailure::ID; |
28 | |
29 | std::error_code SnippetExecutionFailure::convertToErrorCode() const { |
30 | return inconvertibleErrorCode(); |
31 | } |
32 | |
33 | char SnippetSegmentationFault::ID; |
34 | |
35 | void SnippetSegmentationFault::log(raw_ostream &OS) const { |
36 | OS << "The snippet encountered a segmentation fault at address " |
37 | << Twine::utohexstr(Val: Address); |
38 | } |
39 | |
40 | char SnippetSignal::ID; |
41 | |
42 | void 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 |