[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:
parent
c2784e11cc
commit
095e1694d9
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ void randomizeStructureLayoutImpl(const ASTContext &Context,
|
||||
llvm::append_range(FinalOrder, RandFields);
|
||||
}
|
||||
|
||||
FieldsOut = FinalOrder;
|
||||
FieldsOut = std::move(FinalOrder);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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());
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -6803,7 +6803,7 @@ static void sumOffsets(llvm::APSInt &Offset, llvm::APSInt Addend,
|
||||
return;
|
||||
}
|
||||
|
||||
Offset = ResOffset;
|
||||
Offset = std::move(ResOffset);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user