This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] - PerformanceUnnecesaryCopyInitialization - only trigger for decl stmts with single VarDecl.
ClosedPublic

Authored by flx on May 3 2016, 6:36 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

flx updated this revision to Diff 55982.May 3 2016, 6:36 AM
flx retitled this revision from to [clang-tidy] - PerformanceUnnecesaryCopyInitialization - only trigger for decl stmts with single VarDecl..
flx updated this object.
flx added a reviewer: alexfh.
flx set the repository for this revision to rL LLVM.
flx added a subscriber: cfe-commits.
alexfh edited edge metadata.May 3 2016, 6:51 AM

Is it a workaround to avoid breaking the code by incorrect fixes?

flx added a comment.May 3 2016, 7:54 AM

Is it a workaround to avoid breaking the code by incorrect fixes?

Yes. We can't simply change the type of DeclStmt when we only look one of the VarDecls and how it is initialized.

flx added a comment.May 5 2016, 6:13 PM
In D19865#419905, @flx wrote:

Is it a workaround to avoid breaking the code by incorrect fixes?

Yes. We can't simply change the type of DeclStmt when we only look one of the VarDecls and how it is initialized.

Also, all tests still pass. Alex, do you have any particular concern with this approach?

alexfh added a comment.May 6 2016, 2:34 AM
In D19865#423140, @flx wrote:
In D19865#419905, @flx wrote:

Is it a workaround to avoid breaking the code by incorrect fixes?

Yes. We can't simply change the type of DeclStmt when we only look one of the VarDecls and how it is initialized.

Also, all tests still pass. Alex, do you have any particular concern with this approach?

Even if we can't easily provide an automated fix (we could teach the check to split declarations, but it might not worth the effort), we could still emit a warning. WDYT?

flx updated this revision to Diff 56573.May 9 2016, 7:22 AM
flx edited edge metadata.
flx removed rL LLVM as the repository for this revision.
In D19865#423140, @flx wrote:
In D19865#419905, @flx wrote:

Is it a workaround to avoid breaking the code by incorrect fixes?

Yes. We can't simply change the type of DeclStmt when we only look one of the VarDecls and how it is initialized.

Also, all tests still pass. Alex, do you have any particular concern with this approach?

In D19865#423140, @flx wrote:
In D19865#419905, @flx wrote:

Is it a workaround to avoid breaking the code by incorrect fixes?

Yes. We can't simply change the type of DeclStmt when we only look one of the VarDecls and how it is initialized.

Also, all tests still pass. Alex, do you have any particular concern with this approach?

Even if we can't easily provide an automated fix (we could teach the check to split declarations, but it might not worth the effort), we could still emit a warning. WDYT?

Sounds good. Done. We now still issue the warning, but don't issue fixes when it's not a single decl.

alexfh accepted this revision.May 11 2016, 10:35 AM
alexfh edited edge metadata.

LG.

This revision is now accepted and ready to land.May 11 2016, 10:35 AM
This revision was automatically updated to reflect the committed changes.