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&.

llvm-svn: 212202
This commit is contained in:
David Blaikie 2014-07-02 18:30:05 +00:00
parent de58870394
commit a8c3509ffe
4 changed files with 8 additions and 8 deletions

View File

@ -935,7 +935,7 @@ private:
bool TypeMapInitialized;
};
DenseMap<Function *, DISubprogram> makeSubprogramMap(Module &M);
DenseMap<const Function *, DISubprogram> makeSubprogramMap(const Module &M);
} // end namespace llvm

View File

@ -1527,8 +1527,9 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) {
return cast<ConstantInt>(Val)->getZExtValue();
}
llvm::DenseMap<llvm::Function *, llvm::DISubprogram> llvm::makeSubprogramMap(Module &M) {
DenseMap<Function *, DISubprogram> R;
llvm::DenseMap<const llvm::Function *, llvm::DISubprogram>
llvm::makeSubprogramMap(const Module &M) {
DenseMap<const Function *, DISubprogram> R;
NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes)

View File

@ -84,7 +84,7 @@ namespace {
bool doInitialization(CallGraph &CG) override;
/// The maximum number of elements to expand, or 0 for unlimited.
unsigned maxElements;
DenseMap<Function *, DISubprogram> FunctionDIs;
DenseMap<const Function *, DISubprogram> FunctionDIs;
};
}

View File

@ -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<Function*, DISubprogram> FunctionDIMap;
FunctionDIMap FunctionDIs;
DenseMap<const Function *, DISubprogram> 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);