[PATCH] D87500: [DebugInfo] DISubrange support for fortran assumed size array
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 12 10:23:39 PDT 2020
aprantl added a comment.
I see
================
Comment at: llvm/include/llvm/BinaryFormat/Dwarf.h:288
+ }
+ llvm_unreachable("Invalid source language");
+}
----------------
alok wrote:
> aprantl wrote:
> > This would trigger an unreachable for the interval (DW_LANG_lo_user, DW_LANG_hi_user). Why not just say `default: false` instead of trying to enumerate all non-Fortran languages?
> It was taken from function "isCPlusPlus", but I agree with you that it is better to return false for default and dont depend on llvm_unreachable to get assistance in adding new language enums. I shall update the patch.
Oh, I see what you mean now! Unfortunately I consider isCplusPlus() to be well-intentioned but broken, too. We can't have an llvm_unreachable() on perfectly valid input. A compiler frontend using LLVM as a backend, or a LLDB loading a third-party binary must not crash when encountering a user constant.
To clarify: I think the idea that isCplusPlus uses to enumerate all constants to get the switch coverage warning is good and I'm fine with keeping the long explicit switch. We just cannot allow an llvm_unreachable for valid (or invalid!) inputs. This function is used by LLDB and you don't want the debugger to crash when loading a third-party object file.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87500/new/
https://reviews.llvm.org/D87500
More information about the llvm-commits
mailing list