This is an archive of the discontinued LLVM Phabricator instance.

Restore the ability to check if LLVMCreateObjectFile was successful
ClosedPublic

Authored by dotdash on Sep 1 2014, 1:53 PM.

Details

Summary

Until r216870 LLVMCreateObjectFile returned nullptr in case of an error,
so callers could check if the call was successful. Now, it always
returns an OwningBinary wrapped as an LLVMObjectFileRef, so callers
can't check if the call was successul.

This results in a segfault running e.g.

llvm-c-test --object-list-sections < /dev/null

So the old behaviour should be restored.

Diff Detail

Event Timeline

dotdash updated this revision to Diff 13145.Sep 1 2014, 1:53 PM
dotdash retitled this revision from to Restore the ability to check if LLVMCreateObjectFile was successful.
dotdash updated this object.
dotdash edited the test plan for this revision. (Show Details)
dotdash added a subscriber: Unknown Object (MLST).
rafael accepted this revision.Sep 2 2014, 11:08 AM
rafael added a reviewer: rafael.
rafael added a subscriber: rafael.

OK as long as the commit includes a testcase.

This revision is now accepted and ready to land.Sep 2 2014, 11:08 AM
dotdash updated this revision to Diff 13176.Sep 2 2014, 12:13 PM
dotdash edited edge metadata.

Added a test case.

rafael added inline comments.Sep 2 2014, 12:26 PM
test/Bindings/llvm-c/objectfile.ll
1 ↗(On Diff #13176)

We have a not utility that you can use instead of || true.

With no arguments "not foo" is true if "foo" is false, but not if foo crashes.

dotdash updated this revision to Diff 13177.Sep 2 2014, 12:34 PM

Thanks, did not known about "not" before. Updated the test case to use it.

LGTM, thanks a lot!

Diffusion closed this revision.Sep 5 2014, 2:31 PM
Diffusion updated this revision to Diff 13342.

Closed by commit rL217279 (authored by bsteinbr).