diff options
| author | Devang Patel <dpatel@apple.com> | 2009-09-16 18:20:05 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-09-16 18:20:05 +0000 |
| commit | 820640d39fd1cb23aa70a167b2c11c30fc43b165 (patch) | |
| tree | 9075cae51cf5bdeb96185dec49c871dc35b975cf /llvm/lib | |
| parent | 0d9950e315b724eddab37774d418634114a0e2bb (diff) | |
| download | bcm5719-llvm-820640d39fd1cb23aa70a167b2c11c30fc43b165.tar.gz bcm5719-llvm-820640d39fd1cb23aa70a167b2c11c30fc43b165.zip | |
Provide a way to extract location info from DILocation.
llvm-svn: 82064
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index d09704f3039..78cbad87f43 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -1210,6 +1210,29 @@ namespace llvm { } /// ExtractDebugLocation - Extract debug location information + /// from DILocation. + DebugLoc ExtractDebugLocation(DILocation &Loc, + DebugLocTracker &DebugLocInfo) { + DebugLoc DL; + MDNode *Context = Loc.getScope().getNode(); + + // If this location is already tracked then use it. + DebugLocTuple Tuple(Context, Loc.getLineNumber(), + Loc.getColumnNumber()); + DenseMap<DebugLocTuple, unsigned>::iterator II + = DebugLocInfo.DebugIdMap.find(Tuple); + if (II != DebugLocInfo.DebugIdMap.end()) + return DebugLoc::get(II->second); + + // Add a new location entry. + unsigned Id = DebugLocInfo.DebugLocations.size(); + DebugLocInfo.DebugLocations.push_back(Tuple); + DebugLocInfo.DebugIdMap[Tuple] = Id; + + return DebugLoc::get(Id); + } + + /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.func_start intrinsic. DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, DebugLocTracker &DebugLocInfo) { |

