This is an archive of the discontinued LLVM Phabricator instance.

[codeview] make DbgVariableLocation::extractFromMachineInstruction use Optional
ClosedPublic

Authored by inglorion on Aug 29 2017, 3:01 PM.

Details

Summary

DbgVariableLocation::extractFromMachineInstruction originally
returned a boolean indicating success. This change makes it return
an Optional<DbgVariableLocation> so we cannot try to access the fields
of the struct if they aren't valid.

Diff Detail

Repository
rL LLVM

Event Timeline

inglorion created this revision.Aug 29 2017, 3:01 PM
rnk edited edge metadata.Aug 29 2017, 3:06 PM

If we don't have any consumers that can use the error messages, I would rather return Optional<DbgVariableLocation>.

inglorion updated this revision to Diff 113185.Aug 29 2017, 6:08 PM

rewritten using Optional instead of Expected

rnk accepted this revision.Aug 30 2017, 8:44 AM

lgtm

llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
33 ↗(On Diff #113185)

I think the idiomatic thing to return here is None

This revision is now accepted and ready to land.Aug 30 2017, 8:44 AM
inglorion retitled this revision from [codeview] make DbgVariableLocation::extractFromMachineInstruction use Expected to [codeview] make DbgVariableLocation::extractFromMachineInstruction use Optional.
inglorion edited the summary of this revision. (Show Details)

Use None instead of its overly verbose equivalent.

This revision was automatically updated to reflect the committed changes.
inglorion marked an inline comment as done.