[llvm] [MsgPack] Return an Error instead of bool from readFromBlob (PR #74357)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 10:31:04 PST 2023


================
@@ -5513,41 +5513,42 @@ static AMDNote getAMDNote(uint32_t NoteType, ArrayRef<uint8_t> Desc) {
 struct AMDGPUNote {
   std::string Type;
   std::string Value;
+  bool IsError;
 };
 
 template <typename ELFT>
 static AMDGPUNote getAMDGPUNote(uint32_t NoteType, ArrayRef<uint8_t> Desc) {
----------------
arichardson wrote:

Something like
```c++
      const Expected<AMDGPUNote> N = getAMDGPUNote<ELFT>(Type, Descriptor);
      if (!N) {
        OS << "    "AMDGPU Metadata:\n        " <<toString(N.takeError())) << '\n';
        // Fallthrough to printing the description data blob on error.
      } else {
        OS << "    " << N->Type << ":\n        " << N->Value << '\n';
        return Error::success();
      }
```

https://github.com/llvm/llvm-project/pull/74357


More information about the llvm-commits mailing list