diff --git a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp index 7d4659c1eaac4..9dacf1562429c 100644 --- a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -199,11 +199,12 @@ void IncludeModernizePPCallbacks::InclusionDirective( // 3. Do nothing and let the user deal with the migration himself. SourceLocation DiagLoc = FilenameRange.getBegin(); if (CStyledHeaderToCxx.count(FileName) != 0) { - IncludesToBeProcessed.push_back( + IncludesToBeProcessed.emplace_back( IncludeMarker{CStyledHeaderToCxx[FileName], FileName, FilenameRange.getAsRange(), DiagLoc}); } else if (DeleteHeaders.count(FileName) != 0) { - IncludesToBeProcessed.push_back( + IncludesToBeProcessed.emplace_back( + // NOLINTNEXTLINE(modernize-use-emplace) - false-positive IncludeMarker{std::string{}, FileName, SourceRange{HashLoc, FilenameRange.getEnd()}, DiagLoc}); } diff --git a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp index b1e1189d4ed77..660996aba7b70 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp @@ -39,10 +39,10 @@ UseStdPrintCheck::UseStdPrintCheck(StringRef Name, ClangTidyContext *Context) MaybeHeaderToInclude(Options.get("PrintHeader")) { if (PrintfLikeFunctions.empty() && FprintfLikeFunctions.empty()) { - PrintfLikeFunctions.push_back("::printf"); - PrintfLikeFunctions.push_back("absl::PrintF"); - FprintfLikeFunctions.push_back("::fprintf"); - FprintfLikeFunctions.push_back("absl::FPrintF"); + PrintfLikeFunctions.emplace_back("::printf"); + PrintfLikeFunctions.emplace_back("absl::PrintF"); + FprintfLikeFunctions.emplace_back("::fprintf"); + FprintfLikeFunctions.emplace_back("absl::FPrintF"); } if (!MaybeHeaderToInclude && (ReplacementPrintFunction == "std::print" || diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp index 5bf77bb860064..57f13db078020 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp @@ -35,9 +35,9 @@ RedundantStringCStrCheck::RedundantStringCStrCheck(StringRef Name, StringParameterFunctions(utils::options::parseStringList( Options.get("StringParameterFunctions", ""))) { if (getLangOpts().CPlusPlus20) - StringParameterFunctions.push_back("::std::format"); + StringParameterFunctions.emplace_back("::std::format"); if (getLangOpts().CPlusPlus23) - StringParameterFunctions.push_back("::std::print"); + StringParameterFunctions.emplace_back("::std::print"); } void RedundantStringCStrCheck::registerMatchers( diff --git a/clang-tools-extra/clang-tidy/utils/UsingInserter.cpp b/clang-tools-extra/clang-tidy/utils/UsingInserter.cpp index d9e0f3fc0f61b..3a2c16ff05dae 100644 --- a/clang-tools-extra/clang-tidy/utils/UsingInserter.cpp +++ b/clang-tools-extra/clang-tidy/utils/UsingInserter.cpp @@ -53,7 +53,7 @@ std::optional UsingInserter::createUsingDeclaration( Statement, Context) .empty(); if (AlreadyHasUsingDecl) { - AddedUsing.emplace(NameInFunction(Function, QualifiedName.str())); + AddedUsing.emplace(Function, QualifiedName.str()); return std::nullopt; } // Find conflicting declarations and references. @@ -69,7 +69,7 @@ std::optional UsingInserter::createUsingDeclaration( std::string Declaration = (llvm::Twine("\nusing ") + QualifiedName + ";").str(); - AddedUsing.emplace(std::make_pair(Function, QualifiedName.str())); + AddedUsing.emplace(Function, QualifiedName.str()); return FixItHint::CreateInsertion(InsertLoc, Declaration); }