diff --git a/include/llvm/ADT/SetVector.h b/include/llvm/ADT/SetVector.h index d495344655d..339a9ea068a 100644 --- a/include/llvm/ADT/SetVector.h +++ b/include/llvm/ADT/SetVector.h @@ -24,6 +24,7 @@ #include "llvm/ADT/SmallSet.h" #include #include +#include #include namespace llvm { @@ -262,7 +263,8 @@ private: set_type &set_; public: - TestAndEraseFromSet(UnaryPredicate P, set_type &set_) : P(P), set_(set_) {} + TestAndEraseFromSet(UnaryPredicate P, set_type &set_) + : P(std::move(P)), set_(set_) {} template bool operator()(const ArgumentT &Arg) { diff --git a/include/llvm/CodeGen/GCMetadata.h b/include/llvm/CodeGen/GCMetadata.h index 163117b0781..157aabb924f 100644 --- a/include/llvm/CodeGen/GCMetadata.h +++ b/include/llvm/CodeGen/GCMetadata.h @@ -40,6 +40,7 @@ #include "llvm/IR/DebugLoc.h" #include "llvm/Pass.h" #include +#include namespace llvm { class AsmPrinter; @@ -54,7 +55,7 @@ struct GCPoint { DebugLoc Loc; GCPoint(GC::PointKind K, MCSymbol *L, DebugLoc DL) - : Kind(K), Label(L), Loc(DL) {} + : Kind(K), Label(L), Loc(std::move(DL)) {} }; /// GCRoot - Metadata for a pointer to an object managed by the garbage diff --git a/include/llvm/CodeGen/PBQP/Graph.h b/include/llvm/CodeGen/PBQP/Graph.h index be04246920d..212599a761f 100644 --- a/include/llvm/CodeGen/PBQP/Graph.h +++ b/include/llvm/CodeGen/PBQP/Graph.h @@ -16,6 +16,7 @@ #define LLVM_CODEGEN_PBQP_GRAPH_H #include "llvm/Support/Debug.h" +#include #include namespace llvm { @@ -67,7 +68,7 @@ namespace PBQP { return std::numeric_limits::max(); } - NodeEntry(VectorPtr Costs) : Costs(Costs) {} + NodeEntry(VectorPtr Costs) : Costs(std::move(Costs)) {} AdjEdgeIdx addAdjEdgeId(EdgeId EId) { AdjEdgeIdx Idx = AdjEdgeIds.size(); @@ -98,7 +99,7 @@ namespace PBQP { class EdgeEntry { public: EdgeEntry(NodeId N1Id, NodeId N2Id, MatrixPtr Costs) - : Costs(Costs) { + : Costs(std::move(Costs)) { NIds[0] = N1Id; NIds[1] = N2Id; ThisEdgeAdjIdxs[0] = NodeEntry::getInvalidAdjEdgeIdx(); @@ -343,7 +344,8 @@ namespace PBQP { Graph() : Solver(nullptr) {} /// @brief Construct an empty PBQP graph with the given graph metadata. - Graph(GraphMetadata Metadata) : Metadata(Metadata), Solver(nullptr) {} + Graph(GraphMetadata Metadata) + : Metadata(std::move(Metadata)), Solver(nullptr) {} /// @brief Get a reference to the graph metadata. GraphMetadata& getMetadata() { return Metadata; } diff --git a/include/llvm/DebugInfo/CodeView/TypeRecord.h b/include/llvm/DebugInfo/CodeView/TypeRecord.h index 97b4737734b..a53570f98f3 100644 --- a/include/llvm/DebugInfo/CodeView/TypeRecord.h +++ b/include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -18,6 +18,7 @@ #include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/Support/ErrorOr.h" #include +#include namespace llvm { namespace codeview { @@ -746,7 +747,7 @@ public: explicit VFTableShapeRecord(ArrayRef Slots) : TypeRecord(TypeRecordKind::VFTableShape), SlotsRef(Slots) {} explicit VFTableShapeRecord(std::vector Slots) - : TypeRecord(TypeRecordKind::VFTableShape), Slots(Slots) {} + : TypeRecord(TypeRecordKind::VFTableShape), Slots(std::move(Slots)) {} /// Rewrite member type indices with IndexMap. Returns false if a type index /// is not in the map. @@ -1256,8 +1257,8 @@ private: class EnumeratorRecord : public TypeRecord { public: EnumeratorRecord(MemberAccess Access, APSInt Value, StringRef Name) - : TypeRecord(TypeRecordKind::Enumerator), Access(Access), Value(Value), - Name(Name) {} + : TypeRecord(TypeRecordKind::Enumerator), Access(Access), + Value(std::move(Value)), Name(Name) {} /// Rewrite member type indices with IndexMap. Returns false if a type index /// is not in the map. diff --git a/include/llvm/DebugInfo/Symbolize/Symbolize.h b/include/llvm/DebugInfo/Symbolize/Symbolize.h index ec3ae002659..1c487aafc57 100644 --- a/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -19,6 +19,7 @@ #include #include #include +#include namespace llvm { namespace symbolize { @@ -40,7 +41,7 @@ public: bool RelativeAddresses = false, std::string DefaultArch = "") : PrintFunctions(PrintFunctions), UseSymbolTable(UseSymbolTable), Demangle(Demangle), RelativeAddresses(RelativeAddresses), - DefaultArch(DefaultArch) {} + DefaultArch(std::move(DefaultArch)) {} }; LLVMSymbolizer(const Options &Opts = Options()) : Opts(Opts) {} diff --git a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h index 87555c9ad01..e34eaf4d4b5 100644 --- a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -19,12 +19,12 @@ #include "LambdaResolver.h" #include "LogicalDylib.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Debug.h" #include "llvm/Transforms/Utils/Cloning.h" #include #include #include - -#include "llvm/Support/Debug.h" +#include namespace llvm { namespace orc { @@ -173,7 +173,7 @@ public: CompileCallbackMgrT &CallbackMgr, IndirectStubsManagerBuilderT CreateIndirectStubsManager, bool CloneStubsIntoPartitions = true) - : BaseLayer(BaseLayer), Partition(Partition), + : BaseLayer(BaseLayer), Partition(std::move(Partition)), CompileCallbackMgr(CallbackMgr), CreateIndirectStubsManager(std::move(CreateIndirectStubsManager)), CloneStubsIntoPartitions(CloneStubsIntoPartitions) {} diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index c2e977724dc..bd485de91bd 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -21,6 +21,7 @@ #include "llvm/Support/Memory.h" #include #include +#include namespace llvm { @@ -78,7 +79,7 @@ public: typedef std::map ObjSectionToIDMap; LoadedObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap) - : RTDyld(RTDyld), ObjSecToIDMap(ObjSecToIDMap) { } + : RTDyld(RTDyld), ObjSecToIDMap(std::move(ObjSecToIDMap)) {} virtual object::OwningBinary getObjectForDebug(const object::ObjectFile &Obj) const = 0; diff --git a/include/llvm/IR/ProfileSummary.h b/include/llvm/IR/ProfileSummary.h index ea774631eb4..f4248014c6e 100644 --- a/include/llvm/IR/ProfileSummary.h +++ b/include/llvm/IR/ProfileSummary.h @@ -15,6 +15,7 @@ #define LLVM_SUPPORT_PROFILE_SUMMARY_H #include +#include #include #include "llvm/Support/Casting.h" @@ -62,10 +63,10 @@ public: uint64_t TotalCount, uint64_t MaxCount, uint64_t MaxInternalCount, uint64_t MaxFunctionCount, uint32_t NumCounts, uint32_t NumFunctions) - : PSK(K), DetailedSummary(DetailedSummary), TotalCount(TotalCount), - MaxCount(MaxCount), MaxInternalCount(MaxInternalCount), - MaxFunctionCount(MaxFunctionCount), NumCounts(NumCounts), - NumFunctions(NumFunctions) {} + : PSK(K), DetailedSummary(std::move(DetailedSummary)), + TotalCount(TotalCount), MaxCount(MaxCount), + MaxInternalCount(MaxInternalCount), MaxFunctionCount(MaxFunctionCount), + NumCounts(NumCounts), NumFunctions(NumFunctions) {} Kind getKind() const { return PSK; } /// \brief Return summary information as metadata. Metadata *getMD(LLVMContext &Context); diff --git a/include/llvm/LineEditor/LineEditor.h b/include/llvm/LineEditor/LineEditor.h index bb106f87ca4..68995d0633a 100644 --- a/include/llvm/LineEditor/LineEditor.h +++ b/include/llvm/LineEditor/LineEditor.h @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace llvm { @@ -137,7 +138,7 @@ private: template struct ListCompleterModel : ListCompleterConcept { - ListCompleterModel(T Value) : Value(Value) {} + ListCompleterModel(T Value) : Value(std::move(Value)) {} std::vector getCompletions(StringRef Buffer, size_t Pos) const override { return Value(Buffer, Pos); diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h index 07a75cb5901..d632ddc9132 100644 --- a/include/llvm/MC/MCParser/MCAsmLexer.h +++ b/include/llvm/MC/MCParser/MCAsmLexer.h @@ -17,6 +17,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/SMLoc.h" +#include namespace llvm { @@ -66,7 +67,7 @@ private: public: AsmToken() {} AsmToken(TokenKind Kind, StringRef Str, APInt IntVal) - : Kind(Kind), Str(Str), IntVal(IntVal) {} + : Kind(Kind), Str(Str), IntVal(std::move(IntVal)) {} AsmToken(TokenKind Kind, StringRef Str, int64_t IntVal = 0) : Kind(Kind), Str(Str), IntVal(64, IntVal, true) {} diff --git a/include/llvm/Object/SymbolicFile.h b/include/llvm/Object/SymbolicFile.h index 02b48734b6e..894c2670f26 100644 --- a/include/llvm/Object/SymbolicFile.h +++ b/include/llvm/Object/SymbolicFile.h @@ -16,6 +16,7 @@ #include "llvm/Object/Binary.h" #include "llvm/Support/Format.h" +#include namespace llvm { namespace object { @@ -58,7 +59,7 @@ class content_iterator content_type Current; public: - content_iterator(content_type symb) : Current(symb) {} + content_iterator(content_type symb) : Current(std::move(symb)) {} const content_type *operator->() const { return &Current; } diff --git a/include/llvm/ProfileData/ProfileCommon.h b/include/llvm/ProfileData/ProfileCommon.h index e43d307273a..19b60bca0d0 100644 --- a/include/llvm/ProfileData/ProfileCommon.h +++ b/include/llvm/ProfileData/ProfileCommon.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "llvm/IR/ProfileSummary.h" @@ -52,7 +53,7 @@ private: protected: SummaryEntryVector DetailedSummary; ProfileSummaryBuilder(std::vector Cutoffs) - : DetailedSummaryCutoffs(Cutoffs), TotalCount(0), MaxCount(0), + : DetailedSummaryCutoffs(std::move(Cutoffs)), TotalCount(0), MaxCount(0), MaxFunctionCount(0), NumCounts(0), NumFunctions(0) {} inline void addCount(uint64_t Count); ~ProfileSummaryBuilder() = default; diff --git a/include/llvm/Transforms/IPO/FunctionImport.h b/include/llvm/Transforms/IPO/FunctionImport.h index 91273e13416..ba5db2b5c73 100644 --- a/include/llvm/Transforms/IPO/FunctionImport.h +++ b/include/llvm/Transforms/IPO/FunctionImport.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace llvm { class LLVMContext; @@ -45,7 +46,7 @@ public: FunctionImporter( const ModuleSummaryIndex &Index, std::function(StringRef Identifier)> ModuleLoader) - : Index(Index), ModuleLoader(ModuleLoader) {} + : Index(Index), ModuleLoader(std::move(ModuleLoader)) {} /// Import functions in Module \p M based on the supplied import list. /// \p ForceImportReferencedDiscardableSymbols will set the ModuleLinker in diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp index c5793add30b..8e9252ce662 100644 --- a/lib/Analysis/TargetTransformInfo.cpp +++ b/lib/Analysis/TargetTransformInfo.cpp @@ -17,6 +17,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/Support/ErrorHandling.h" +#include using namespace llvm; @@ -397,7 +398,7 @@ TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {} TargetIRAnalysis::TargetIRAnalysis( std::function TTICallback) - : TTICallback(TTICallback) {} + : TTICallback(std::move(TTICallback)) {} TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F) { return TTICallback(F); diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index bd902ba386b..157408d6240 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -37,6 +37,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include +#include using namespace llvm; @@ -5713,13 +5714,13 @@ std::error_code ModuleSummaryIndexBitcodeReader::error(BitcodeError E) { ModuleSummaryIndexBitcodeReader::ModuleSummaryIndexBitcodeReader( MemoryBuffer *Buffer, DiagnosticHandlerFunction DiagnosticHandler, bool CheckGlobalValSummaryPresenceOnly) - : DiagnosticHandler(DiagnosticHandler), Buffer(Buffer), + : DiagnosticHandler(std::move(DiagnosticHandler)), Buffer(Buffer), CheckGlobalValSummaryPresenceOnly(CheckGlobalValSummaryPresenceOnly) {} ModuleSummaryIndexBitcodeReader::ModuleSummaryIndexBitcodeReader( DiagnosticHandlerFunction DiagnosticHandler, bool CheckGlobalValSummaryPresenceOnly) - : DiagnosticHandler(DiagnosticHandler), Buffer(nullptr), + : DiagnosticHandler(std::move(DiagnosticHandler)), Buffer(nullptr), CheckGlobalValSummaryPresenceOnly(CheckGlobalValSummaryPresenceOnly) {} void ModuleSummaryIndexBitcodeReader::freeState() { Buffer = nullptr; } diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index 319c4f5b995..c2586b5bf8c 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -34,6 +34,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" #include +#include using namespace llvm; @@ -177,7 +178,7 @@ namespace { public: static char ID; IfConverter(std::function Ftor = nullptr) - : MachineFunctionPass(ID), FnNum(-1), PredicateFtor(Ftor) { + : MachineFunctionPass(ID), FnNum(-1), PredicateFtor(std::move(Ftor)) { initializeIfConverterPass(*PassRegistry::getPassRegistry()); } diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index c95077718aa..c73db0d7e2e 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/lib/CodeGen/LiveDebugVariables.cpp @@ -42,6 +42,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" #include +#include using namespace llvm; @@ -84,7 +85,7 @@ class UserValueScopes { SmallPtrSet LBlocks; public: - UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(D), LS(L) {} + UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(std::move(D)), LS(L) {} /// dominates - Return true if current scope dominates at least one machine /// instruction in a given machine basic block. @@ -141,8 +142,8 @@ public: /// UserValue - Create a new UserValue. UserValue(const MDNode *var, const MDNode *expr, unsigned o, bool i, DebugLoc L, LocMap::Allocator &alloc) - : Variable(var), Expression(expr), offset(o), IsIndirect(i), dl(L), - leader(this), next(nullptr), locInts(alloc) {} + : Variable(var), Expression(expr), offset(o), IsIndirect(i), + dl(std::move(L)), leader(this), next(nullptr), locInts(alloc) {} /// getLeader - Get the leader of this value's equivalence class. UserValue *getLeader() { diff --git a/lib/CodeGen/MachineInstrBundle.cpp b/lib/CodeGen/MachineInstrBundle.cpp index 985a08631b9..cbfbf1d1205 100644 --- a/lib/CodeGen/MachineInstrBundle.cpp +++ b/lib/CodeGen/MachineInstrBundle.cpp @@ -17,6 +17,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" +#include using namespace llvm; namespace { @@ -24,7 +25,7 @@ namespace { public: static char ID; // Pass identification UnpackMachineBundles(std::function Ftor = nullptr) - : MachineFunctionPass(ID), PredicateFtor(Ftor) { + : MachineFunctionPass(ID), PredicateFtor(std::move(Ftor)) { initializeUnpackMachineBundlesPass(*PassRegistry::getPassRegistry()); } diff --git a/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h b/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h index d4756f7f416..237d541b4cb 100644 --- a/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h +++ b/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h @@ -16,6 +16,7 @@ #include "llvm/IR/DebugLoc.h" #include "llvm/Support/DataTypes.h" +#include namespace llvm { @@ -55,7 +56,8 @@ public: // Constructor for non-constants. SDDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool indir, uint64_t off, DebugLoc dl, unsigned O) - : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(indir) { + : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O), + IsIndirect(indir) { kind = SDNODE; u.s.Node = N; u.s.ResNo = R; @@ -64,7 +66,8 @@ public: // Constructor for constants. SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t off, DebugLoc dl, unsigned O) - : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(false) { + : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O), + IsIndirect(false) { kind = CONST; u.Const = C; } @@ -72,7 +75,8 @@ public: // Constructor for frame indices. SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t off, DebugLoc dl, unsigned O) - : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(false) { + : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O), + IsIndirect(false) { kind = FRAMEIX; u.FrameIx = FI; } diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 4905b8b7d1f..a7d296929a3 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -22,10 +22,11 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/IR/CallSite.h" -#include "llvm/IR/Statepoint.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/Statepoint.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Target/TargetLowering.h" +#include #include namespace llvm { @@ -101,8 +102,8 @@ class SelectionDAGBuilder { unsigned SDNodeOrder; public: DanglingDebugInfo() : DI(nullptr), dl(DebugLoc()), SDNodeOrder(0) { } - DanglingDebugInfo(const DbgValueInst *di, DebugLoc DL, unsigned SDNO) : - DI(di), dl(DL), SDNodeOrder(SDNO) { } + DanglingDebugInfo(const DbgValueInst *di, DebugLoc DL, unsigned SDNO) + : DI(di), dl(std::move(DL)), SDNodeOrder(SDNO) {} const DbgValueInst* getDI() { return DI; } DebugLoc getdl() { return dl; } unsigned getSDNodeOrder() { return SDNodeOrder; } @@ -260,8 +261,9 @@ private: }; struct JumpTableHeader { JumpTableHeader(APInt F, APInt L, const Value *SV, MachineBasicBlock *H, - bool E = false): - First(F), Last(L), SValue(SV), HeaderBB(H), Emitted(E) {} + bool E = false) + : First(std::move(F)), Last(std::move(L)), SValue(SV), HeaderBB(H), + Emitted(E) {} APInt First; APInt Last; const Value *SValue; @@ -286,9 +288,9 @@ private: BitTestBlock(APInt F, APInt R, const Value *SV, unsigned Rg, MVT RgVT, bool E, bool CR, MachineBasicBlock *P, MachineBasicBlock *D, BitTestInfo C, BranchProbability Pr) - : First(F), Range(R), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E), - ContiguousRange(CR), Parent(P), Default(D), Cases(std::move(C)), - Prob(Pr) {} + : First(std::move(F)), Range(std::move(R)), SValue(SV), Reg(Rg), + RegVT(RgVT), Emitted(E), ContiguousRange(CR), Parent(P), Default(D), + Cases(std::move(C)), Prob(Pr) {} APInt First; APInt Range; const Value *SValue; diff --git a/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp index 3d2b9e9a05e..9b6a9a78823 100644 --- a/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ b/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -20,6 +20,7 @@ #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" #include +#include #include using namespace llvm; @@ -205,15 +206,14 @@ public: SmallString<8> AugmentationData, uint32_t FDEPointerEncoding, uint32_t LSDAPointerEncoding) : FrameEntry(FK_CIE, Offset, Length), Version(Version), - Augmentation(std::move(Augmentation)), - AddressSize(AddressSize), + Augmentation(std::move(Augmentation)), AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize), CodeAlignmentFactor(CodeAlignmentFactor), DataAlignmentFactor(DataAlignmentFactor), ReturnAddressRegister(ReturnAddressRegister), - AugmentationData(AugmentationData), + AugmentationData(std::move(AugmentationData)), FDEPointerEncoding(FDEPointerEncoding), - LSDAPointerEncoding(LSDAPointerEncoding) { } + LSDAPointerEncoding(LSDAPointerEncoding) {} ~CIE() override {} diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index 5371f983962..d477918284e 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -7,16 +7,17 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/STLExtras.h" +#include "llvm/ExecutionEngine/RuntimeDyldChecker.h" #include "RuntimeDyldCheckerImpl.h" #include "RuntimeDyldImpl.h" -#include "llvm/ExecutionEngine/RuntimeDyldChecker.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/Path.h" #include #include +#include #define DEBUG_TYPE "rtdyld" @@ -97,7 +98,8 @@ private: public: EvalResult() : Value(0), ErrorMsg("") {} EvalResult(uint64_t Value) : Value(Value), ErrorMsg("") {} - EvalResult(std::string ErrorMsg) : Value(0), ErrorMsg(ErrorMsg) {} + EvalResult(std::string ErrorMsg) + : Value(0), ErrorMsg(std::move(ErrorMsg)) {} uint64_t getValue() const { return Value; } bool hasError() const { return ErrorMsg != ""; } const std::string &getErrorMsg() const { return ErrorMsg; } diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp index 5577c50b2a9..c8cfe203032 100644 --- a/lib/Linker/IRMover.cpp +++ b/lib/Linker/IRMover.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/TypeFinder.h" #include "llvm/Support/Error.h" #include "llvm/Transforms/Utils/Cloning.h" +#include using namespace llvm; //===----------------------------------------------------------------------===// @@ -481,8 +482,9 @@ public: IRMover::IdentifiedStructTypeSet &Set, std::unique_ptr SrcM, ArrayRef ValuesToLink, std::function AddLazyFor) - : DstM(DstM), SrcM(std::move(SrcM)), AddLazyFor(AddLazyFor), TypeMap(Set), - GValMaterializer(*this), LValMaterializer(*this), SharedMDs(SharedMDs), + : DstM(DstM), SrcM(std::move(SrcM)), AddLazyFor(std::move(AddLazyFor)), + TypeMap(Set), GValMaterializer(*this), LValMaterializer(*this), + SharedMDs(SharedMDs), Mapper(ValueMap, RF_MoveDistinctMDs | RF_IgnoreMissingLocals, &TypeMap, &GValMaterializer), AliasMCID(Mapper.registerAlternateMappingContext(AliasValueMap, diff --git a/lib/MC/MCDisassembler/Disassembler.h b/lib/MC/MCDisassembler/Disassembler.h index 1d56f24b9bd..25d17dafb57 100644 --- a/lib/MC/MCDisassembler/Disassembler.h +++ b/lib/MC/MCDisassembler/Disassembler.h @@ -28,6 +28,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/raw_ostream.h" #include +#include namespace llvm { class Target; @@ -86,15 +87,12 @@ public: LLVMOpInfoCallback getOpInfo, LLVMSymbolLookupCallback symbolLookUp, const Target *theTarget, const MCAsmInfo *mAI, - const MCRegisterInfo *mRI, - const MCSubtargetInfo *mSI, - const MCInstrInfo *mII, - llvm::MCContext *ctx, const MCDisassembler *disAsm, - MCInstPrinter *iP) : TripleName(tripleName), - DisInfo(disInfo), TagType(tagType), GetOpInfo(getOpInfo), - SymbolLookUp(symbolLookUp), TheTarget(theTarget), - Options(0), - CommentStream(CommentsToEmit) { + const MCRegisterInfo *mRI, const MCSubtargetInfo *mSI, + const MCInstrInfo *mII, llvm::MCContext *ctx, + const MCDisassembler *disAsm, MCInstPrinter *iP) + : TripleName(std::move(tripleName)), DisInfo(disInfo), TagType(tagType), + GetOpInfo(getOpInfo), SymbolLookUp(symbolLookUp), TheTarget(theTarget), + Options(0), CommentStream(CommentsToEmit) { MAI.reset(mAI); MRI.reset(mRI); MSI.reset(mSI); diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp index 17f759d848d..d1c1f6df403 100644 --- a/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -18,11 +18,12 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/IR/Function.h" // To access Function attributes +#include "llvm/IR/Function.h" // To access Function attributes #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" +#include using namespace llvm; #define DEBUG_TYPE "t2-reduce-size" @@ -213,7 +214,7 @@ namespace { } Thumb2SizeReduce::Thumb2SizeReduce(std::function Ftor) - : MachineFunctionPass(ID), PredicateFtor(Ftor) { + : MachineFunctionPass(ID), PredicateFtor(std::move(Ftor)) { OptimizeSize = MinimizeSize = false; for (unsigned i = 0, e = array_lengthof(ReduceTable); i != e; ++i) { unsigned FromOpc = ReduceTable[i].WideOpc; diff --git a/lib/Target/NVPTX/NVPTXMCExpr.h b/lib/Target/NVPTX/NVPTXMCExpr.h index 81a606d7535..7661c10fde4 100644 --- a/lib/Target/NVPTX/NVPTXMCExpr.h +++ b/lib/Target/NVPTX/NVPTXMCExpr.h @@ -14,6 +14,7 @@ #include "llvm/ADT/APFloat.h" #include "llvm/MC/MCExpr.h" +#include namespace llvm { @@ -30,7 +31,7 @@ private: const APFloat Flt; explicit NVPTXFloatMCExpr(VariantKind Kind, APFloat Flt) - : Kind(Kind), Flt(Flt) {} + : Kind(Kind), Flt(std::move(Flt)) {} public: /// @name Construction diff --git a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 9e13dcc5ed5..f842006db8f 100644 --- a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -150,7 +150,7 @@ public: // Provide the profile filename as the parameter. PGOInstrumentationUseLegacyPass(std::string Filename = "") - : ModulePass(ID), ProfileFileName(Filename) { + : ModulePass(ID), ProfileFileName(std::move(Filename)) { if (!PGOTestProfileFile.empty()) ProfileFileName = PGOTestProfileFile; initializePGOInstrumentationUseLegacyPassPass( @@ -919,7 +919,7 @@ static bool annotateAllFunctions( } PGOInstrumentationUse::PGOInstrumentationUse(std::string Filename) - : ProfileFileName(Filename) { + : ProfileFileName(std::move(Filename)) { if (!PGOTestProfileFile.empty()) ProfileFileName = PGOTestProfileFile; } diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index d2969453dff..3b197e4ac2c 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -63,6 +63,7 @@ #include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/SSAUpdater.h" #include +#include using namespace llvm; #define DEBUG_TYPE "licm" @@ -811,7 +812,7 @@ public: const AAMDNodes &AATags) : LoadAndStorePromoter(Insts, S), SomePtr(SP), PointerMustAliases(PMA), LoopExitBlocks(LEB), LoopInsertPts(LIP), PredCache(PIC), AST(ast), - LI(li), DL(dl), Alignment(alignment), AATags(AATags) {} + LI(li), DL(std::move(dl)), Alignment(alignment), AATags(AATags) {} bool isInstInList(Instruction *I, const SmallVectorImpl &) const override { diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index b3f138cf731..94467848c0b 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -35,6 +35,7 @@ #include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/UnrollLoop.h" #include +#include using namespace llvm; @@ -939,8 +940,9 @@ public: LoopUnroll(Optional Threshold = None, Optional Count = None, Optional AllowPartial = None, Optional Runtime = None) - : LoopPass(ID), ProvidedCount(Count), ProvidedThreshold(Threshold), - ProvidedAllowPartial(AllowPartial), ProvidedRuntime(Runtime) { + : LoopPass(ID), ProvidedCount(std::move(Count)), + ProvidedThreshold(Threshold), ProvidedAllowPartial(AllowPartial), + ProvidedRuntime(Runtime) { initializeLoopUnrollPass(*PassRegistry::getPassRegistry()); } diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp index e6933336947..344a89f3604 100644 --- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -21,14 +21,13 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Transforms/Scalar/SimplifyCFG.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/AssumptionCache.h" -#include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/CFG.h" +#include "llvm/Analysis/GlobalsModRef.h" +#include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" @@ -38,8 +37,10 @@ #include "llvm/IR/Module.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Scalar/SimplifyCFG.h" +#include "llvm/Transforms/Utils/Local.h" +#include using namespace llvm; #define DEBUG_TYPE "simplifycfg" @@ -204,7 +205,7 @@ struct CFGSimplifyPass : public FunctionPass { CFGSimplifyPass(int T = -1, std::function Ftor = nullptr) - : FunctionPass(ID), PredicateFtor(Ftor) { + : FunctionPass(ID), PredicateFtor(std::move(Ftor)) { BonusInstThreshold = (T == -1) ? UserBonusInstThreshold : unsigned(T); initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry()); } diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 2ccd6490512..4af4b10c4d7 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -21,6 +21,7 @@ #include "llvm/Support/raw_ostream.h" #include #include +#include using namespace llvm; #define DEBUG_TYPE "toolrunner" @@ -272,9 +273,9 @@ namespace { std::string CompilerCommand; std::vector CompilerArgs; public: - CustomCompiler( - const std::string &CompilerCmd, std::vector CompArgs) : - CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {} + CustomCompiler(const std::string &CompilerCmd, + std::vector CompArgs) + : CompilerCommand(CompilerCmd), CompilerArgs(std::move(CompArgs)) {} void compileProgram(const std::string &Bitcode, std::string *Error, @@ -333,9 +334,9 @@ namespace { std::string ExecutionCommand; std::vector ExecutorArgs; public: - CustomExecutor( - const std::string &ExecutionCmd, std::vector ExecArgs) : - ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {} + CustomExecutor(const std::string &ExecutionCmd, + std::vector ExecArgs) + : ExecutionCommand(ExecutionCmd), ExecutorArgs(std::move(ExecArgs)) {} int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 87b07181dac..44cdee4da7d 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include // FIXME: remove this declaration when we stop maintaining Ubuntu Quantal and @@ -130,7 +131,8 @@ class ThinLTOTaskInfo { public: ThinLTOTaskInfo(std::unique_ptr OS, std::string Filename, bool TempOutFile) - : OS(std::move(OS)), Filename(Filename), TempOutFile(TempOutFile) {} + : OS(std::move(OS)), Filename(std::move(Filename)), + TempOutFile(TempOutFile) {} /// Performs task related cleanup activities that must be done /// single-threaded (i.e. call backs to gold). @@ -904,7 +906,7 @@ public: const ModuleSummaryIndex *CombinedIndex, std::string Filename, StringMap *ModuleMap) : M(std::move(M)), OS(OS), TaskID(TaskID), CombinedIndex(CombinedIndex), - SaveTempsFilename(Filename), ModuleMap(ModuleMap) { + SaveTempsFilename(std::move(Filename)), ModuleMap(ModuleMap) { assert(options::thinlto == !!CombinedIndex && "Expected module summary index iff performing ThinLTO"); initTargetMachine(); diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 0e720bd06ea..7e0573a084c 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -36,6 +36,7 @@ #include "llvm/Transforms/Utils/FunctionImportUtils.h" #include +#include using namespace llvm; static cl::list @@ -146,7 +147,7 @@ public: ModuleLazyLoaderCache(std::function( const char *argv0, const std::string &FileName)> createLazyModule) - : createLazyModule(createLazyModule) {} + : createLazyModule(std::move(createLazyModule)) {} /// Retrieve a Module from the cache or lazily load it on demand. Module &operator()(const char *argv0, const std::string &FileName); diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index dfdb4ba7d7c..3089ff75303 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -59,6 +59,7 @@ #include #include #include +#include using namespace llvm; using namespace object; @@ -197,7 +198,7 @@ public: SectionFilterIterator(FilterPredicate P, llvm::object::section_iterator const &I, llvm::object::section_iterator const &E) - : Predicate(P), Iterator(I), End(E) { + : Predicate(std::move(P)), Iterator(I), End(E) { ScanPredicate(); } const llvm::object::SectionRef &operator*() const { return *Iterator; } @@ -224,7 +225,7 @@ private: class SectionFilter { public: SectionFilter(FilterPredicate P, llvm::object::ObjectFile const &O) - : Predicate(P), Object(O) {} + : Predicate(std::move(P)), Object(O) {} SectionFilterIterator begin() { return SectionFilterIterator(Predicate, Object.section_begin(), Object.section_end()); diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index d7d4bc60605..b7674a12b44 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include using namespace llvm; @@ -605,7 +606,8 @@ class IAPrinter { std::string Result; std::string AsmString; public: - IAPrinter(std::string R, std::string AS) : Result(R), AsmString(AS) {} + IAPrinter(std::string R, std::string AS) + : Result(std::move(R)), AsmString(std::move(AS)) {} void addCond(const std::string &C) { Conds.push_back(C); } diff --git a/utils/TableGen/CodeGenInstruction.h b/utils/TableGen/CodeGenInstruction.h index 8e371aff0e0..8e5a03d7b74 100644 --- a/utils/TableGen/CodeGenInstruction.h +++ b/utils/TableGen/CodeGenInstruction.h @@ -316,7 +316,8 @@ template class ArrayRef; K_Reg } Kind; - ResultOperand(std::string N, Record *r) : Name(N), R(r), Kind(K_Record) {} + ResultOperand(std::string N, Record *r) + : Name(std::move(N)), R(r), Kind(K_Record) {} ResultOperand(int64_t I) : Imm(I), Kind(K_Imm) {} ResultOperand(Record *r) : R(r), Kind(K_Reg) {} diff --git a/utils/TableGen/FastISelEmitter.cpp b/utils/TableGen/FastISelEmitter.cpp index ba96bff5d7d..debb12c4f51 100644 --- a/utils/TableGen/FastISelEmitter.cpp +++ b/utils/TableGen/FastISelEmitter.cpp @@ -24,6 +24,7 @@ #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" +#include using namespace llvm; @@ -416,9 +417,7 @@ static std::string getLegalCName(std::string OpName) { return OpName; } -FastISelMap::FastISelMap(std::string instns) - : InstNS(instns) { -} +FastISelMap::FastISelMap(std::string instns) : InstNS(std::move(instns)) {} static std::string PhyRegForNode(TreePatternNode *Op, const CodeGenTarget &Target) { diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index 15ca5590296..51f1971258f 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -28,6 +28,7 @@ #include "llvm/TableGen/Record.h" #include #include +#include #include using namespace llvm; @@ -47,7 +48,7 @@ struct OperandInfo { bool HasCompleteDecoder; OperandInfo(std::string D, bool HCD) - : Decoder(D), HasCompleteDecoder(HCD) { } + : Decoder(std::move(D)), HasCompleteDecoder(HCD) {} void addField(unsigned Base, unsigned Width, unsigned Offset) { Fields.push_back(EncodingField(Base, Width, Offset)); @@ -83,17 +84,16 @@ public: // Defaults preserved here for documentation, even though they aren't // strictly necessary given the way that this is currently being called. - FixedLenDecoderEmitter(RecordKeeper &R, - std::string PredicateNamespace, - std::string GPrefix = "if (", + FixedLenDecoderEmitter(RecordKeeper &R, std::string PredicateNamespace, + std::string GPrefix = "if (", std::string GPostfix = " == MCDisassembler::Fail)", - std::string ROK = "MCDisassembler::Success", - std::string RFail = "MCDisassembler::Fail", - std::string L = "") : - Target(R), - PredicateNamespace(PredicateNamespace), - GuardPrefix(GPrefix), GuardPostfix(GPostfix), - ReturnOK(ROK), ReturnFail(RFail), Locals(L) {} + std::string ROK = "MCDisassembler::Success", + std::string RFail = "MCDisassembler::Fail", + std::string L = "") + : Target(R), PredicateNamespace(std::move(PredicateNamespace)), + GuardPrefix(std::move(GPrefix)), GuardPostfix(std::move(GPostfix)), + ReturnOK(std::move(ROK)), ReturnFail(std::move(RFail)), + Locals(std::move(L)) {} // Emit the decoder state machine table. void emitTable(formatted_raw_ostream &o, DecoderTable &Table,