[PATCH] D87244: [clang] Add fix-it for -Wreorder-ctor.

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 10:03:33 PDT 2020


adamcz created this revision.
Herald added subscribers: cfe-commits, mgrang.
Herald added a project: clang.
adamcz requested review of this revision.

This version is very limited. It does not work when comments are present
anywhere in the initializer list, since we do not have a good way to
associate them to specific initalizer and move them around.

The fix-it is associated with the last ctor-order diagnostic and
reorders all initializers. This is better than providing fix for each
diagnostic generated, since user would have to apply them one-by-one.

This also fixes a bug that would trigger an assert() in dependent
classes, when initializer present in code might not be found in the
idealized list of initializers. That is related to PR7179.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87244

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/warn-reorder-ctor-initialization.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87244.290311.patch
Type: text/x-patch
Size: 8889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200907/0d5c6b34/attachment-0001.bin>


More information about the cfe-commits mailing list