forked from OSchip/llvm-project
Pass some DataLayout arguments by const-ref
Avoid unnecessary copies, reported by MSVC static analyzer.
This commit is contained in:
parent
2ac53fffae
commit
5f2c53bdf4
|
@ -435,7 +435,7 @@ private:
|
|||
DenseMap<Value*, unsigned> FieldIndexByKey;
|
||||
|
||||
public:
|
||||
FrameTypeBuilder(LLVMContext &Context, DataLayout const &DL,
|
||||
FrameTypeBuilder(LLVMContext &Context, const DataLayout &DL,
|
||||
Optional<Align> MaxFrameAlignment)
|
||||
: DL(DL), Context(Context), MaxFrameAlignment(MaxFrameAlignment) {}
|
||||
|
||||
|
@ -840,8 +840,9 @@ static StringRef solveTypeName(Type *Ty) {
|
|||
return "UnknownType";
|
||||
}
|
||||
|
||||
static DIType *solveDIType(DIBuilder &Builder, Type *Ty, DataLayout &Layout,
|
||||
DIScope *Scope, unsigned LineNum,
|
||||
static DIType *solveDIType(DIBuilder &Builder, Type *Ty,
|
||||
const DataLayout &Layout, DIScope *Scope,
|
||||
unsigned LineNum,
|
||||
DenseMap<Type *, DIType *> &DITypeCache) {
|
||||
if (DIType *DT = DITypeCache.lookup(Ty))
|
||||
return DT;
|
||||
|
|
|
@ -67,7 +67,8 @@ bool isUsefullToPreserve(Attribute::AttrKind Kind) {
|
|||
|
||||
/// This function will try to transform the given knowledge into a more
|
||||
/// canonical one. the canonical knowledge maybe the given one.
|
||||
RetainedKnowledge canonicalizedKnowledge(RetainedKnowledge RK, DataLayout DL) {
|
||||
RetainedKnowledge canonicalizedKnowledge(RetainedKnowledge RK,
|
||||
const DataLayout &DL) {
|
||||
switch (RK.AttrKind) {
|
||||
default:
|
||||
return RK;
|
||||
|
|
|
@ -153,7 +153,7 @@ ArrayRef<unsigned> FunctionFiller::getRegistersSetUp() const {
|
|||
}
|
||||
|
||||
static std::unique_ptr<Module>
|
||||
createModule(const std::unique_ptr<LLVMContext> &Context, const DataLayout DL) {
|
||||
createModule(const std::unique_ptr<LLVMContext> &Context, const DataLayout &DL) {
|
||||
auto Mod = std::make_unique<Module>(ModuleID, *Context);
|
||||
Mod->setDataLayout(DL);
|
||||
return Mod;
|
||||
|
|
Loading…
Reference in New Issue