brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · fff5978 Raw
44 lines · c
1//===- 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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H10#define LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H11 12#include "llvm/ADT/STLExtras.h"13#include "llvm/ADT/StringRef.h"14#include "llvm/Support/Debug.h"15#include "llvm/Support/Error.h"16#include "llvm/Support/Format.h"17#include "llvm/Support/WithColor.h"18#include "llvm/Support/raw_ostream.h"19#include "llvm/TargetParser/Triple.h"20 21namespace llvm {22namespace dwarfutil {23 24inline void error(Error Err, StringRef Prefix = "") {25  handleAllErrors(std::move(Err), [&](ErrorInfoBase &Info) {26    WithColor::error(errs(), Prefix) << Info.message() << '\n';27  });28  std::exit(EXIT_FAILURE);29}30 31inline void warning(const Twine &Message, StringRef Prefix = "") {32  WithColor::warning(errs(), Prefix) << Message << '\n';33}34 35inline void verbose(const Twine &Message, bool Verbose) {36  if (Verbose)37    outs() << Message << '\n';38}39 40} // end of namespace dwarfutil41} // end of namespace llvm42 43#endif // LLVM_TOOLS_LLVM_DWARFUTIL_ERROR_H44