Path: blob/main/contrib/llvm-project/llvm/tools/llvm-dwarfutil/Error.h
35231 views
//===- Error.h --------------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H9#define LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H1011#include "llvm/ADT/STLExtras.h"12#include "llvm/ADT/StringRef.h"13#include "llvm/Support/Debug.h"14#include "llvm/Support/Error.h"15#include "llvm/Support/Format.h"16#include "llvm/Support/WithColor.h"17#include "llvm/Support/raw_ostream.h"18#include "llvm/TargetParser/Triple.h"1920namespace llvm {21namespace dwarfutil {2223inline void error(Error Err, StringRef Prefix = "") {24handleAllErrors(std::move(Err), [&](ErrorInfoBase &Info) {25WithColor::error(errs(), Prefix) << Info.message() << '\n';26});27std::exit(EXIT_FAILURE);28}2930inline void warning(const Twine &Message, StringRef Prefix = "") {31WithColor::warning(errs(), Prefix) << Message << '\n';32}3334inline void verbose(const Twine &Message, bool Verbose) {35if (Verbose)36outs() << Message << '\n';37}3839} // end of namespace dwarfutil40} // end of namespace llvm4142#endif // LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H434445