From b4d31306a4f9e84a7ab6ace99964634adb4bf7e6 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 31 Jul 2009 18:18:52 +0000 Subject: [PATCH] Process DbgDeclareInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77694 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DebugInfo.h | 3 +++ lib/Analysis/DebugInfo.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index f35bbc14d4e..5e24a57cfe6 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -638,6 +638,9 @@ namespace llvm { /// processRegionEnd - Process DbgRegionEnd. void processRegionEnd(DbgRegionEndInst *DRE); + /// processDeclare - Process DbgDeclareInst. + void processDeclare(DbgDeclareInst *DDI); + /// addCompileUnit - Add compile unit into CUs. bool addCompileUnit(DICompileUnit CU); diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 18996232870..5ecfdcdd449 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -924,6 +924,8 @@ void DebugInfoFinder::processModule(Module &M) { processRegionStart(DRS); else if (DbgRegionEndInst *DRE = dyn_cast(BI)) processRegionEnd(DRE); + else if (DbgDeclareInst *DDI = dyn_cast(BI)) + processDeclare(DDI); } for (Module::global_iterator GVI = M.global_begin(), GVE = M.global_end(); @@ -1003,6 +1005,19 @@ void DebugInfoFinder::processRegionEnd(DbgRegionEndInst *DRE) { processSubprogram(DISubprogram(SP)); } +/// processDeclare - Process DbgDeclareInst. +void DebugInfoFinder::processDeclare(DbgDeclareInst *DDI) { + DIVariable DV(cast(DDI->getVariable())); + if (DV.isNull()) + return; + + if (!NodesSeen.insert(DV.getGV())) + return; + + addCompileUnit(DV.getCompileUnit()); + processType(DV.getType()); +} + /// addCompileUnit - Add compile unit into CUs. bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) { if (CU.isNull()) -- 2.11.0