Page MenuHomePhabricator

[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions
ClosedPublic

Authored by jberdine on Apr 9 2019, 10:38 AM.

Details

Summary

The unwrap<Type> calls can assert with:

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast

so replace them with dyn_cast.

Diff Detail

Repository
rL LLVM

Event Timeline

jberdine created this revision.Apr 9 2019, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 9 2019, 10:38 AM
whitequark accepted this revision.Apr 9 2019, 2:48 PM

So, these are going to be deprecated in D60484, but I see no harm in merging this patch, as it's a straightforward bugfix.

This revision is now accepted and ready to land.Apr 9 2019, 2:48 PM

AFAIU D60484 is about the accessors for the current debug location used by builders, while this diff's functions are about reading the debug info from existing IR values.

But given that these are redundant, as seen in D52239, shall we just remove them?

@whitequark at least while D52239 and D60902 are up in the air, could I ask you to commit this fix for the existing functions?

This revision was automatically updated to reflect the committed changes.