Remove a function argument and propagate const around accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168338 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2012-11-19 22:42:15 +00:00
parent 0f1c7f6216
commit c4639d6ec2
4 changed files with 19 additions and 15 deletions

View File

@ -836,7 +836,7 @@ namespace llvm {
public: public:
/// processModule - Process entire module and collect debug info /// processModule - Process entire module and collect debug info
/// anchors. /// anchors.
void processModule(Module &M); void processModule(const Module &M);
private: private:
/// processType - Process DIType. /// processType - Process DIType.
@ -849,7 +849,7 @@ namespace llvm {
void processSubprogram(DISubprogram SP); void processSubprogram(DISubprogram SP);
/// processDeclare - Process DbgDeclareInst. /// processDeclare - Process DbgDeclareInst.
void processDeclare(DbgDeclareInst *DDI); void processDeclare(const DbgDeclareInst *DDI);
/// processLocation - Process DILocation. /// processLocation - Process DILocation.
void processLocation(DILocation Loc); void processLocation(DILocation Loc);

View File

@ -190,7 +190,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
{ {
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled); NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
beginModule(M); beginModule();
} }
} }
DwarfDebug::~DwarfDebug() { DwarfDebug::~DwarfDebug() {
@ -684,7 +684,7 @@ void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU,
/// collectInfoFromNamedMDNodes - Collect debug info from named mdnodes such /// collectInfoFromNamedMDNodes - Collect debug info from named mdnodes such
/// as llvm.dbg.enum and llvm.dbg.ty /// as llvm.dbg.enum and llvm.dbg.ty
void DwarfDebug::collectInfoFromNamedMDNodes(Module *M) { void DwarfDebug::collectInfoFromNamedMDNodes(const Module *M) {
if (NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp")) if (NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp"))
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
const MDNode *N = NMD->getOperand(i); const MDNode *N = NMD->getOperand(i);
@ -716,7 +716,7 @@ void DwarfDebug::collectInfoFromNamedMDNodes(Module *M) {
/// collectLegacyDebugInfo - Collect debug info using DebugInfoFinder. /// collectLegacyDebugInfo - Collect debug info using DebugInfoFinder.
/// FIXME - Remove this when dragon-egg and llvm-gcc switch to DIBuilder. /// FIXME - Remove this when dragon-egg and llvm-gcc switch to DIBuilder.
bool DwarfDebug::collectLegacyDebugInfo(Module *M) { bool DwarfDebug::collectLegacyDebugInfo(const Module *M) {
DebugInfoFinder DbgFinder; DebugInfoFinder DbgFinder;
DbgFinder.processModule(*M); DbgFinder.processModule(*M);
@ -759,10 +759,12 @@ bool DwarfDebug::collectLegacyDebugInfo(Module *M) {
/// beginModule - Emit all Dwarf sections that should come prior to the /// beginModule - Emit all Dwarf sections that should come prior to the
/// content. Create global DIEs and emit initial debug info sections. /// content. Create global DIEs and emit initial debug info sections.
/// This is invoked by the target AsmPrinter. /// This is invoked by the target AsmPrinter.
void DwarfDebug::beginModule(Module *M) { void DwarfDebug::beginModule() {
if (DisableDebugInfoPrinting) if (DisableDebugInfoPrinting)
return; return;
const Module *M = MMI->getModule();
// If module has named metadata anchors then use them, otherwise scan the // If module has named metadata anchors then use them, otherwise scan the
// module using debug info finder to collect debug info. // module using debug info finder to collect debug info.
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu"); NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
@ -798,7 +800,9 @@ void DwarfDebug::beginModule(Module *M) {
/// endModule - Emit all Dwarf sections that should come after the content. /// endModule - Emit all Dwarf sections that should come after the content.
/// ///
void DwarfDebug::endModule() { void DwarfDebug::endModule() {
if (!FirstCU) return; if (!FirstCU) return;
const Module *M = MMI->getModule(); const Module *M = MMI->getModule();
DenseMap<const MDNode *, LexicalScope *> DeadFnScopeMap; DenseMap<const MDNode *, LexicalScope *> DeadFnScopeMap;

View File

@ -494,15 +494,15 @@ public:
/// collectInfoFromNamedMDNodes - Collect debug info from named mdnodes such /// collectInfoFromNamedMDNodes - Collect debug info from named mdnodes such
/// as llvm.dbg.enum and llvm.dbg.ty /// as llvm.dbg.enum and llvm.dbg.ty
void collectInfoFromNamedMDNodes(Module *M); void collectInfoFromNamedMDNodes(const Module *M);
/// collectLegacyDebugInfo - Collect debug info using DebugInfoFinder. /// collectLegacyDebugInfo - Collect debug info using DebugInfoFinder.
/// FIXME - Remove this when DragonEgg switches to DIBuilder. /// FIXME - Remove this when DragonEgg switches to DIBuilder.
bool collectLegacyDebugInfo(Module *M); bool collectLegacyDebugInfo(const Module *M);
/// beginModule - Emit all Dwarf sections that should come prior to the /// beginModule - Emit all Dwarf sections that should come prior to the
/// content. /// content.
void beginModule(Module *M); void beginModule();
/// endModule - Emit all Dwarf sections that should come after the content. /// endModule - Emit all Dwarf sections that should come after the content.
/// ///

View File

@ -793,7 +793,7 @@ bool llvm::isSubprogramContext(const MDNode *Context) {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// processModule - Process entire module and collect debug info. /// processModule - Process entire module and collect debug info.
void DebugInfoFinder::processModule(Module &M) { void DebugInfoFinder::processModule(const Module &M) {
if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) { if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
DICompileUnit CU(CU_Nodes->getOperand(i)); DICompileUnit CU(CU_Nodes->getOperand(i));
@ -819,11 +819,11 @@ void DebugInfoFinder::processModule(Module &M) {
} }
} }
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI) for (Function::const_iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE; for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
++BI) { ++BI) {
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI)) if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
processDeclare(DDI); processDeclare(DDI);
DebugLoc Loc = BI->getDebugLoc(); DebugLoc Loc = BI->getDebugLoc();
@ -927,7 +927,7 @@ void DebugInfoFinder::processSubprogram(DISubprogram SP) {
} }
/// processDeclare - Process DbgDeclareInst. /// processDeclare - Process DbgDeclareInst.
void DebugInfoFinder::processDeclare(DbgDeclareInst *DDI) { void DebugInfoFinder::processDeclare(const DbgDeclareInst *DDI) {
MDNode *N = dyn_cast<MDNode>(DDI->getVariable()); MDNode *N = dyn_cast<MDNode>(DDI->getVariable());
if (!N) return; if (!N) return;