llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-driver Author: None (serge-sans-paille) <details> <summary>Changes</summary> That's an automated patch generated from clang-tidy performance-use-std-move as a follow-up to #<!-- -->184136 --- Full diff: https://github.com/llvm/llvm-project/pull/184144.diff 20 Files Affected: - (modified) clang/lib/AST/ASTImporter.cpp (+1-1) - (modified) clang/lib/AST/ExprConstant.cpp (+2-2) - (modified) clang/lib/AST/Randstruct.cpp (+1-1) - (modified) clang/lib/Basic/FileManager.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+1-1) - (modified) clang/lib/Driver/CreateASTUnitFromArgs.cpp (+1-1) - (modified) clang/lib/Driver/Driver.cpp (+1-1) - (modified) clang/lib/Driver/OffloadBundler.cpp (+1-1) - (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+1-1) - (modified) clang/lib/Format/ContinuationIndenter.cpp (+1-1) - (modified) clang/lib/Lex/LiteralSupport.cpp (+1-1) - (modified) clang/lib/Lex/PPExpressions.cpp (+1-1) - (modified) clang/lib/Parse/ParseDecl.cpp (+2-2) - (modified) clang/lib/Sema/SemaChecking.cpp (+1-1) - (modified) clang/lib/Sema/SemaDecl.cpp (+1-1) - (modified) clang/lib/Sema/SemaInit.cpp (+1-1) - (modified) clang/lib/Sema/SemaLookup.cpp (+2-2) - (modified) clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp (+1-1) - (modified) clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (+1-1) - (modified) clang/lib/Tooling/DependencyScanningTool.cpp (+1-1) ``````````diff diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index c41d0c744e664..00af38626a8f7 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -771,7 +771,7 @@ Error ASTNodeImporter::ImportTemplateArgumentListInfo( TemplateArgumentListInfo ToTAInfo(*ToLAngleLocOrErr, *ToRAngleLocOrErr); if (auto Err = ImportTemplateArgumentListInfo(Container, ToTAInfo)) return Err; - Result = ToTAInfo; + Result = std::move(ToTAInfo); return Error::success(); } diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index feea97cd67534..a131cf8d158df 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -3742,7 +3742,7 @@ static bool handleScalarCast(EvalInfo &Info, const FPOptions FPO, const Expr *E, Info.Ctx.getIntTypeForBitwidth(64, false), Result.getInt(), DestTy, Result2.getFloat())) return false; - Result = Result2; + Result = std::move(Result2); } return true; } @@ -21603,7 +21603,7 @@ bool Expr::isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result) const { APValue Scratch; if (FastEvaluateAsRValue(this, Scratch, Ctx, IsConst) && Scratch.hasValue()) { if (Result) - *Result = Scratch; + *Result = std::move(Scratch); return true; } diff --git a/clang/lib/AST/Randstruct.cpp b/clang/lib/AST/Randstruct.cpp index c1bd76a2d0962..4d245d6db291e 100644 --- a/clang/lib/AST/Randstruct.cpp +++ b/clang/lib/AST/Randstruct.cpp @@ -162,7 +162,7 @@ void randomizeStructureLayoutImpl(const ASTContext &Context, llvm::append_range(FinalOrder, RandFields); } - FieldsOut = FinalOrder; + FieldsOut = std::move(FinalOrder); } } // anonymous namespace diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 76f732865d6ac..a126d14087963 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -501,7 +501,7 @@ bool FileManager::fixupRelativePath(const FileSystemOptions &FileSystemOpts, SmallString<128> NewPath(FileSystemOpts.WorkingDir); llvm::sys::path::append(NewPath, pathRef); - Path = NewPath; + Path = std::move(NewPath); return true; } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index b14d9d7e8d060..788599bc8746f 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1779,7 +1779,7 @@ bool CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond, return false; // Contains a label. PGO->markStmtMaybeUsed(Cond); - ResultInt = Int; + ResultInt = std::move(Int); return true; } diff --git a/clang/lib/Driver/CreateASTUnitFromArgs.cpp b/clang/lib/Driver/CreateASTUnitFromArgs.cpp index ea31a8ed07c5f..7503cd4465716 100644 --- a/clang/lib/Driver/CreateASTUnitFromArgs.cpp +++ b/clang/lib/Driver/CreateASTUnitFromArgs.cpp @@ -122,7 +122,7 @@ std::unique_ptr<ASTUnit> clang::CreateASTUnitFromCommandLine( AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size(); AST->StoredDiagnostics.swap(StoredDiagnostics); ASTUnit::ConfigureDiags(Diags, *AST, CaptureDiagnostics); - AST->DiagOpts = DiagOpts; + AST->DiagOpts = std::move(DiagOpts); AST->Diagnostics = Diags; AST->FileSystemOpts = CI->getFileSystemOpts(); AST->CodeGenOpts = std::make_unique<CodeGenOptions>(CI->getCodeGenOpts()); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 1009e9f60fae0..f6d07065a8223 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1409,7 +1409,7 @@ bool Driver::loadDefaultConfigFiles(llvm::cl::ExpansionContext &ExpCtx) { llvm::Triple PrefixTriple{ClangNameParts.TargetPrefix}; if (PrefixTriple.getArch() == llvm::Triple::UnknownArch || PrefixTriple.isOSUnknown()) - Triple = PrefixTriple; + Triple = std::move(PrefixTriple); } // Otherwise, use the real triple as used by the driver. diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index f69ac41dddb3e..74719af17ec8a 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -1523,7 +1523,7 @@ Error OffloadBundler::BundleFiles() { CompressedBuffer.assign(CompressedMemBuffer->getBufferStart(), CompressedMemBuffer->getBufferEnd()); } else - CompressedBuffer = Buffer; + CompressedBuffer = std::move(Buffer); OutputFile.write(CompressedBuffer.data(), CompressedBuffer.size()); diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index aec1ad7d2f155..66e600fed8fa5 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1921,7 +1921,7 @@ struct DarwinPlatform { DarwinPlatform Result(TargetArg, getPlatformFromOS(TT.getOS()), TT.getOSVersion(), A); VersionTuple OsVersion = TT.getOSVersion(); - Result.TargetVariantTriple = TargetVariantTriple; + Result.TargetVariantTriple = std::move(TargetVariantTriple); Result.setEnvironment(TT.getEnvironment(), OsVersion, SDKInfo); return Result; } diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 4137a23230d51..1eb17592a89e6 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -2500,7 +2500,7 @@ unsigned ContinuationIndenter::handleEndOfLine(const FormatToken &Current, Strict = StrictPenalty <= Penalty; if (Strict) { Penalty = StrictPenalty; - State = StrictState; + State = std::move(StrictState); } } if (!DryRun) { diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index c220821a0098f..a6b895e842c80 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -1699,7 +1699,7 @@ bool NumericLiteralParser::GetFixedPointValue(llvm::APInt &StoreVal, unsigned Sc IntOverflowOccurred |= Val.zext(MaxVal.getBitWidth()).ugt(MaxVal); StoreVal = Val.zext(StoreVal.getBitWidth()); } else { - StoreVal = Val; + StoreVal = std::move(Val); } return IntOverflowOccurred || ExpOverflowOccurred; diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp index 846bb958e9927..887fd25ac318d 100644 --- a/clang/lib/Lex/PPExpressions.cpp +++ b/clang/lib/Lex/PPExpressions.cpp @@ -429,7 +429,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, } else { assert(Result.Val.getBitWidth() == Val.getBitWidth() && "intmax_t smaller than char/wchar_t?"); - Result.Val = Val; + Result.Val = std::move(Val); } // Consume the token. diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index d0d006a78274e..72935f427b7f8 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -5077,7 +5077,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, } } - SS = Spec; + SS = std::move(Spec); } // Must have either 'enum name' or 'enum {...}' or (rarely) 'enum : T { ... }'. @@ -6456,7 +6456,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, if (SS.isNotEmpty()) { // The scope spec really belongs to the direct-declarator. if (D.mayHaveIdentifier()) - D.getCXXScopeSpec() = SS; + D.getCXXScopeSpec() = std::move(SS); else AnnotateScopeToken(SS, true); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index a49e3883a35a5..46d8f4bad961b 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6795,7 +6795,7 @@ static void sumOffsets(llvm::APSInt &Offset, llvm::APSInt Addend, return; } - Offset = ResOffset; + Offset = std::move(ResOffset); } namespace { diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3db91b00f9d80..8189e6b0919c6 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6727,7 +6727,7 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T, ? ConstantArrayType::getNumAddressingBits(Context, ElemTy, Res) : Res.getActiveBits(); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { - Oversized = Res; + Oversized = std::move(Res); return QualType(); } diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index b79c22603494c..5c19f4be57588 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3476,7 +3476,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, // the rest of this array subobject. if (IsFirstDesignator) { if (NextElementIndex) - *NextElementIndex = DesignatedStartIndex; + *NextElementIndex = std::move(DesignatedStartIndex); StructuredIndex = ElementIndex; return false; } diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 4dd0fa41588b5..a983a4a9a3378 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4750,7 +4750,7 @@ void TypoCorrectionConsumer::addCorrection(TypoCorrection Correction) { RI->getAsString(SemaRef.getLangOpts())}; if (NewKey < PrevKey) - *RI = Correction; + *RI = std::move(Correction); return; } } @@ -5487,7 +5487,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (BestTC.getCorrection().getAsString() != "super") { if (SecondBestTC.getCorrection().getAsString() == "super") - BestTC = SecondBestTC; + BestTC = std::move(SecondBestTC); else if ((*Consumer)["super"].front().isKeyword()) BestTC = (*Consumer)["super"].front(); } diff --git a/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp index 2f971fb05cc3b..3f0dc1d850232 100644 --- a/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp @@ -287,7 +287,7 @@ bool IvarInvalidationCheckerImpl::trackIvar(const ObjCIvarDecl *Iv, containsInvalidationMethod(IvInterf, Info, /*LookForPartial*/ false); if (Info.needsInvalidation()) { const ObjCIvarDecl *I = cast<ObjCIvarDecl>(Iv->getCanonicalDecl()); - TrackedIvars[I] = Info; + TrackedIvars[I] = std::move(Info); if (!*FirstIvarDecl) *FirstIvarDecl = I; return true; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 43dad6fef7d65..07852984e4ee3 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -1123,7 +1123,7 @@ void ExprEngine::VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, defaultEvalCall(Bldr, I, *Call); } } else { - DstPostCall = DstPreCall; + DstPostCall = std::move(DstPreCall); } getCheckerManager().runCheckersForPostCall(Dst, DstPostCall, *Call, *this); } diff --git a/clang/lib/Tooling/DependencyScanningTool.cpp b/clang/lib/Tooling/DependencyScanningTool.cpp index 30d2dc1b7c809..afe59869ad74d 100644 --- a/clang/lib/Tooling/DependencyScanningTool.cpp +++ b/clang/lib/Tooling/DependencyScanningTool.cpp @@ -211,7 +211,7 @@ std::optional<P1689Rule> DependencyScanningTool::getP1689ModuleDependencyFile( void handleProvidedAndRequiredStdCXXModules( std::optional<P1689ModuleInfo> Provided, std::vector<P1689ModuleInfo> Requires) override { - Rule.Provides = Provided; + Rule.Provides = std::move(Provided); if (Rule.Provides) Rule.Provides->SourcePath = Filename.str(); Rule.Requires = std::move(Requires); `````````` </details> https://github.com/llvm/llvm-project/pull/184144 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
