LLVM  16.0.0git
GenericError.cpp
Go to the documentation of this file.
1 //===- Error.cpp - system_error extensions for PDB --------------*- 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 
11 
12 using namespace llvm;
13 using namespace llvm::pdb;
14 
15 namespace {
16 // FIXME: This class is only here to support the transition to llvm::Error. It
17 // will be removed once this transition is complete. Clients should prefer to
18 // deal with the Error value directly, rather than converting to error_code.
19 class PDBErrorCategory : public std::error_category {
20 public:
21  const char *name() const noexcept override { return "llvm.pdb"; }
22  std::string message(int Condition) const override {
23  switch (static_cast<pdb_error_code>(Condition)) {
25  return "An unknown error has occurred.";
27  return "LLVM was not compiled with support for DIA. This usually means "
28  "that you are not using MSVC, or your Visual Studio "
29  "installation is corrupt.";
31  return "DIA is only supported when using MSVC.";
33  return "The PDB file path is an invalid UTF8 sequence.";
35  return "The signature does not match; the file(s) might be out of date.";
37  return "No matching precompiled header could be located.";
38  }
39  llvm_unreachable("Unrecognized generic_error_code");
40  }
41 };
42 } // namespace
43 
44 const std::error_category &llvm::pdb::PDBErrCategory() {
45  static PDBErrorCategory PDBCategory;
46  return PDBCategory;
47 }
48 
49 char PDBError::ID;
llvm::pdb::pdb_error_code
pdb_error_code
Definition: GenericError.h:17
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
name
static const char * name
Definition: SMEABIPass.cpp:49
ErrorHandling.h
llvm::pdb::pdb_error_code::invalid_utf8_path
@ invalid_utf8_path
llvm::pdb::pdb_error_code::signature_out_of_date
@ signature_out_of_date
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
GenericError.h
llvm::pdb::pdb_error_code::unspecified
@ unspecified
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
message
message(STATUS "Targeting ${t}") add_subdirectory($
Definition: CMakeLists.txt:34
llvm::pdb::pdb_error_code::dia_sdk_not_present
@ dia_sdk_not_present
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::pdb::pdb_error_code::dia_failed_loading
@ dia_failed_loading
llvm::pdb::pdb_error_code::no_matching_pch
@ no_matching_pch
llvm::pdb::PDBErrCategory
const std::error_category & PDBErrCategory()
Definition: GenericError.cpp:44
llvm::pdb::PDBError::ID
static char ID
Definition: GenericError.h:46