LLVM: lib/Object/Error.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

16

17using namespace llvm;

18using namespace object;

19

20namespace {

21

22

23

24class _object_error_category : public std::error_category {

25public:

26 const char* name() const noexcept override;

27 std::string message(int ev) const override;

28};

29}

30

31const char *_object_error_category::name() const noexcept {

32 return "llvm.object";

33}

34

35std::string _object_error_category::message(int EV) const {

37 switch (E) {

38 case object_error::arch_not_found:

39 return "No object file for requested architecture";

40 case object_error::invalid_file_type:

41 return "The file was not recognized as a valid object file";

42 case object_error::parse_failed:

43 return "Invalid data was encountered while parsing the file";

44 case object_error::unexpected_eof:

45 return "The end of the file was unexpectedly encountered";

46 case object_error::string_table_non_null_end:

47 return "String table must end with a null terminator";

48 case object_error::invalid_section_index:

49 return "Invalid section index";

50 case object_error::bitcode_section_not_found:

51 return "Bitcode section not found in object file";

52 case object_error::invalid_symbol_index:

53 return "Invalid symbol index";

54 case object_error::section_stripped:

55 return "Section has been stripped from the object file";

56 }

57 llvm_unreachable("An enumerator of object_error does not have a message "

58 "defined.");

59}

60

61void BinaryError::anchor() {}

62char BinaryError::ID = 0;

64

66

69 : Msg(Msg.str()) {

71}

72

76

78 static _object_error_category error_category;

79 return error_category;

80}

81

83 return handleErrors(std::move(Err), [](std::unique_ptr M) -> Error {

84

85

88

89

90

91

92 return Error(std::move(M));

93 });

94}

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

void log(raw_ostream &OS) const override

Definition Error.cpp:73

GenericBinaryError(const Twine &Msg)

Definition Error.cpp:65

This class implements an extremely fast bulk output stream that can only output to a stream.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

std::error_code make_error_code(object_error e)

LLVM_ABI const std::error_category & object_category()

Definition Error.cpp:77

LLVM_ABI Error isNotObjectErrorInvalidFileType(llvm::Error Err)

isNotObjectErrorInvalidFileType() is used when looping through the children of an archive after calli...

Definition Error.cpp:82

This is an optimization pass for GlobalISel generic memory operations.

Error handleErrors(Error E, HandlerTs &&... Hs)

Pass the ErrorInfo(s) contained in E to their respective handlers.