This is an archive of the discontinued LLVM Phabricator instance.

[ORC] fix unreachable code bug
ClosedPublic

Authored by nickdesaulniers on May 19 2019, 10:26 PM.

Details

Reviewers
lhames
Summary

This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
31".

I assume that the CtorDtorsByPriority map is always meant to be cleared,
on success or failure.

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2019, 10:26 PM

We don't want to clear unconditionally: we should (at least optionally) preserve the state so that clients can attempt recovery from transient errors (e.g. network drop-outs).

That said, I think the behavior you have proposed is reasonable. We could make it the default by adding an argument to the run method:

Error run(bool ClearCtorDtorsOnFailure = true);

Or we should add a clear() method to the CtorDtorRunner interface and document that clients need to clear the list manually on failure. I think the first option is probably less error-prone.

Wouldn't just deleting L142 from the existing sources be simpler? (or moving L146-148 into the for loop at the end (L142)?

lhames accepted this revision.Jul 7 2019, 7:07 PM

Wouldn't just deleting L142 from the existing sources be simpler? (or moving L146-148 into the for loop at the end (L142)?

Moving 146/148 into the loop gets you "map cleared on success but not on error" behavior, which is what I had intended. I have made that change in r361199, so I will close this out.

My thoughts above were on how to get "Optionally cleared on error" behavior, which I think is useful. Implementing that can wait for another day though.

This revision is now accepted and ready to land.Jul 7 2019, 7:07 PM
lhames closed this revision.Jul 7 2019, 7:07 PM

Committed in r361199.