Files
llvm-project/clang-tools-extra/test/clang-tidy/cert-oop11-cpp.cpp
Alexander Kornienko 6e39e68983 [clang-tidy] Move checks from misc- to performance-
Summary:
rename_check.py misc-move-constructor-init performance-move-constructor-init
rename_check.py misc-inefficient-algorithm performance-inefficient-algorithm

Reviewers: hokein, aaron.ballman

Reviewed By: hokein, aaron.ballman

Subscribers: aaron.ballman, mgorny, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D40487

llvm-svn: 319023
2017-11-27 13:06:28 +00:00

22 lines
582 B
C++

// RUN: %check_clang_tidy %s cert-oop11-cpp %t -- -- -std=c++11
struct B {
B(B&&) noexcept = default;
B(const B &) = default;
B& operator=(const B&) = default;
~B() {}
};
struct D {
B b;
// CHECK-MESSAGES: :[[@LINE+1]]:14: warning: move constructor initializes class member by calling a copy constructor [cert-oop11-cpp]
D(D &&d) : b(d.b) {}
// This should not produce a diagnostic because it is not covered under
// the CERT guideline for OOP11-CPP. However, this will produce a diagnostic
// under performance-move-constructor-init.
D(B b) : b(b) {}
};