| 1 |
// RUN: cat %S/Inputs/pass-by-value/header-with-fix.h > %T/pass-by-value-header-with-fix.h |
| 2 |
// RUN: sed -e 's#//.*$##' %s > %t.cpp |
| 3 |
// RUN: clang-tidy %t.cpp -checks='-*,modernize-pass-by-value' -header-filter='.*' -fix -- -std=c++11 -I %T | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not="{{warning|error}}:" |
| 4 |
// RUN: FileCheck -input-file=%t.cpp %s -check-prefix=CHECK-FIXES |
| 5 |
// RUN: FileCheck -input-file=%T/pass-by-value-header-with-fix.h %s -check-prefix=CHECK-HEADER-FIXES |
| 6 |
|
| 7 |
#include "pass-by-value-header-with-fix.h" |
| 8 |
// CHECK-HEADER-FIXES: Foo(S s); |
| 9 |
Foo::Foo(const S &s) : s(s) {} |
| 10 |
// CHECK-MESSAGES: :9:10: warning: pass by value and use std::move [modernize-pass-by-value] |
| 11 |
// CHECK-FIXES: #include <utility> |
| 12 |
// CHECK-FIXES: Foo::Foo(S s) : s(std::move(s)) {} |