Use DebugInfoFinder

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78334 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-08-06 20:53:24 +00:00
parent 734068a90f
commit 2251666d44

View File

@ -200,13 +200,11 @@ short PIC16DbgInfo::getStorageClass(DIGlobalVariable DIGV) {
/// required initializations. /// required initializations.
void PIC16DbgInfo::BeginModule(Module &M) { void PIC16DbgInfo::BeginModule(Module &M) {
// Emit file directive for module. // Emit file directive for module.
SmallVector<GlobalVariable *, 2> CUs; DebugInfoFinder DbgFinder;
SmallVector<GlobalVariable *, 4> GVs; DbgFinder.processModule(M);
SmallVector<GlobalVariable *, 4> SPs; if (DbgFinder.compile_unit_count() != 0) {
CollectDebugInfoAnchors(M, CUs, GVs, SPs);
if (!CUs.empty()) {
// FIXME : What if more then one CUs are present in a module ? // FIXME : What if more then one CUs are present in a module ?
GlobalVariable *CU = CUs[0]; GlobalVariable *CU = *DbgFinder.compile_unit_begin();
EmitDebugDirectives = true; EmitDebugDirectives = true;
SwitchToCU(CU); SwitchToCU(CU);
} }
@ -431,15 +429,11 @@ void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, unsigned short
/// EmitVarDebugInfo - Emit debug information for all variables. /// EmitVarDebugInfo - Emit debug information for all variables.
/// ///
void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
SmallVector<GlobalVariable *, 2> CUs; DebugInfoFinder DbgFinder;
SmallVector<GlobalVariable *, 4> GVs; DbgFinder.processModule(M);
SmallVector<GlobalVariable *, 4> SPs;
CollectDebugInfoAnchors(M, CUs, GVs, SPs);
if (GVs.empty())
return;
for (SmallVector<GlobalVariable *, 4>::iterator I = GVs.begin(), for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
E = GVs.end(); I != E; ++I) { E = DbgFinder.global_variable_end(); I != E; ++I) {
DIGlobalVariable DIGV(*I); DIGlobalVariable DIGV(*I);
DIType Ty = DIGV.getType(); DIType Ty = DIGV.getType();
unsigned short TypeNo = 0; unsigned short TypeNo = 0;