[flang-commits] [flang] [flang][debug] Support derived types. (PR #99476)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Wed Jul 24 07:58:13 PDT 2024


abidh wrote:

> Style-wise, I would prefer something like
> 
> ```
> std::optional<std::pair<uint64_t, unsigned short>> getTypeSizeAndAlignment(...)
> ```
> 
> So that callers cannot forget to check for the error condition and we do not return anything if nothing is known.
> 
> It would be a pain to add the TODO message to every callsite. Maybe putting it in a wrapper called something like `getSizeAndAlignmentOrCrash` which unwraps the optional and prints the TODO message could be one approach.
> 
> I think this would be cleaner, but I am open to other ideas.
> 
> As for the rest, the code looks good, but please wait for review by somebody more familiar with derived types.

I have now changed the function to return an `std::optional` to indicate success/failure. I also added `getTypeSizeAndAlignmentOrCrash` that retains the old behavior to termination compilation if an unsupported type is encountered.

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


More information about the flang-commits mailing list