[PATCH] [clang-tidy] Add a checker for code that looks like a delegate constructors but doesn't delegate.

Benjamin Kramer benny.kra at gmail.com
Fri Jul 25 08:22:56 PDT 2014


Hi alexfh, djasper,

class Foo {
  Foo() {
    Foo(42); // oops
  }
  Foo(int);
};

This is valid code but it does nothing and we can't emit a warning in clang
because there might be side effects. The checker emits a warning for this
pattern and also for base class initializers written in this style.

There is some overlap with the unused-rtti checker but they follow different
goals and fire in different places most of the time.

http://reviews.llvm.org/D4667

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/UndelegatedConstructor.cpp
  clang-tidy/misc/UndelegatedConstructor.h
  test/clang-tidy/misc-undelegated-constructor.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4667.11880.patch
Type: text/x-patch
Size: 7256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140725/a2d50bb3/attachment.bin>


More information about the cfe-commits mailing list