[clang] Turn misc copy-assign to move-assign (#184144)

That's an automated patch generated from clang-tidy
performance-use-std-move as a follow-up to #184136
This commit is contained in:
serge-sans-paille 2026-03-04 12:37:29 +00:00 committed by GitHub
parent c2784e11cc
commit 095e1694d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 23 additions and 23 deletions

View File

@ -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();
}

View File

@ -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;
}

View File

@ -162,7 +162,7 @@ void randomizeStructureLayoutImpl(const ASTContext &Context,
llvm::append_range(FinalOrder, RandFields);
}
FieldsOut = FinalOrder;
FieldsOut = std::move(FinalOrder);
}
} // anonymous namespace

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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());

View File

@ -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.

View File

@ -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());

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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.

View File

@ -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);

View File

@ -6803,7 +6803,7 @@ static void sumOffsets(llvm::APSInt &Offset, llvm::APSInt Addend,
return;
}
Offset = ResOffset;
Offset = std::move(ResOffset);
}
namespace {

View File

@ -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();
}

View File

@ -3475,7 +3475,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;
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);