From 8446d2db2a4c8d197c5226ffc9f5fcf9aa80ae05 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 2 Jul 2014 18:30:05 +0000 Subject: [PATCH] Constify the Function pointers in the result of makeSubprogramMap These don't need to be mutable and callers being added soon in CodeGen won't have access to non-const Module&. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212202 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DebugInfo.h | 2 +- lib/IR/DebugInfo.cpp | 5 +++-- lib/Transforms/IPO/ArgumentPromotion.cpp | 2 +- lib/Transforms/IPO/DeadArgumentElimination.cpp | 7 +++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index b397877a48e..088eb9f0104 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -935,7 +935,7 @@ private: bool TypeMapInitialized; }; -DenseMap makeSubprogramMap(Module &M); +DenseMap makeSubprogramMap(const Module &M); } // end namespace llvm diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index c28dc693e77..5e39b242dbb 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -1527,8 +1527,9 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) { return cast(Val)->getZExtValue(); } -llvm::DenseMap llvm::makeSubprogramMap(Module &M) { - DenseMap R; +llvm::DenseMap +llvm::makeSubprogramMap(const Module &M) { + DenseMap R; NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); if (!CU_Nodes) diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 2e89a252a8e..97a119b01bc 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -84,7 +84,7 @@ namespace { bool doInitialization(CallGraph &CG) override; /// The maximum number of elements to expand, or 0 for unlimited. unsigned maxElements; - DenseMap FunctionDIs; + DenseMap FunctionDIs; }; } diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index fa8ef2a3dae..ac3853dbd67 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -127,8 +127,7 @@ namespace { // As the code generation for module is finished (and DIBuilder is // finalized) we assume that subprogram descriptors won't be changed, and // they are stored in map for short duration anyway. - typedef DenseMap FunctionDIMap; - FunctionDIMap FunctionDIs; + DenseMap FunctionDIs; protected: // DAH uses this to specify a different ID. @@ -297,7 +296,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { } // Patch the pointer to LLVM function in debug info descriptor. - FunctionDIMap::iterator DI = FunctionDIs.find(&Fn); + auto DI = FunctionDIs.find(&Fn); if (DI != FunctionDIs.end()) DI->second.replaceFunction(NF); @@ -1057,7 +1056,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { } // Patch the pointer to LLVM function in debug info descriptor. - FunctionDIMap::iterator DI = FunctionDIs.find(F); + auto DI = FunctionDIs.find(F); if (DI != FunctionDIs.end()) DI->second.replaceFunction(NF);