From cd9f6c53de95f5301c0152cab2ccc78d653d6270 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 12 Aug 2011 18:10:19 +0000 Subject: [PATCH] Use ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137485 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LexicalScopes.h | 3 ++- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index ccbd6dae6c5..709681b9821 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -18,6 +18,7 @@ #define LLVM_CODEGEN_LEXICALSCOPES_H #include "llvm/Metadata.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" @@ -79,7 +80,7 @@ public: LexicalScope *findLexicalScope(DebugLoc DL); /// getAbstractScopesList - Return a reference to list of abstract scopes. - SmallVector &getAbstractScopesList() { + ArrayRef getAbstractScopesList() const { return AbstractScopesList; } diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 76dc43feae9..f5c762b18ea 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1680,10 +1680,10 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { collectVariableInfo(MF, ProcessedVars); // Construct abstract scopes. - SmallVector &AList = LScopes.getAbstractScopesList(); - for (SmallVector::iterator AI = AList.begin(), - AE = AList.end(); AI != AE; ++AI) { - DISubprogram SP((*AI)->getScopeNode()); + ArrayRef AList = LScopes.getAbstractScopesList(); + for (unsigned i = 0, e = AList.size(); i != e; ++i) { + LexicalScope *AScope = AList[i]; + DISubprogram SP(AScope->getScopeNode()); if (SP.Verify()) { // Collect info for variables that were optimized out. StringRef FName = SP.getLinkageName(); @@ -1700,8 +1700,8 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { } } } - if (ProcessedSPNodes.count((*AI)->getScopeNode()) == 0) - constructScopeDIE(*AI); + if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0) + constructScopeDIE(AScope); } DIE *CurFnDIE = constructScopeDIE(LScopes.getCurrentFunctionScope());