This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Exit when input module is malformed
ClosedPublic

Authored by langston-barrett on May 20 2021, 5:08 PM.

Details

Summary

The parseInputFile function returns an empty unique_ptr to signal an
error, like when the input file doesn't exist, or is malformed. In this
case, the tool should exit immediately rather than segfault by
dereferencing the unique_ptr later.

Diff Detail

Unit TestsFailed

Event Timeline

langston-barrett requested review of this revision.May 20 2021, 5:08 PM
langston-barrett created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2021, 5:08 PM

could you add a simple test case?

Add a test case

aeubanks accepted this revision.May 21 2021, 10:35 AM

lgtm with the test CHECK change

llvm/test/tools/llvm-reduce/fail-file-open.test
6

is this error message cross platform? for example, I see

# Don't check the OS-dependent message "No such file or directory".

in llvm/test/tools/llvm-objdump/invalid-input.test

I think everything up to the error: is good enough. The main thing is that it doesn't crash.

This revision is now accepted and ready to land.May 21 2021, 10:35 AM

Update test to not depend on platform-specific error message

do you need help landing this?

do you need help landing this?

I don't have commit access if that's what you mean. Thanks very much for the review, much appreciated!

This revision was landed with ongoing or failed builds.May 25 2021, 10:01 AM
This revision was automatically updated to reflect the committed changes.