[PATCH] D13871: Add modernize-use-default check to clang-tidy.

Angel Garcia via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 08:10:43 PDT 2015


angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.

Add a check that replaces empty bodies of special member functions with '= default;'.
For now, it is only implemented for the default constructor and the destructor, which are the easier cases.
The copy-constructor and the copy-assignment operator cases will be implemented later.

I applied this check to the llvm code base and found 627 warnings (385 in llvm, 9 in compiler-rt, 220 in clang and 13 in clang-tools-extra).
Applying the fixes didn't break any build or test, it only caused a -Wpedantic warning in lib/Target/Mips/MipsOptionRecord.h:33 becaused it replaced
virtual ~MipsOptionRecord(){}; to virtual ~MipsOptionRecord()= default;;

http://reviews.llvm.org/D13871

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseDefaultCheck.cpp
  clang-tidy/modernize/UseDefaultCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-default.rst
  test/clang-tidy/modernize-use-default.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13871.37759.patch
Type: text/x-patch
Size: 10735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151019/2e7532a0/attachment.bin>


More information about the cfe-commits mailing list