LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 35051 - clang-apply-replacements doesn't delete commas left by modernize-use-default-member-init
Summary: clang-apply-replacements doesn't delete commas left by modernize-use-default-...
Status: NEW
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-23 22:55 PDT by watk
Modified: 2019-06-22 14:33 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description watk 2017-10-23 22:55:31 PDT
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