[llvm] [NFC][DebugInfo] Wrap DILineInfo return type with std::optional to handle missing debug info. (PR #129792)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 08:33:31 PST 2025
================
@@ -565,9 +565,11 @@ static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address,
// TODO: it is neccessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
- if (DILineInfo LineInfo = DICtx.getLineInfoForAddress(
+ DILineInfo LineInfo;
+ if (std::optional<DILineInfo> DBGLineInfo = DICtx.getLineInfoForAddress(
{Lookup, object::SectionedAddress::UndefSection}))
- LineInfo.dump(OS);
+ LineInfo = *DBGLineInfo;
+ LineInfo.dump(OS);
----------------
dwblaikie wrote:
Does this change behavior? The previous code dumped conditionally, this code dumps unconditionally?
https://github.com/llvm/llvm-project/pull/129792
More information about the llvm-commits
mailing list