This is an archive of the discontinued LLVM Phabricator instance.

[cfi-verify] Add an interesting unit test where undef search length changes result.
ClosedPublic

Authored by hctim on Oct 6 2017, 6:01 PM.

Details

Summary

Add an interesting unit test, found by changing --search-length-undef from the default. Program handles it correctly but good for ensuring correctness on further changes :)

Diff Detail

Repository
rL LLVM

Event Timeline

hctim updated this revision to Diff 121355.Nov 2 2017, 1:24 PM

Updated with Vlad's comments, and rebased against master.

hctim updated this revision to Diff 121356.Nov 2 2017, 1:24 PM

Accidentally updated the wrong patch - reverted last diff.

pcc accepted this revision.Nov 3 2017, 11:10 AM

LGTM

unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
654 ↗(On Diff #121356)

Maybe SearchLengthForUndef should be a field on FileAnalysis?

This revision is now accepted and ready to land.Nov 3 2017, 11:10 AM
hctim added inline comments.Nov 3 2017, 11:15 AM
unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
654 ↗(On Diff #121356)

My thoughts are that SearchLengthForUndef should be a singleton across all instances of FileAnalysis. It just so happens that FileAnalysis is always a singleton (apart from these unit tests), and I'm not sure that duplicating this data is neccessary. WDYT?

pcc added inline comments.Nov 3 2017, 11:54 AM
unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
654 ↗(On Diff #121356)

Up to you, but it seems that making it a field would make your tests less error-prone, which to me means that it's probably the "right" architecture.

hctim added inline comments.Nov 3 2017, 12:57 PM
unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
654 ↗(On Diff #121356)

I think I'd prefer to have the flag closer to the place that it's used, rather than be a flag that's copied into each FileAnalysis instance at runtime and then passed through options injection into GraphBuilder. I think it makes the usage of it too far from the definition for somehting that (in a non-test environment) is unchanged after startup.

Feel free to overwrite me on this though, I'll follow it up in a further patch if that's what you desire :)

hctim updated this revision to Diff 121531.Nov 3 2017, 12:58 PM

Merge in HEAD for submission.

This revision was automatically updated to reflect the committed changes.