@@ -474,8 +474,8 @@ using SetUpTestSuiteFunc = void (*)();
474474using TearDownTestSuiteFunc = void (*)();
475475
476476struct CodeLocation {
477- CodeLocation (const std::string& a_file, int a_line)
478- : file(a_file), line(a_line) {}
477+ CodeLocation (std::string a_file, int a_line)
478+ : file(std::move( a_file) ), line(a_line) {}
479479
480480 std::string file;
481481 int line;
@@ -564,7 +564,7 @@ struct SuiteApiResolver : T {
564564// The newly created TestInfo instance will assume
565565// ownership of the factory object.
566566GTEST_API_ TestInfo* MakeAndRegisterTestInfo (
567- const char * test_suite_name, const char * name, const char * type_param,
567+ std::string test_suite_name, const char * name, const char * type_param,
568568 const char * value_param, CodeLocation code_location,
569569 TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
570570 TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
@@ -595,8 +595,7 @@ class GTEST_API_ TypedTestSuitePState {
595595 fflush (stderr);
596596 posix::Abort ();
597597 }
598- registered_tests_.insert (
599- ::std::make_pair (test_name, CodeLocation(file, line)));
598+ registered_tests_.emplace (test_name, CodeLocation (file, line));
600599 return true ;
601600 }
602601
@@ -700,7 +699,7 @@ class TypeParameterizedTest {
700699 // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
701700 // Types). Valid values for 'index' are [0, N - 1] where N is the
702701 // length of Types.
703- static bool Register (const char * prefix, const CodeLocation& code_location,
702+ static bool Register (const char * prefix, CodeLocation code_location,
704703 const char * case_name, const char * test_names, int index,
705704 const std::vector<std::string>& type_names =
706705 GenerateNames<DefaultNameGenerator, Types>()) {
@@ -712,8 +711,7 @@ class TypeParameterizedTest {
712711 // list.
713712 MakeAndRegisterTestInfo (
714713 (std::string (prefix) + (prefix[0 ] == ' \0 ' ? " " : " /" ) + case_name +
715- " /" + type_names[static_cast <size_t >(index)])
716- .c_str (),
714+ " /" + type_names[static_cast <size_t >(index)]),
717715 StripTrailingSpaces (GetPrefixUntilComma (test_names)).c_str (),
718716 GetTypeName<Type>().c_str (),
719717 nullptr , // No value parameter.
@@ -725,21 +723,17 @@ class TypeParameterizedTest {
725723 new TestFactoryImpl<TestClass>);
726724
727725 // Next, recurses (at compile time) with the tail of the type list.
728- return TypeParameterizedTest<Fixture, TestSel,
729- typename Types::Tail>::Register (prefix,
730- code_location,
731- case_name,
732- test_names,
733- index + 1 ,
734- type_names);
726+ return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>::
727+ Register (prefix, std::move (code_location), case_name, test_names,
728+ index + 1 , type_names);
735729 }
736730};
737731
738732// The base case for the compile time recursion.
739733template <GTEST_TEMPLATE_ Fixture, class TestSel >
740734class TypeParameterizedTest <Fixture, TestSel, internal::None> {
741735 public:
742- static bool Register (const char * /* prefix*/ , const CodeLocation& ,
736+ static bool Register (const char * /* prefix*/ , CodeLocation,
743737 const char * /* case_name*/ , const char * /* test_names*/ ,
744738 int /* index*/ ,
745739 const std::vector<std::string>& =
@@ -786,7 +780,8 @@ class TypeParameterizedTestSuite {
786780
787781 // Next, recurses (at compile time) with the tail of the test list.
788782 return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
789- Types>::Register (prefix, code_location,
783+ Types>::Register (prefix,
784+ std::move (code_location),
790785 state, case_name,
791786 SkipComma (test_names),
792787 type_names);
0 commit comments