14 lines · cpp
1// RUN: mkdir -p %t.dir2// RUN: cat %S/Inputs/pass-by-value/header-with-fix.h > %t.dir/pass-by-value-header-with-fix.h3// RUN: sed -e 's#//.*$##' %s > %t.dir/code.cpp4// RUN: clang-tidy %t.dir/code.cpp -checks='-*,modernize-pass-by-value' -header-filter='.*' -fix -- -std=c++11 -I %t.dir | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not="{{warning|error}}:"5// RUN: FileCheck -input-file=%t.dir/code.cpp %s -check-prefix=CHECK-FIXES6// RUN: FileCheck -input-file=%t.dir/pass-by-value-header-with-fix.h %s -check-prefix=CHECK-HEADER-FIXES7 8#include "pass-by-value-header-with-fix.h"9// CHECK-HEADER-FIXES: Foo(S s);10Foo::Foo(const S &s) : s(s) {}11// CHECK-MESSAGES: :10:10: warning: pass by value and use std::move [modernize-pass-by-value]12// CHECK-FIXES: #include <utility>13// CHECK-FIXES: Foo::Foo(S s) : s(std::move(s)) {}14