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 | 1b75f44bd9b1cf4a532940ff986c9ee8bd21564f (patch) | |
tree | cc8a3597d3df52036e0c466a90fa172903db50e6 /lib/Analysis | |
parent | cea188aa5f5325947ecd85414bd1d5477c14e21a (diff) | |
download | external_llvm-1b75f44bd9b1cf4a532940ff986c9ee8bd21564f.zip external_llvm-1b75f44bd9b1cf4a532940ff986c9ee8bd21564f.tar.gz external_llvm-1b75f44bd9b1cf4a532940ff986c9ee8bd21564f.tar.bz2 |
Provide a way to extract location info from DILocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index d09704f..78cbad8 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/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) { |