Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-apply-replacements doesn't delete commas left by modernize-use-default-member-init #34024

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR35051
Status NEW
Importance P normal
Reported by watk@chromium.org
Reported on 2017-10-23 22:55:31 -0700
Last modified on 2019-06-22 14:33:10 -0700
Version unspecified
Hardware PC Linux
CC alexfh@google.com, djasper@google.com, kfunk@kde.org, klimek@google.com, oliverst@online.de, watk@chromium.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
clang-apply-replacements leaves behind commas when it removes multiple member
initializers, whereas clang-tidy cleans them up.

* This file:
struct S {
  S() : a_(false), b_(false) {}
  bool a_;
  bool b_;
};

* is transformed to this:
struct S {
  S() : , {}
  bool a_ = false;
  bool b_ = false;
};

* When running this command:
$llvm_src/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -p ../ -
clang-tidy-binary $llvm_out/bin/clang-tidy -clang-apply-replacements-binary
$llvm_out/bin/clang-apply-replacements -fix
Quuxplusone commented 6 years ago

FTR, patch at: https://reviews.llvm.org/D43500