Files
llvm-project/clang-tools-extra/test/clang-tidy/modernize-pass-by-value-macro-header.cpp
Malcolm Parsons 6b3e27219e [clang-tidy] Fix check for trivially copyable types in modernize-pass-by-value
Summary:
rL270567 excluded trivially copyable types from being moved by
modernize-pass-by-value, but it didn't exclude references to them.
Change types used in the tests to not be trivially copyable.

Reviewers: madsravn, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 291796
2017-01-12 19:20:35 +00:00

19 lines
416 B
C++

// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 -isystem %S/Inputs/Headers
// CHECK-FIXES: #include <utility>
#define HEADER <./a.h>
#include HEADER
struct A {
A(const A &) {}
A(A &&) {}
};
struct B {
B(const A &a) : a(a) {}
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move [modernize-pass-by-value]
// CHECK-FIXES: B(A a) : a(std::move(a)) {}
A a;
};