LLVM 23.0.0git
ErrorExtras.h
Go to the documentation of this file.
1//===- llvm/Support/ErrorExtras.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_SUPPORT_ERROREXTRAS_H
10#define LLVM_SUPPORT_ERROREXTRAS_H
11
12#include "llvm/Support/Error.h"
14
15namespace llvm {
16
17// LLVM formatv versions of llvm::createStringError
18
19template <typename... Ts>
20inline Error createStringErrorV(std::error_code EC, char const *Fmt,
21 Ts &&...Vals) {
22 return make_error<StringError>(formatv(Fmt, std::forward<Ts>(Vals)...).str(),
23 EC, true);
24}
25
26template <typename... Ts>
27inline Error createStringErrorV(char const *Fmt, Ts &&...Vals) {
29 std::forward<Ts>(Vals)...);
30}
31
32} // namespace llvm
33
34#endif // LLVM_SUPPORT_ERROREXTRAS_H
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
Error createStringErrorV(std::error_code EC, char const *Fmt, Ts &&...Vals)
Definition ErrorExtras.h:20
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition Error.cpp:94
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340