diff options
author | Devang Patel <dpatel@apple.com> | 2010-03-26 19:08:36 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-03-26 19:08:36 +0000 |
commit | d98ec5fe5bbbfbb60af2eb512440875540cef064 (patch) | |
tree | 815c68dc5abda1dbb409eb69dc27ac94b6bda675 /docs/SourceLevelDebugging.html | |
parent | 6091ff346c39b1068aacd8f99fb79c3f53397f10 (diff) | |
download | external_llvm-d98ec5fe5bbbfbb60af2eb512440875540cef064.zip external_llvm-d98ec5fe5bbbfbb60af2eb512440875540cef064.tar.gz external_llvm-d98ec5fe5bbbfbb60af2eb512440875540cef064.tar.bz2 |
Add a paragram describing how to extract line number information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/SourceLevelDebugging.html')
-rw-r--r-- | docs/SourceLevelDebugging.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/SourceLevelDebugging.html b/docs/SourceLevelDebugging.html index 66a9a2e..f92a165 100644 --- a/docs/SourceLevelDebugging.html +++ b/docs/SourceLevelDebugging.html @@ -1069,6 +1069,18 @@ int main(int argc, char *argv[]) { </pre> </div> +<p>llvm::Instruction provides easy access to metadata attached with an +instruction. One can extract line number information encoded in LLVM IR +using <tt>Instruction::getMetadata()</tt> and +<tt>DILocation::getLineNumber()</tt>. +<pre> + if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction + DILocation Loc(N); // DILocation is in DebugInfo.h + unsigned Line = Loc.getLineNumber(); + StringRef File = Loc.getFilename(); + StringRef Dir = Loc.getDirectory(); + } +</pre> </div> <!-- ======================================================================= --> |