summaryrefslogtreecommitdiffstats
path: root/llvm/docs/SourceLevelDebugging.html
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-03-26 19:08:36 +0000
committerDevang Patel <dpatel@apple.com>2010-03-26 19:08:36 +0000
commit5bc1c4bd4e4fba7ea12ea9446447d889040e67c1 (patch)
tree68ff19616d19e0d43c3d1fc0b96e4b589b9413a2 /llvm/docs/SourceLevelDebugging.html
parent66de04936bc95efd6862e18f1d069793966fd79e (diff)
downloadbcm5719-llvm-5bc1c4bd4e4fba7ea12ea9446447d889040e67c1.tar.gz
bcm5719-llvm-5bc1c4bd4e4fba7ea12ea9446447d889040e67c1.zip
Add a paragram describing how to extract line number information.
llvm-svn: 99636
Diffstat (limited to 'llvm/docs/SourceLevelDebugging.html')
-rw-r--r--llvm/docs/SourceLevelDebugging.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/docs/SourceLevelDebugging.html b/llvm/docs/SourceLevelDebugging.html
index 66a9a2e34ef..f92a1656a90 100644
--- a/llvm/docs/SourceLevelDebugging.html
+++ b/llvm/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>
<!-- ======================================================================= -->
OpenPOWER on IntegriCloud