[llvm] [cmake] Add possibility to use ChooseMSVCCRT.cmake when include LLVM library
[llvm-core.git] / include / llvm / DebugInfo / PDB / DIA / DIAError.h
blob96d960599f7ef7b5c243014fca02b29a2fec143d
1 //===- DIAError.h - Error extensions for PDB DIA implementation -*- 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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H
10 #define LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/Support/Error.h"
15 namespace llvm {
16 namespace pdb {
17 enum class dia_error_code {
18 unspecified = 1,
19 could_not_create_impl,
20 invalid_file_format,
21 invalid_parameter,
22 already_loaded,
23 debug_info_mismatch,
25 } // namespace pdb
26 } // namespace llvm
28 namespace std {
29 template <>
30 struct is_error_code_enum<llvm::pdb::dia_error_code> : std::true_type {};
31 } // namespace std
33 namespace llvm {
34 namespace pdb {
35 const std::error_category &DIAErrCategory();
37 inline std::error_code make_error_code(dia_error_code E) {
38 return std::error_code(static_cast<int>(E), DIAErrCategory());
41 /// Base class for errors originating in DIA SDK, e.g. COM calls
42 class DIAError : public ErrorInfo<DIAError, StringError> {
43 public:
44 using ErrorInfo<DIAError, StringError>::ErrorInfo;
45 DIAError(const Twine &S) : ErrorInfo(S, dia_error_code::unspecified) {}
46 static char ID;
48 } // namespace pdb
49 } // namespace llvm
50 #endif