Index: include/llvm/ADT/iterator_range.h =================================================================== --- include/llvm/ADT/iterator_range.h +++ include/llvm/ADT/iterator_range.h @@ -32,9 +32,9 @@ IteratorT begin_iterator, end_iterator; public: - iterator_range(IteratorT begin_iterator, IteratorT end_iterator) - : begin_iterator(std::move(begin_iterator)), - end_iterator(std::move(end_iterator)) {} + iterator_range(const IteratorT &begin_iterator, const IteratorT &end_iterator) + : begin_iterator(begin_iterator), + end_iterator(end_iterator) {} IteratorT begin() const { return begin_iterator; } IteratorT end() const { return end_iterator; } @@ -44,12 +44,12 @@ /// /// This provides a bit of syntactic sugar to make using sub-ranges /// in for loops a bit easier. Analogous to std::make_pair(). -template iterator_range make_range(T x, T y) { - return iterator_range(std::move(x), std::move(y)); +template iterator_range make_range(const T &x, const T &y) { + return iterator_range(x, y); } template iterator_range make_range(std::pair p) { - return iterator_range(std::move(p.first), std::move(p.second)); + return iterator_range(p.first, p.second); } } Index: include/llvm/CodeGen/DIE.h =================================================================== --- include/llvm/CodeGen/DIE.h +++ include/llvm/CodeGen/DIE.h @@ -559,7 +559,7 @@ class DIEValueList { struct Node : IntrusiveBackListNode { DIEValue V; - explicit Node(DIEValue V) : V(V) {} + explicit Node(const DIEValue &V) : V(V) {} }; typedef IntrusiveBackList ListTy; @@ -602,7 +602,7 @@ const DIEValue &operator*() const { return wrapped()->V; } }; - iterator insert(BumpPtrAllocator &Alloc, DIEValue V) { + iterator insert(BumpPtrAllocator &Alloc, const DIEValue &V) { List.push_back(*new (Alloc) Node(V)); return iterator(ListTy::toIterator(List.back())); } @@ -713,7 +713,7 @@ /// addValue - Add a value and attributes to a DIE. /// - value_iterator addValue(BumpPtrAllocator &Alloc, DIEValue Value) { + value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &Value) { return Values.insert(Alloc, Value); } template Index: include/llvm/IR/PassManager.h =================================================================== --- include/llvm/IR/PassManager.h +++ include/llvm/IR/PassManager.h @@ -344,11 +344,11 @@ /// This provides an initialized and set-up analysis pass to the analysis /// manager. Whomever is setting up analysis passes must use this to populate /// the manager with all of the analysis passes available. - template void registerPass(PassT Pass) { + template void registerPass(const PassT &Pass) { assert(!AnalysisPasses.count(PassT::ID()) && "Registered the same analysis pass twice!"); typedef detail::AnalysisPassModel PassModelT; - AnalysisPasses[PassT::ID()].reset(new PassModelT(std::move(Pass))); + AnalysisPasses[PassT::ID()].reset(new PassModelT(Pass)); } /// \brief Invalidate a specific analysis pass for an IR module. Index: include/llvm/IR/PassManagerInternal.h =================================================================== --- include/llvm/IR/PassManagerInternal.h +++ include/llvm/IR/PassManagerInternal.h @@ -310,7 +310,7 @@ /// \c AnalysisManager to PassT's run method. template struct AnalysisPassModel : AnalysisPassConcept { - explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {} + explicit AnalysisPassModel(const PassT &Pass) : Pass(Pass) {} // We have to explicitly define all the special member functions because MSVC // refuses to generate them. AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {} Index: include/llvm/Object/SymbolicFile.h =================================================================== --- include/llvm/Object/SymbolicFile.h +++ include/llvm/Object/SymbolicFile.h @@ -51,7 +51,7 @@ content_type Current; public: - content_iterator(content_type symb) : Current(symb) {} + content_iterator(const content_type &symb) : Current(symb) {} const content_type *operator->() const { return &Current; } Index: include/llvm/Support/AlignOf.h =================================================================== --- include/llvm/Support/AlignOf.h +++ include/llvm/Support/AlignOf.h @@ -129,49 +129,7 @@ template struct AlignedCharArray; -// We provide special variations of this template for the most common -// alignments because __declspec(align(...)) doesn't actually work when it is -// a member of a by-value function argument in MSVC, even if the alignment -// request is something reasonably like 8-byte or 16-byte. Note that we can't -// even include the declspec with the union that forces the alignment because -// MSVC warns on the existence of the declspec despite the union member forcing -// proper alignment. - -template -struct AlignedCharArray<1, Size> { - union { - char aligned; - char buffer[Size]; - }; -}; - -template -struct AlignedCharArray<2, Size> { - union { - short aligned; - char buffer[Size]; - }; -}; - -template -struct AlignedCharArray<4, Size> { - union { - int aligned; - char buffer[Size]; - }; -}; - -template -struct AlignedCharArray<8, Size> { - union { - double aligned; - char buffer[Size]; - }; -}; - - -// The rest of these are provided with a __declspec(align(...)) and we simply -// can't pass them by-value as function arguments on MSVC. +// Note: these can't be passed by value because of the __declspec(align(..)). #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ template \ @@ -179,6 +137,10 @@ __declspec(align(x)) char buffer[Size]; \ }; +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8) LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16) LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32) LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64) Index: lib/CodeGen/AsmPrinter/DIEHash.h =================================================================== --- lib/CodeGen/AsmPrinter/DIEHash.h +++ lib/CodeGen/AsmPrinter/DIEHash.h @@ -134,7 +134,7 @@ void hashLocList(const DIELocList &LocList); /// \brief Hashes an individual attribute. - void hashAttribute(DIEValue Value, dwarf::Tag Tag); + void hashAttribute(const DIEValue &Value, dwarf::Tag Tag); /// \brief Hashes an attribute that refers to another DIE. void hashDIEEntry(dwarf::Attribute Attribute, dwarf::Tag Tag, Index: lib/CodeGen/AsmPrinter/DIEHash.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DIEHash.cpp +++ lib/CodeGen/AsmPrinter/DIEHash.cpp @@ -279,7 +279,7 @@ // Hash an individual attribute \param Attr based on the type of attribute and // the form. -void DIEHash::hashAttribute(DIEValue Value, dwarf::Tag Tag) { +void DIEHash::hashAttribute(const DIEValue &Value, dwarf::Tag Tag) { dwarf::Attribute Attribute = Value.getAttribute(); // Other attribute values use the letter 'A' as the marker, and the value Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp =================================================================== --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -189,9 +189,9 @@ return getParser().Error(L, Msg, Ranges); } - bool validatetLDMRegList(MCInst Inst, const OperandVector &Operands, + bool validatetLDMRegList(const MCInst &Inst, const OperandVector &Operands, unsigned ListNo, bool IsARPop = false); - bool validatetSTMRegList(MCInst Inst, const OperandVector &Operands, + bool validatetSTMRegList(const MCInst &Inst, const OperandVector &Operands, unsigned ListNo); int tryParseRegister(); @@ -6033,8 +6033,9 @@ // return 'true' if register list contains non-low GPR registers, // 'false' otherwise. If Reg is in the register list or is HiReg, set // 'containsReg' to true. -static bool checkLowRegisterList(MCInst Inst, unsigned OpNo, unsigned Reg, - unsigned HiReg, bool &containsReg) { +static bool checkLowRegisterList(const MCInst &Inst, unsigned OpNo, + unsigned Reg, unsigned HiReg, + bool &containsReg) { containsReg = false; for (unsigned i = OpNo; i < Inst.getNumOperands(); ++i) { unsigned OpReg = Inst.getOperand(i).getReg(); @@ -6049,8 +6050,8 @@ // Check if the specified regisgter is in the register list of the inst, // starting at the indicated operand number. -static bool listContainsReg(MCInst &Inst, unsigned OpNo, unsigned Reg) { - for (unsigned i = OpNo; i < Inst.getNumOperands(); ++i) { +static bool listContainsReg(const MCInst &Inst, unsigned OpNo, unsigned Reg) { + for (unsigned i = OpNo, e = Inst.getNumOperands(); i < e; ++i) { unsigned OpReg = Inst.getOperand(i).getReg(); if (OpReg == Reg) return true; @@ -6068,7 +6069,7 @@ } -bool ARMAsmParser::validatetLDMRegList(MCInst Inst, +bool ARMAsmParser::validatetLDMRegList(const MCInst &Inst, const OperandVector &Operands, unsigned ListNo, bool IsARPop) { const ARMOperand &Op = static_cast(*Operands[ListNo]); @@ -6091,7 +6092,7 @@ return false; } -bool ARMAsmParser::validatetSTMRegList(MCInst Inst, +bool ARMAsmParser::validatetSTMRegList(const MCInst &Inst, const OperandVector &Operands, unsigned ListNo) { const ARMOperand &Op = static_cast(*Operands[ListNo]);