forked from llvm/llvm-project
- Notifications
You must be signed in to change notification settings - Fork 339
/
Copy pathError.h
44 lines (36 loc) · 1.31 KB
/
Error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//===- Error.h --------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H
#defineLLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H
#include"llvm/ADT/STLExtras.h"
#include"llvm/ADT/StringRef.h"
#include"llvm/ADT/StringSet.h"
#include"llvm/ADT/Triple.h"
#include"llvm/Support/Debug.h"
#include"llvm/Support/Error.h"
#include"llvm/Support/Format.h"
#include"llvm/Support/WithColor.h"
#include"llvm/Support/raw_ostream.h"
namespacellvm {
namespacedwarfutil {
inlinevoiderror(Error Err, StringRef Prefix = "") {
handleAllErrors(std::move(Err), [&](ErrorInfoBase &Info) {
WithColor::error(errs(), Prefix) << Info.message() << '\n';
});
std::exit(EXIT_FAILURE);
}
inlinevoidwarning(const Twine &Message, StringRef Prefix = "") {
WithColor::warning(errs(), Prefix) << Message << '\n';
}
inlinevoidverbose(const Twine &Message, bool Verbose) {
if (Verbose)
outs() << Message << '\n';
}
} // end of namespace dwarfutil
} // end of namespace llvm
#endif// LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H