1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Apply clang-tidy's misc-move-constructor-init throughout LLVM.

No functionality change intended, maybe a tiny performance improvement.

llvm-svn: 270997
This commit is contained in:
Benjamin Kramer 2016-05-27 14:27:24 +00:00
parent 18b7d75488
commit a855b3205f
38 changed files with 139 additions and 99 deletions

View File

@ -24,6 +24,7 @@
#include "llvm/ADT/SmallSet.h"
#include <algorithm>
#include <cassert>
#include <utility>
#include <vector>
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 <typename ArgumentT>
bool operator()(const ArgumentT &Arg) {

View File

@ -40,6 +40,7 @@
#include "llvm/IR/DebugLoc.h"
#include "llvm/Pass.h"
#include <memory>
#include <utility>
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

View File

@ -16,6 +16,7 @@
#define LLVM_CODEGEN_PBQP_GRAPH_H
#include "llvm/Support/Debug.h"
#include <utility>
#include <vector>
namespace llvm {
@ -67,7 +68,7 @@ namespace PBQP {
return std::numeric_limits<AdjEdgeIdx>::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; }

View File

@ -18,6 +18,7 @@
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/ErrorOr.h"
#include <cinttypes>
#include <utility>
namespace llvm {
namespace codeview {
@ -746,7 +747,7 @@ public:
explicit VFTableShapeRecord(ArrayRef<VFTableSlotKind> Slots)
: TypeRecord(TypeRecordKind::VFTableShape), SlotsRef(Slots) {}
explicit VFTableShapeRecord(std::vector<VFTableSlotKind> 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.

View File

@ -19,6 +19,7 @@
#include <map>
#include <memory>
#include <string>
#include <utility>
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) {}

View File

@ -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 <list>
#include <memory>
#include <set>
#include "llvm/Support/Debug.h"
#include <utility>
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) {}

View File

@ -21,6 +21,7 @@
#include "llvm/Support/Memory.h"
#include <map>
#include <memory>
#include <utility>
namespace llvm {
@ -78,7 +79,7 @@ public:
typedef std::map<object::SectionRef, unsigned> ObjSectionToIDMap;
LoadedObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
: RTDyld(RTDyld), ObjSecToIDMap(ObjSecToIDMap) { }
: RTDyld(RTDyld), ObjSecToIDMap(std::move(ObjSecToIDMap)) {}
virtual object::OwningBinary<object::ObjectFile>
getObjectForDebug(const object::ObjectFile &Obj) const = 0;

View File

@ -15,6 +15,7 @@
#define LLVM_SUPPORT_PROFILE_SUMMARY_H
#include <cstdint>
#include <utility>
#include <vector>
#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);

View File

@ -15,6 +15,7 @@
#include <cstdio>
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace llvm {
@ -137,7 +138,7 @@ private:
template <typename T>
struct ListCompleterModel : ListCompleterConcept {
ListCompleterModel(T Value) : Value(Value) {}
ListCompleterModel(T Value) : Value(std::move(Value)) {}
std::vector<Completion> getCompletions(StringRef Buffer,
size_t Pos) const override {
return Value(Buffer, Pos);

View File

@ -17,6 +17,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/SMLoc.h"
#include <utility>
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) {}

View File

@ -16,6 +16,7 @@
#include "llvm/Object/Binary.h"
#include "llvm/Support/Format.h"
#include <utility>
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; }

View File

@ -18,6 +18,7 @@
#include <cstdint>
#include <functional>
#include <map>
#include <utility>
#include <vector>
#include "llvm/IR/ProfileSummary.h"
@ -52,7 +53,7 @@ private:
protected:
SummaryEntryVector DetailedSummary;
ProfileSummaryBuilder(std::vector<uint32_t> 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;

View File

@ -17,6 +17,7 @@
#include <functional>
#include <map>
#include <unordered_set>
#include <utility>
namespace llvm {
class LLVMContext;
@ -45,7 +46,7 @@ public:
FunctionImporter(
const ModuleSummaryIndex &Index,
std::function<std::unique_ptr<Module>(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

View File

@ -17,6 +17,7 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/ErrorHandling.h"
#include <utility>
using namespace llvm;
@ -397,7 +398,7 @@ TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {}
TargetIRAnalysis::TargetIRAnalysis(
std::function<Result(const Function &)> TTICallback)
: TTICallback(TTICallback) {}
: TTICallback(std::move(TTICallback)) {}
TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F) {
return TTICallback(F);

View File

@ -37,6 +37,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <deque>
#include <utility>
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; }

View File

@ -34,6 +34,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <algorithm>
#include <utility>
using namespace llvm;
@ -177,7 +178,7 @@ namespace {
public:
static char ID;
IfConverter(std::function<bool(const Function &)> Ftor = nullptr)
: MachineFunctionPass(ID), FnNum(-1), PredicateFtor(Ftor) {
: MachineFunctionPass(ID), FnNum(-1), PredicateFtor(std::move(Ftor)) {
initializeIfConverterPass(*PassRegistry::getPassRegistry());
}

View File

@ -42,6 +42,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <memory>
#include <utility>
using namespace llvm;
@ -84,7 +85,7 @@ class UserValueScopes {
SmallPtrSet<const MachineBasicBlock *, 4> 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() {

View File

@ -17,6 +17,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <utility>
using namespace llvm;
namespace {
@ -24,7 +25,7 @@ namespace {
public:
static char ID; // Pass identification
UnpackMachineBundles(std::function<bool(const Function &)> Ftor = nullptr)
: MachineFunctionPass(ID), PredicateFtor(Ftor) {
: MachineFunctionPass(ID), PredicateFtor(std::move(Ftor)) {
initializeUnpackMachineBundlesPass(*PassRegistry::getPassRegistry());
}

View File

@ -16,6 +16,7 @@
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/DataTypes.h"
#include <utility>
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;
}

View File

@ -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 <utility>
#include <vector>
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;

View File

@ -20,6 +20,7 @@
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <utility>
#include <vector>
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 {}

View File

@ -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 <cctype>
#include <memory>
#include <utility>
#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; }

View File

@ -19,6 +19,7 @@
#include "llvm/IR/TypeFinder.h"
#include "llvm/Support/Error.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include <utility>
using namespace llvm;
//===----------------------------------------------------------------------===//
@ -481,8 +482,9 @@ public:
IRMover::IdentifiedStructTypeSet &Set, std::unique_ptr<Module> SrcM,
ArrayRef<GlobalValue *> ValuesToLink,
std::function<void(GlobalValue &, IRMover::ValueAdder)> 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,

View File

@ -28,6 +28,7 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <utility>
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);

View File

@ -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 <utility>
using namespace llvm;
#define DEBUG_TYPE "t2-reduce-size"
@ -213,7 +214,7 @@ namespace {
}
Thumb2SizeReduce::Thumb2SizeReduce(std::function<bool(const 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;

View File

@ -14,6 +14,7 @@
#include "llvm/ADT/APFloat.h"
#include "llvm/MC/MCExpr.h"
#include <utility>
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

View File

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

View File

@ -63,6 +63,7 @@
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
#include <algorithm>
#include <utility>
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<Instruction *> &) const override {

View File

@ -35,6 +35,7 @@
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/UnrollLoop.h"
#include <climits>
#include <utility>
using namespace llvm;
@ -939,8 +940,9 @@ public:
LoopUnroll(Optional<unsigned> Threshold = None,
Optional<unsigned> Count = None,
Optional<bool> AllowPartial = None, Optional<bool> 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());
}

View File

@ -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 <utility>
using namespace llvm;
#define DEBUG_TYPE "simplifycfg"
@ -204,7 +205,7 @@ struct CFGSimplifyPass : public FunctionPass {
CFGSimplifyPass(int T = -1,
std::function<bool(const Function &)> Ftor = nullptr)
: FunctionPass(ID), PredicateFtor(Ftor) {
: FunctionPass(ID), PredicateFtor(std::move(Ftor)) {
BonusInstThreshold = (T == -1) ? UserBonusInstThreshold : unsigned(T);
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
}

View File

@ -21,6 +21,7 @@
#include "llvm/Support/raw_ostream.h"
#include <fstream>
#include <sstream>
#include <utility>
using namespace llvm;
#define DEBUG_TYPE "toolrunner"
@ -272,9 +273,9 @@ namespace {
std::string CompilerCommand;
std::vector<std::string> CompilerArgs;
public:
CustomCompiler(
const std::string &CompilerCmd, std::vector<std::string> CompArgs) :
CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {}
CustomCompiler(const std::string &CompilerCmd,
std::vector<std::string> 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<std::string> ExecutorArgs;
public:
CustomExecutor(
const std::string &ExecutionCmd, std::vector<std::string> ExecArgs) :
ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
CustomExecutor(const std::string &ExecutionCmd,
std::vector<std::string> ExecArgs)
: ExecutionCommand(ExecutionCmd), ExecutorArgs(std::move(ExecArgs)) {}
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,

View File

@ -51,6 +51,7 @@
#include <list>
#include <plugin-api.h>
#include <system_error>
#include <utility>
#include <vector>
// FIXME: remove this declaration when we stop maintaining Ubuntu Quantal and
@ -130,7 +131,8 @@ class ThinLTOTaskInfo {
public:
ThinLTOTaskInfo(std::unique_ptr<raw_fd_ostream> 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<MemoryBufferRef> *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();

View File

@ -36,6 +36,7 @@
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
#include <memory>
#include <utility>
using namespace llvm;
static cl::list<std::string>
@ -146,7 +147,7 @@ public:
ModuleLazyLoaderCache(std::function<std::unique_ptr<Module>(
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);

View File

@ -59,6 +59,7 @@
#include <cctype>
#include <cstring>
#include <system_error>
#include <utility>
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());

View File

@ -27,6 +27,7 @@
#include <algorithm>
#include <cassert>
#include <map>
#include <utility>
#include <vector>
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); }

View File

@ -316,7 +316,8 @@ template <typename T> 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) {}

View File

@ -24,6 +24,7 @@
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <utility>
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) {

View File

@ -28,6 +28,7 @@
#include "llvm/TableGen/Record.h"
#include <map>
#include <string>
#include <utility>
#include <vector>
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,