This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Sequence statements with multiple parents correctly (PR39149)
ClosedPublic

Authored by mboehme on Oct 2 2018, 7:38 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

mboehme created this revision.Oct 2 2018, 7:38 AM
Eugene.Zelenko added a project: Restricted Project.
JonasToth added inline comments.Oct 2 2018, 11:49 AM
clang-tidy/utils/ExprSequence.cpp
103 ↗(On Diff #167946)

I find the first part of the comment unclear. Does this loop handle for only?

test/clang-tidy/bugprone-use-after-move.cpp
1198 ↗(On Diff #167946)

Which other stmts? do they produce the same false positive?

aaron.ballman added inline comments.Oct 3 2018, 12:43 PM
clang-tidy/utils/ExprSequence.cpp
103 ↗(On Diff #167946)

I think this means English "for" and not C for. Could rewrite to If a statement has multiple parents, instead.

aaron.ballman accepted this revision.Oct 3 2018, 12:44 PM

This seems reasonable to me.

This revision is now accepted and ready to land.Oct 3 2018, 12:44 PM
mboehme updated this revision to Diff 168239.Oct 4 2018, 1:44 AM
  • Responses to reviewer comments.
mboehme marked 3 inline comments as done.Oct 4 2018, 1:48 AM
mboehme added inline comments.
clang-tidy/utils/ExprSequence.cpp
103 ↗(On Diff #167946)

Yes, this is what I meant. Rephrased as Aaron suggested to remove the ambiguity.

test/clang-tidy/bugprone-use-after-move.cpp
1198 ↗(On Diff #167946)

I've added the two other examples I'm aware of (continue and break statements) to the description. However, I haven't been able to use these to construct an example that triggers the false positive.

In general, any statement that TemplateInstantiator leaves unchanged will have multiple parents; I'm not sure which other statements this applies to. In my experience, any statement that contains an expression will be rebuilt, but I may be missing something here.

Thanks for clarification :)

mboehme marked 2 inline comments as done.Oct 4 2018, 3:32 AM

Thanks for clarification :)

Thanks! Do you agree this is ready to land now?

Thanks for clarification :)

Thanks! Do you agree this is ready to land now?

Sure!

This revision was automatically updated to reflect the committed changes.