This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] misc-use-after-move: Fix failing assertion
ClosedPublic

Authored by mboehme on Mar 6 2017, 6:47 AM.

Details

Summary

I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.

This patch also fixes nondeterministic behavior in the source code
location reported for the move when the move is constained in an init list;
this was causing buildbot failures in the previous attempt to submit
this patch (see D30569 and rL297004).

Diff Detail

Repository
rL LLVM

Event Timeline

mboehme created this revision.Mar 6 2017, 6:47 AM
mboehme added inline comments.Mar 6 2017, 6:51 AM
test/clang-tidy/misc-use-after-move.cpp
285 ↗(On Diff #90692)

The column in this message was nondeterministically being reported as either 6 or 7. Disallowing InitListExpr as the moving call should guarantee that this will always be 7.

alexfh accepted this revision.Mar 6 2017, 7:23 AM

LG. So you won the flappy column game? ;)

This revision is now accepted and ready to land.Mar 6 2017, 7:23 AM

LG. So you won the flappy column game? ;)

I hope so... ;)

I think we should refactor this check as part of Static Analyzer, since it's path-sensitive.

alexfh added a comment.Mar 6 2017, 1:52 PM

I think we should refactor this check as part of Static Analyzer, since it's path-sensitive.

We can think about trying this as a SA checker, but it's irrelevant to this patch.

klimek added a subscriber: klimek.Mar 8 2017, 4:24 AM

I think we should refactor this check as part of Static Analyzer, since it's path-sensitive.

Are you saying it should be path sensitive? Because currently it's not, right?

I think we should refactor this check as part of Static Analyzer, since it's path-sensitive.

Are you saying it should be path sensitive? Because currently it's not, right?

(Will submit in the meantime because this is a wider discussion that doesn't impact this patch specifically. But let's continue the discussion.)

This revision was automatically updated to reflect the committed changes.

I think we should refactor this check as part of Static Analyzer, since it's path-sensitive.

Are you saying it should be path sensitive? Because currently it's not, right?

It handle paths, as far as I could tell from regression test. But will it handle all possible paths? What about path reporting? And this is definitely duplication of Static Analyzer functionality.