[llvm] [AMDGPU] Add disassembler diagnostics for invalid kernel descriptors (PR #87400)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 00:16:56 PDT 2024


================
@@ -2051,41 +2051,51 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
       for (size_t SHI = 0; SHI < SymbolsHere.size(); ++SHI) {
         SymbolInfoTy Symbol = SymbolsHere[SHI];
 
-        auto Status = DT->DisAsm->onSymbolStart(
+        Error Err = Error::success();
+        bool Responded = DT->DisAsm->onSymbolStart(
----------------
jh7370 wrote:

Looks to me like this could (should?) be returning an `Expected<bool>` rather than a regular `bool` with an `Error` output parameter. As far as I can tell, there are 3 possible situations:
1. returns `false` with no `Error`.
2. returns `true` with no `Error`.
3. returns `true` with an `Error`.

So those become:
1. returns `Expected<bool>(false)`
2. returns `Expected<bool>(true)`
3. returns `Error(...)`

Doing it this way would simplify the code a bit.

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


More information about the llvm-commits mailing list