blob: dc203c841b3641b8474381d25288ba0d8ebdc204 [file] [log] [blame]
Clement Courbet03a3d292019-09-30 13:53:50 +00001//===-- Error.h -------------------------------------------------*- 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#ifndef LLVM_TOOLS_LLVM_EXEGESIS_ERROR_H
10#define LLVM_TOOLS_LLVM_EXEGESIS_ERROR_H
11
12#include "llvm/ADT/Twine.h"
13#include "llvm/Support/Error.h"
14
15namespace llvm {
16namespace exegesis {
17
18// A class representing failures that happened within llvm-exegesis, they are
19// used to report informations to the user.
20class Failure : public StringError {
21public:
22 Failure(const Twine &S) : StringError(S, inconvertibleErrorCode()) {}
23};
24
Miloš Stojanović446268a2020-02-06 17:08:05 +010025// A class representing failures that happened during clustering calculations.
26class ClusteringError : public ErrorInfo<ClusteringError> {
27public:
28 static char ID;
29 ClusteringError(const Twine&S) : Msg(S.str()) {}
30
31 void log(raw_ostream &OS) const override;
32
33 std::error_code convertToErrorCode() const override;
34private:
35 std::string Msg;
36};
37
Clement Courbet03a3d292019-09-30 13:53:50 +000038} // namespace exegesis
39} // namespace llvm
40
41#endif